1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00

MSan added with fixes for libc++

This commit is contained in:
Leonid Fedorov
2025-07-12 00:57:46 +00:00
parent d4d87ad07f
commit 680adce45d
122 changed files with 587 additions and 471 deletions

View File

@@ -32,7 +32,7 @@ source "$SCRIPT_LOCATION"/utils.sh
echo "Arguments received: $@" echo "Arguments received: $@"
optparse.define short=A long=asan desc="Build with ASAN" variable=ASAN default=false value=true optparse.define short=A long=asan desc="Build with ASan" variable=ASAN default=false value=true
optparse.define short=a long=build-path desc="Path for build output" variable=MARIA_BUILD_PATH default=$DEFAULT_MARIA_BUILD_PATH optparse.define short=a long=build-path desc="Path for build output" variable=MARIA_BUILD_PATH default=$DEFAULT_MARIA_BUILD_PATH
optparse.define short=B long=run-microbench desc="Compile and run microbenchmarks " variable=RUN_BENCHMARKS default=false value=true optparse.define short=B long=run-microbench desc="Compile and run microbenchmarks " variable=RUN_BENCHMARKS default=false value=true
optparse.define short=c long=cloud desc="Enable cloud storage" variable=CLOUD_STORAGE_ENABLED default=false value=true optparse.define short=c long=cloud desc="Enable cloud storage" variable=CLOUD_STORAGE_ENABLED default=false value=true
@@ -44,7 +44,8 @@ optparse.define short=f long=do-not-freeze-revision desc="Disable revision freez
optparse.define short=g long=alien desc="Turn off maintainer mode (ex. -Werror)" variable=MAINTAINER_MODE default=true value=false optparse.define short=g long=alien desc="Turn off maintainer mode (ex. -Werror)" variable=MAINTAINER_MODE default=true value=false
optparse.define short=G long=draw-deps desc="Draw dependencies graph" variable=DRAW_DEPS default=false value=true optparse.define short=G long=draw-deps desc="Draw dependencies graph" variable=DRAW_DEPS default=false value=true
optparse.define short=j long=parallel desc="Number of paralles for build" variable=CPUS default=$(getconf _NPROCESSORS_ONLN) optparse.define short=j long=parallel desc="Number of paralles for build" variable=CPUS default=$(getconf _NPROCESSORS_ONLN)
optparse.define short=M long=skip-smoke desc="Skip final smoke test" variable=SKIP_SMOKE default=false value=true optparse.define short=M long=msan desc="Build with MSan" variable=MSAN default=false value=true
optparse.define short=m long=skip-smoke desc="Skip final smoke test" variable=SKIP_SMOKE default=false value=true
optparse.define short=N long=ninja desc="Build with ninja" variable=USE_NINJA default=false value=true optparse.define short=N long=ninja desc="Build with ninja" variable=USE_NINJA default=false value=true
optparse.define short=n long=no-clean-install desc="Do not perform a clean install (keep existing db files)" variable=NO_CLEAN default=false value=true optparse.define short=n long=no-clean-install desc="Do not perform a clean install (keep existing db files)" variable=NO_CLEAN default=false value=true
optparse.define short=o long=recompile-only variable=RECOMPILE_ONLY default=false value=true optparse.define short=o long=recompile-only variable=RECOMPILE_ONLY default=false value=true
@@ -55,9 +56,9 @@ optparse.define short=r long=restart-services variable=RESTART_SERVICES default=
optparse.define short=R long=gcc-toolset-for-rocky-8 variable=GCC_TOOLSET default=false value=true optparse.define short=R long=gcc-toolset-for-rocky-8 variable=GCC_TOOLSET default=false value=true
optparse.define short=S long=skip-columnstore-submodules desc="Skip columnstore submodules initialization" variable=SKIP_SUBMODULES default=false value=true optparse.define short=S long=skip-columnstore-submodules desc="Skip columnstore submodules initialization" variable=SKIP_SUBMODULES default=false value=true
optparse.define short=t long=build-type desc="Build Type: ${BUILD_TYPE_OPTIONS[*]}" variable=MCS_BUILD_TYPE optparse.define short=t long=build-type desc="Build Type: ${BUILD_TYPE_OPTIONS[*]}" variable=MCS_BUILD_TYPE
optparse.define short=T long=tsan desc="Build with TSAN" variable=TSAN default=false value=true optparse.define short=T long=tsan desc="Build with TSan" variable=TSAN default=false value=true
optparse.define short=u long=skip-unit-tests desc="Skip UnitTests" variable=SKIP_UNIT_TESTS default=false value=true optparse.define short=u long=skip-unit-tests desc="Skip UnitTests" variable=SKIP_UNIT_TESTS default=false value=true
optparse.define short=U long=ubsan desc="Build with UBSAN" variable=UBSAN default=false value=true optparse.define short=U long=ubsan desc="Build with UBSan" variable=UBSAN default=false value=true
optparse.define short=v long=verbose desc="Verbose makefile commands" variable=MAKEFILE_VERBOSE default=false value=true optparse.define short=v long=verbose desc="Verbose makefile commands" variable=MAKEFILE_VERBOSE default=false value=true
optparse.define short=V long=add-branch-name-to-outdir desc="Add branch name to build output directory" variable=BRANCH_NAME_TO_OUTDIR default=false value=true optparse.define short=V long=add-branch-name-to-outdir desc="Add branch name to build output directory" variable=BRANCH_NAME_TO_OUTDIR default=false value=true
optparse.define short=W long=without-core-dumps desc="Do not produce core dumps" variable=WITHOUT_COREDUMPS default=false value=true optparse.define short=W long=without-core-dumps desc="Do not produce core dumps" variable=WITHOUT_COREDUMPS default=false value=true
@@ -397,6 +398,11 @@ construct_cmake_flags() {
MDB_CMAKE_FLAGS+=(-DWITH_UBSAN=ON -DWITH_COLUMNSTORE_REPORT_PATH=${REPORT_PATH}) MDB_CMAKE_FLAGS+=(-DWITH_UBSAN=ON -DWITH_COLUMNSTORE_REPORT_PATH=${REPORT_PATH})
fi fi
if [[ $MSAN = true ]]; then
warn "Building with Memory Sanitizer"
MDB_CMAKE_FLAGS+=(-DWITH_MSAN=ON -DWITH_COLUMNSTORE_REPORT_PATH=${REPORT_PATH})
fi
if [[ $WITHOUT_COREDUMPS = true ]]; then if [[ $WITHOUT_COREDUMPS = true ]]; then
warn "Cores are not dumped" warn "Cores are not dumped"
else else

View File

@@ -22,6 +22,10 @@ set(Boost_LIBRARY_DIRS "${INSTALL_LOCATION}/lib")
link_directories("${Boost_LIBRARY_DIRS}") link_directories("${Boost_LIBRARY_DIRS}")
set(_cxxargs "-fPIC -DBOOST_NO_AUTO_PTR -fvisibility=default") set(_cxxargs "-fPIC -DBOOST_NO_AUTO_PTR -fvisibility=default")
if(WITH_MSAN)
set(_cxxargs "${_cxxargs} -fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE -stdlib=libc++")
endif()
set(_b2args cxxflags=${_cxxargs};cflags=-fPIC;threading=multi;${_extra};toolset=${_toolset} set(_b2args cxxflags=${_cxxargs};cflags=-fPIC;threading=multi;${_extra};toolset=${_toolset}
--without-mpi;--without-charconv;--without-python;--prefix=${INSTALL_LOCATION} --without-mpi;--without-charconv;--without-python;--prefix=${INSTALL_LOCATION}
) )

View File

@@ -33,6 +33,11 @@ set(THRIFT_INCLUDE_DIRS "${INSTALL_LOCATION}/include")
set(THRIFT_LIBRARY_DIRS "${INSTALL_LOCATION}/lib") set(THRIFT_LIBRARY_DIRS "${INSTALL_LOCATION}/lib")
set(THRIFT_LIBRARY ${THRIFT_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}thrift${CMAKE_STATIC_LIBRARY_SUFFIX}) set(THRIFT_LIBRARY ${THRIFT_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}thrift${CMAKE_STATIC_LIBRARY_SUFFIX})
set(cxxflags -fPIC)
if(WITH_MSAN)
set(cxxflags "'${cxxflags} -fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE -stdlib=libc++'")
endif()
ExternalProject_Add( ExternalProject_Add(
external_thrift external_thrift
URL https://github.com/apache/thrift/archive/refs/tags/v0.22.0.tar.gz URL https://github.com/apache/thrift/archive/refs/tags/v0.22.0.tar.gz
@@ -49,10 +54,19 @@ ExternalProject_Add(
-DBUILD_PYTHON=NO -DBUILD_PYTHON=NO
-DBUILD_TESTING=NO -DBUILD_TESTING=NO
-DBUILD_SHARED_LIBS=NO -DBUILD_SHARED_LIBS=NO
-DCMAKE_CXX_FLAGS:STRING="-fPIC" -DBUILD_TUTORIALS=NO
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${cxxflags}
-DBOOST_ROOT=${BOOST_ROOT} -DBOOST_ROOT=${BOOST_ROOT}
BUILD_BYPRODUCTS "${THRIFT_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}thrift${CMAKE_STATIC_LIBRARY_SUFFIX}" BUILD_BYPRODUCTS "${THRIFT_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}thrift${CMAKE_STATIC_LIBRARY_SUFFIX}"
EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_ALL TRUE
) )
ExternalProject_Add_Step(
external_thrift print_cmake_flags
COMMAND ${CMAKE_COMMAND} -E echo "!!!!!!!! CXX_FLAGS: ${CMAKE_CXX_FLAGS}"
DEPENDEES configure
)
add_dependencies(external_thrift external_boost) add_dependencies(external_thrift external_boost)

View File

@@ -19,18 +19,18 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <stack> #include <stack>
#include <tr1/unordered_map>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
#include <tr1/unordered_set>
#include <utility> #include <utility>
#include <cassert> #include <cassert>
using namespace std; using namespace std;
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <unordered.h>
#include "dataconvert.h" #include "dataconvert.h"
using namespace dataconvert; using namespace dataconvert;

View File

@@ -35,8 +35,6 @@ typedef int32_t mcs_sint32_t;
struct charset_info_st; struct charset_info_st;
typedef const struct charset_info_st CHARSET_INFO; typedef const struct charset_info_st CHARSET_INFO;
using namespace std; // e.g. string
namespace ddlpackage namespace ddlpackage
{ {
struct ColumnType; struct ColumnType;
@@ -1019,8 +1017,8 @@ class TypeHandler
static const TypeHandler* find_by_ddltype(const ddlpackage::ColumnType& ct); static const TypeHandler* find_by_ddltype(const ddlpackage::ColumnType& ct);
virtual ~TypeHandler() = default; virtual ~TypeHandler() = default;
virtual const string& name() const = 0; virtual const std::string& name() const = 0;
virtual const string print(const SystemCatalog::TypeAttributesStd& /*attr*/) const virtual const std::string print(const SystemCatalog::TypeAttributesStd& /*attr*/) const
{ {
return name(); return name();
} }
@@ -1062,10 +1060,10 @@ class TypeHandler
virtual MinMaxPartitionInfo getExtentPartitionInfo(const SystemCatalog::TypeAttributesStd& attr, virtual MinMaxPartitionInfo getExtentPartitionInfo(const SystemCatalog::TypeAttributesStd& attr,
BRM::DBRM& em, const BRM::EMEntry& entry, BRM::DBRM& em, const BRM::EMEntry& entry,
int* state) const; int* state) const;
virtual string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, virtual std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const round_style_t rfMax) const
{ {
return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1086,7 +1084,7 @@ class TypeHandler
// QQ: perhaps not needed yet // QQ: perhaps not needed yet
class TypeHandlerBit : public TypeHandler class TypeHandlerBit : public TypeHandler
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::BIT; return SystemCatalog::BIT;
@@ -1155,7 +1153,7 @@ class TypeHandlerInt : public TypeHandler
class TypeHandlerSInt8 : public TypeHandlerInt class TypeHandlerSInt8 : public TypeHandlerInt
{ {
public: public:
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::TINYINT; return SystemCatalog::TINYINT;
@@ -1202,7 +1200,7 @@ class TypeHandlerSInt8 : public TypeHandlerInt
class TypeHandlerSInt16 : public TypeHandlerInt class TypeHandlerSInt16 : public TypeHandlerInt
{ {
public: public:
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::SMALLINT; return SystemCatalog::SMALLINT;
@@ -1248,7 +1246,7 @@ class TypeHandlerSInt16 : public TypeHandlerInt
class TypeHandlerSInt24 : public TypeHandlerInt class TypeHandlerSInt24 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::MEDINT; return SystemCatalog::MEDINT;
@@ -1297,7 +1295,7 @@ class TypeHandlerSInt24 : public TypeHandlerInt
class TypeHandlerSInt32 : public TypeHandlerInt class TypeHandlerSInt32 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::INT; return SystemCatalog::INT;
@@ -1346,7 +1344,7 @@ class TypeHandlerSInt32 : public TypeHandlerInt
class TypeHandlerSInt64 : public TypeHandlerInt class TypeHandlerSInt64 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::BIGINT; return SystemCatalog::BIGINT;
@@ -1392,7 +1390,7 @@ class TypeHandlerSInt64 : public TypeHandlerInt
class TypeHandlerUInt8 : public TypeHandlerInt class TypeHandlerUInt8 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::UTINYINT; return SystemCatalog::UTINYINT;
@@ -1435,10 +1433,10 @@ class TypeHandlerUInt8 : public TypeHandlerInt
{ {
return MinMaxInfo::widenUInt64(a, b); return MinMaxInfo::widenUInt64(a, b);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1457,7 +1455,7 @@ class TypeHandlerUInt8 : public TypeHandlerInt
class TypeHandlerUInt16 : public TypeHandlerInt class TypeHandlerUInt16 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::USMALLINT; return SystemCatalog::USMALLINT;
@@ -1499,10 +1497,10 @@ class TypeHandlerUInt16 : public TypeHandlerInt
{ {
return MinMaxInfo::widenUInt64(a, b); return MinMaxInfo::widenUInt64(a, b);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1521,7 +1519,7 @@ class TypeHandlerUInt16 : public TypeHandlerInt
class TypeHandlerUInt24 : public TypeHandlerInt class TypeHandlerUInt24 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::UMEDINT; return SystemCatalog::UMEDINT;
@@ -1566,10 +1564,10 @@ class TypeHandlerUInt24 : public TypeHandlerInt
{ {
return MinMaxInfo::widenUInt64(a, b); return MinMaxInfo::widenUInt64(a, b);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1588,7 +1586,7 @@ class TypeHandlerUInt24 : public TypeHandlerInt
class TypeHandlerUInt32 : public TypeHandlerInt class TypeHandlerUInt32 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::UINT; return SystemCatalog::UINT;
@@ -1633,10 +1631,10 @@ class TypeHandlerUInt32 : public TypeHandlerInt
{ {
return MinMaxInfo::widenUInt64(a, b); return MinMaxInfo::widenUInt64(a, b);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1655,7 +1653,7 @@ class TypeHandlerUInt32 : public TypeHandlerInt
class TypeHandlerUInt64 : public TypeHandlerInt class TypeHandlerUInt64 : public TypeHandlerInt
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::BIGINT; return SystemCatalog::BIGINT;
@@ -1697,10 +1695,10 @@ class TypeHandlerUInt64 : public TypeHandlerInt
{ {
return MinMaxInfo::widenUInt64(a, b); return MinMaxInfo::widenUInt64(a, b);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1739,9 +1737,10 @@ class TypeHandlerXDecimal : public TypeHandler
const BRM::EMEntry& entry, int* state) const; const BRM::EMEntry& entry, int* state) const;
MinMaxPartitionInfo getExtentPartitionInfo128(const SystemCatalog::TypeAttributesStd& attr, BRM::DBRM& em, MinMaxPartitionInfo getExtentPartitionInfo128(const SystemCatalog::TypeAttributesStd& attr, BRM::DBRM& em,
const BRM::EMEntry& entry, int* state) const; const BRM::EMEntry& entry, int* state) const;
string PrintPartitionValue128(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue128(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMax) const; round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const;
public: public:
size_t ColWriteBatch(WriteBatchField* field, const unsigned char* buf, bool nullVal, size_t ColWriteBatch(WriteBatchField* field, const unsigned char* buf, bool nullVal,
@@ -1760,7 +1759,7 @@ class TypeHandlerXDecimal : public TypeHandler
class TypeHandlerSDecimal64 : public TypeHandlerXDecimal class TypeHandlerSDecimal64 : public TypeHandlerXDecimal
{ {
public: public:
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::DECIMAL; return SystemCatalog::DECIMAL;
@@ -1804,10 +1803,10 @@ class TypeHandlerSDecimal64 : public TypeHandlerXDecimal
{ {
return getExtentPartitionInfo64(attr, em, entry, state); return getExtentPartitionInfo64(attr, em, entry, state);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1826,7 +1825,7 @@ class TypeHandlerSDecimal64 : public TypeHandlerXDecimal
class TypeHandlerUDecimal64 : public TypeHandlerXDecimal class TypeHandlerUDecimal64 : public TypeHandlerXDecimal
{ {
public: public:
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::UDECIMAL; return SystemCatalog::UDECIMAL;
@@ -1870,10 +1869,10 @@ class TypeHandlerUDecimal64 : public TypeHandlerXDecimal
{ {
return getExtentPartitionInfo64(attr, em, entry, state); return getExtentPartitionInfo64(attr, em, entry, state);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1892,7 +1891,7 @@ class TypeHandlerUDecimal64 : public TypeHandlerXDecimal
class TypeHandlerSDecimal128 : public TypeHandlerXDecimal class TypeHandlerSDecimal128 : public TypeHandlerXDecimal
{ {
public: public:
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::DECIMAL; return SystemCatalog::DECIMAL;
@@ -1936,10 +1935,10 @@ class TypeHandlerSDecimal128 : public TypeHandlerXDecimal
{ {
return getExtentPartitionInfo128(attr, em, entry, state); return getExtentPartitionInfo128(attr, em, entry, state);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValue128(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValue128(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -1958,7 +1957,7 @@ class TypeHandlerSDecimal128 : public TypeHandlerXDecimal
class TypeHandlerUDecimal128 : public TypeHandlerXDecimal class TypeHandlerUDecimal128 : public TypeHandlerXDecimal
{ {
public: public:
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::UDECIMAL; return SystemCatalog::UDECIMAL;
@@ -2002,10 +2001,10 @@ class TypeHandlerUDecimal128 : public TypeHandlerXDecimal
{ {
return getExtentPartitionInfo128(attr, em, entry, state); return getExtentPartitionInfo128(attr, em, entry, state);
} }
string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr,
const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal,
round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMin, const SimpleValue& endVal,
round_style_t rfMax) const override round_style_t rfMax) const override
{ {
return PrintPartitionValue128(attr, partInfo, startVal, rfMin, endVal, rfMax); return PrintPartitionValue128(attr, partInfo, startVal, rfMin, endVal, rfMax);
} }
@@ -2043,7 +2042,7 @@ class TypeHandlerReal : public TypeHandler
class TypeHandlerSFloat : public TypeHandlerReal class TypeHandlerSFloat : public TypeHandlerReal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::FLOAT; return SystemCatalog::FLOAT;
@@ -2071,7 +2070,7 @@ class TypeHandlerSFloat : public TypeHandlerReal
class TypeHandlerSDouble : public TypeHandlerReal class TypeHandlerSDouble : public TypeHandlerReal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::DOUBLE; return SystemCatalog::DOUBLE;
@@ -2099,7 +2098,7 @@ class TypeHandlerSDouble : public TypeHandlerReal
class TypeHandlerUFloat : public TypeHandlerReal class TypeHandlerUFloat : public TypeHandlerReal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::UFLOAT; return SystemCatalog::UFLOAT;
@@ -2127,7 +2126,7 @@ class TypeHandlerUFloat : public TypeHandlerReal
class TypeHandlerUDouble : public TypeHandlerReal class TypeHandlerUDouble : public TypeHandlerReal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::UDOUBLE; return SystemCatalog::UDOUBLE;
@@ -2155,7 +2154,7 @@ class TypeHandlerUDouble : public TypeHandlerReal
class TypeHandlerSLongDouble : public TypeHandlerReal class TypeHandlerSLongDouble : public TypeHandlerReal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::LONGDOUBLE; return SystemCatalog::LONGDOUBLE;
@@ -2219,14 +2218,14 @@ class TypeHandlerStr : public TypeHandler
class TypeHandlerChar : public TypeHandlerStr class TypeHandlerChar : public TypeHandlerStr
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::CHAR; return SystemCatalog::CHAR;
} }
const string print(const SystemCatalog::TypeAttributesStd& attr) const override const std::string print(const SystemCatalog::TypeAttributesStd& attr) const override
{ {
ostringstream oss; std::ostringstream oss;
oss << name() << "(" << attr.colWidth << ")"; oss << name() << "(" << attr.colWidth << ")";
return oss.str(); return oss.str();
} }
@@ -2256,14 +2255,14 @@ class TypeHandlerChar : public TypeHandlerStr
class TypeHandlerVarchar : public TypeHandlerStr class TypeHandlerVarchar : public TypeHandlerStr
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::VARCHAR; return SystemCatalog::VARCHAR;
} }
const string print(const SystemCatalog::TypeAttributesStd& attr) const override const std::string print(const SystemCatalog::TypeAttributesStd& attr) const override
{ {
ostringstream oss; std::ostringstream oss;
oss << name() << "(" << attr.colWidth << ")"; oss << name() << "(" << attr.colWidth << ")";
return oss.str(); return oss.str();
} }
@@ -2297,7 +2296,7 @@ class TypeHandlerVarchar : public TypeHandlerStr
class TypeHandlerVarbinary : public TypeHandlerStr class TypeHandlerVarbinary : public TypeHandlerStr
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::VARBINARY; return SystemCatalog::VARBINARY;
@@ -2317,7 +2316,7 @@ class TypeHandlerVarbinary : public TypeHandlerStr
class TypeHandlerBlob : public TypeHandlerStr class TypeHandlerBlob : public TypeHandlerStr
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::BLOB; return SystemCatalog::BLOB;
@@ -2344,7 +2343,7 @@ class TypeHandlerBlob : public TypeHandlerStr
class TypeHandlerText : public TypeHandlerStr class TypeHandlerText : public TypeHandlerStr
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::TEXT; return SystemCatalog::TEXT;
@@ -2374,7 +2373,7 @@ class TypeHandlerText : public TypeHandlerStr
class TypeHandlerClob : public TypeHandlerStr class TypeHandlerClob : public TypeHandlerStr
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::CLOB; return SystemCatalog::CLOB;
@@ -2423,7 +2422,7 @@ class TypeHandlerTemporal : public TypeHandler
class TypeHandlerDate : public TypeHandlerTemporal class TypeHandlerDate : public TypeHandlerTemporal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::DATE; return SystemCatalog::DATE;
@@ -2449,7 +2448,7 @@ class TypeHandlerDate : public TypeHandlerTemporal
class TypeHandlerDatetime : public TypeHandlerTemporal class TypeHandlerDatetime : public TypeHandlerTemporal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::DATETIME; return SystemCatalog::DATETIME;
@@ -2475,7 +2474,7 @@ class TypeHandlerDatetime : public TypeHandlerTemporal
class TypeHandlerTime : public TypeHandlerTemporal class TypeHandlerTime : public TypeHandlerTemporal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::TIME; return SystemCatalog::TIME;
@@ -2501,7 +2500,7 @@ class TypeHandlerTime : public TypeHandlerTemporal
class TypeHandlerTimestamp : public TypeHandlerTemporal class TypeHandlerTimestamp : public TypeHandlerTemporal
{ {
const string& name() const override; const std::string& name() const override;
code_t code() const override code_t code() const override
{ {
return SystemCatalog::TIMESTAMP; return SystemCatalog::TIMESTAMP;

20
datatypes/unordered.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#if (_LIBCPP_VERSION)
#include <unordered_set>
#include <unordered_map>
namespace std
{
namespace tr1
{
using std::hash;
using std::swap;
using std::unordered_map;
using std::unordered_multimap;
using std::unordered_set;
} // namespace tr1
} // namespace std
#else
#include <tr1/unordered_set>
#include <tr1/unordered_map>
#endif

View File

@@ -801,7 +801,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
* Return a string rep of the CSEP * Return a string rep of the CSEP
* @return a string * @return a string
*/ */
void printSubCSEP(const size_t& ident, ostringstream& output, CalpontSelectExecutionPlan*& plan) const; void printSubCSEP(const size_t& ident, std::ostringstream& output, CalpontSelectExecutionPlan*& plan) const;
virtual std::string toString(const size_t ident = 0) const; virtual std::string toString(const size_t ident = 0) const;
/** @brief Is this an internal query? /** @brief Is this an internal query?
@@ -968,7 +968,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
uint32_t fDJSMaxPartitionTreeDepth = 8; uint32_t fDJSMaxPartitionTreeDepth = 8;
bool fDJSForceRun = false; bool fDJSForceRun = false;
uint32_t fMaxPmJoinResultCount = 1048576; uint32_t fMaxPmJoinResultCount = 1048576;
int64_t fUMMemLimit = numeric_limits<int64_t>::max(); int64_t fUMMemLimit = std::numeric_limits<int64_t>::max();
bool fIsDML = false; bool fIsDML = false;
long fTimeZone = 0; long fTimeZone = 0;
std::vector<execplan::ParseTree*> fDynamicParseTreeVec; std::vector<execplan::ParseTree*> fDynamicParseTreeVec;

View File

@@ -135,7 +135,7 @@ class GroupConcatColumn : public AggregateColumn
using AggregateColumn::operator!=; using AggregateColumn::operator!=;
virtual bool operator!=(const GroupConcatColumn& t) const; virtual bool operator!=(const GroupConcatColumn& t) const;
string toCppCode(IncludeSet& includes) const override; std::string toCppCode(IncludeSet& includes) const override;
private: private:
std::vector<SRCP> fOrderCols; std::vector<SRCP> fOrderCols;

View File

@@ -698,7 +698,7 @@ inline void ParseTree::drawTree(std::string filename)
dotFile.close(); dotFile.close();
} }
inline string ParseTree::toCppCode(IncludeSet& includes) const inline std::string ParseTree::toCppCode(IncludeSet& includes) const
{ {
includes.insert("parsetree.h"); includes.insert("parsetree.h");
std::stringstream ss; std::stringstream ss;
@@ -711,7 +711,7 @@ inline string ParseTree::toCppCode(IncludeSet& includes) const
inline void ParseTree::codeToFile(std::string filename, std::string varname) const inline void ParseTree::codeToFile(std::string filename, std::string varname) const
{ {
ofstream hFile(filename.c_str(), std::ios::app); std::ofstream hFile(filename.c_str(), std::ios::app);
IncludeSet includes; IncludeSet includes;
auto result = toCppCode(includes); auto result = toCppCode(includes);
for (const auto& inc : includes) for (const auto& inc : includes)

View File

@@ -222,7 +222,7 @@ class SimpleFilter : public Filter
static std::string escapeString(const std::string& input); static std::string escapeString(const std::string& input);
string toCppCode(IncludeSet& includes) const override; std::string toCppCode(IncludeSet& includes) const override;
private: private:
SOP fOp; /// operator SOP fOp; /// operator

View File

@@ -154,7 +154,7 @@ class SimpleScalarFilter : public Filter
*/ */
bool operator!=(const SimpleScalarFilter& t) const; bool operator!=(const SimpleScalarFilter& t) const;
string toCppCode(IncludeSet& includes) const override; std::string toCppCode(IncludeSet& includes) const override;
private: private:
// default okay? // default okay?

View File

@@ -754,7 +754,7 @@ inline uint64_t TreeNode::getUintVal()
literal::Converter<literal::UnsignedInteger> cnv(fResult.strVal.safeString(""), cnverr); literal::Converter<literal::UnsignedInteger> cnv(fResult.strVal.safeString(""), cnverr);
if (datatypes::DataCondition::Code(cnverr) != 0) if (datatypes::DataCondition::Code(cnverr) != 0)
{ {
cerr << "error in unsigned int conversion from '" << fResult.strVal.safeString() << "'"; std::cerr << "error in unsigned int conversion from '" << fResult.strVal.safeString() << "'";
} }
return cnv.toXIntPositive<uint64_t>(cnverr); return cnv.toXIntPositive<uint64_t>(cnverr);
} }

View File

@@ -49,7 +49,7 @@ class DiskJoinStep : public JobStep
private: private:
void initializeFIFO(uint32_t threadCount); void initializeFIFO(uint32_t threadCount);
void processJoinPartitions(const uint32_t threadID, const uint32_t smallSideSizeLimitPerThread, void processJoinPartitions(const uint32_t threadID, const uint32_t smallSideSizeLimitPerThread,
const vector<joiner::JoinPartition*>& joinPartitions); const std::vector<joiner::JoinPartition*>& joinPartitions);
void prepareJobs(const std::vector<joiner::JoinPartition*>& joinPartitions, void prepareJobs(const std::vector<joiner::JoinPartition*>& joinPartitions,
JoinPartitionJobs& joinPartitionsJobs); JoinPartitionJobs& joinPartitionsJobs);
void outputResult(const std::vector<rowgroup::RGData>& result); void outputResult(const std::vector<rowgroup::RGData>& result);

View File

@@ -124,7 +124,7 @@ class GroupConcator
virtual void merge(GroupConcator*) = 0; virtual void merge(GroupConcator*) = 0;
virtual uint8_t* getResultImpl(const std::string& sep) = 0; virtual uint8_t* getResultImpl(const std::string& sep) = 0;
virtual uint8_t* getResult(const std::string& sep); virtual uint8_t* getResult(const std::string& sep);
uint8_t* swapStreamWithStringAndReturnBuf(ostringstream& oss, bool isNull); uint8_t* swapStreamWithStringAndReturnBuf(std::ostringstream& oss, bool isNull);
virtual const std::string toString() const; virtual const std::string toString() const;
@@ -178,7 +178,10 @@ class GroupConcatNoOrder : public GroupConcator
const std::string toString() const override; const std::string toString() const override;
protected: protected:
std::vector<rowgroup::RGDataUnPtr>& getRGDatas() { return fDataVec; } std::vector<rowgroup::RGDataUnPtr>& getRGDatas()
{
return fDataVec;
}
void createNewRGData(); void createNewRGData();
rowgroup::RowGroup fRowGroup; rowgroup::RowGroup fRowGroup;
@@ -247,8 +250,14 @@ class GroupConcatOrderBy : public GroupConcator, public ordering::IdbCompare
void createNewRGData(); void createNewRGData();
uint64_t getCurrentRowIdx() const; uint64_t getCurrentRowIdx() const;
static uint64_t shiftGroupIdxBy(uint64_t idx, uint32_t shift); static uint64_t shiftGroupIdxBy(uint64_t idx, uint32_t shift);
std::vector<rowgroup::RGDataUnPtr>& getRGDatas() { return fDataVec; } std::vector<rowgroup::RGDataUnPtr>& getRGDatas()
SortingPQ* getQueue() { return fOrderByQueue.get(); } {
return fDataVec;
}
SortingPQ* getQueue()
{
return fOrderByQueue.get();
}
rowgroup::RGDataSizeType fMemSize{0}; rowgroup::RGDataSizeType fMemSize{0};
static constexpr uint64_t fRowsPerRG{128}; static constexpr uint64_t fRowsPerRG{128};

View File

@@ -32,7 +32,7 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <list> #include <list>
#include <tr1/unordered_map> #include <unordered.h>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
@@ -55,10 +55,10 @@ extern void timespec_sub(const struct timespec& tv1, const struct timespec& tv2,
namespace joblist namespace joblist
{ {
const string createHashStr("create hash"); const std::string createHashStr("create hash");
const string hashJoinStr("hash join"); const std::string hashJoinStr("hash join");
const string insertResultsStr("insert results"); const std::string insertResultsStr("insert results");
const string insertLastResultsStr("insert last results"); const std::string insertLastResultsStr("insert last results");
template <typename element_t> template <typename element_t>
void* HashJoinByBucket_thr(void* arg); void* HashJoinByBucket_thr(void* arg);

View File

@@ -31,7 +31,7 @@
#include "bytestream.h" #include "bytestream.h"
#include <iostream> #include <iostream>
#include "brm.h" #include "brm.h"
#include <tr1/unordered_map> #include <unordered.h>
namespace joblist namespace joblist
{ {

View File

@@ -33,7 +33,7 @@
#include <map> #include <map>
#include <stdexcept> #include <stdexcept>
#include <sstream> #include <sstream>
#include <tr1/memory> #include <memory>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
@@ -888,9 +888,9 @@ class BatchPrimitive : public JobStep, public DECEventListener
struct _CPInfo struct _CPInfo
{ {
_CPInfo(int64_t MIN, int64_t MAX, uint64_t l, bool dictScan, bool val) _CPInfo(int64_t MIN, int64_t MAX, uint64_t l, bool dictScan, bool val)
: min(MIN), max(MAX), LBID(l), valid(val), dictScan(dictScan){}; : min(MIN), max(MAX), LBID(l), valid(val), dictScan(dictScan) {};
_CPInfo(int128_t BIGMIN, int128_t BIGMAX, uint64_t l, bool val) _CPInfo(int128_t BIGMIN, int128_t BIGMAX, uint64_t l, bool val)
: bigMin(BIGMIN), bigMax(BIGMAX), LBID(l), valid(val), dictScan(false){}; : bigMin(BIGMIN), bigMax(BIGMAX), LBID(l), valid(val), dictScan(false) {};
union union
{ {
int128_t bigMin; int128_t bigMin;
@@ -946,9 +946,9 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep
void receiveMultiPrimitiveMessages(); void receiveMultiPrimitiveMessages();
// Processes the vector of `bytestream` starting from `begin` index to the `end` index, non inclusive. // Processes the vector of `bytestream` starting from `begin` index to the `end` index, non inclusive.
void processByteStreamVector(vector<boost::shared_ptr<messageqcpp::ByteStream>>& bsv, const uint32_t begin, void processByteStreamVector(std::vector<boost::shared_ptr<messageqcpp::ByteStream>>& bsv,
const uint32_t end, vector<_CPInfo>& cpv, RowGroupDL* dlp, const uint32_t begin, const uint32_t end, std::vector<_CPInfo>& cpv,
const uint32_t threadID); RowGroupDL* dlp, const uint32_t threadID);
/** @brief Add a filter when the column is anything but a 4-byte float type. /** @brief Add a filter when the column is anything but a 4-byte float type.
* *
@@ -1207,9 +1207,9 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep
void startPrimitiveThread(); void startPrimitiveThread();
void startAggregationThread(); void startAggregationThread();
// Processes the vector of `bytestream` starting from `begin` index to the `end` index, non inclusive. // Processes the vector of `bytestream` starting from `begin` index to the `end` index, non inclusive.
void startProcessingThread(TupleBPS* tbps, vector<boost::shared_ptr<messageqcpp::ByteStream>>& bsv, void startProcessingThread(TupleBPS* tbps, std::vector<boost::shared_ptr<messageqcpp::ByteStream>>& bsv,
const uint32_t begin, const uint32_t end, vector<_CPInfo>& cpv, RowGroupDL* dlp, const uint32_t begin, const uint32_t end, std::vector<_CPInfo>& cpv,
const uint32_t threadID); RowGroupDL* dlp, const uint32_t threadID);
void initializeConfigParms(); void initializeConfigParms();
uint64_t getFBO(uint64_t lbid); uint64_t getFBO(uint64_t lbid);
void checkDupOutputColumns(const rowgroup::RowGroup& rg); void checkDupOutputColumns(const rowgroup::RowGroup& rg);
@@ -1362,7 +1362,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep
private: private:
uint64_t generateJoinResultSet(const uint32_t depth, std::vector<rowgroup::RGData>& outputData, uint64_t generateJoinResultSet(const uint32_t depth, std::vector<rowgroup::RGData>& outputData,
RowGroupDL* dlp); RowGroupDL* dlp);
void processFE2(vector<rowgroup::RGData>& rgData); void processFE2(std::vector<rowgroup::RGData>& rgData);
TupleBPS* tbps; // Parent TupleBPS* tbps; // Parent
rowgroup::RowGroup local_primRG; rowgroup::RowGroup local_primRG;
@@ -1384,7 +1384,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep
bool doJoin; bool doJoin;
// Join vars. // Join vars.
vector<vector<rowgroup::Row::Pointer>> joinerOutput; std::vector<std::vector<rowgroup::Row::Pointer>> joinerOutput;
rowgroup::Row largeSideRow; rowgroup::Row largeSideRow;
rowgroup::Row joinedBaseRow; rowgroup::Row joinedBaseRow;
rowgroup::Row largeNull; rowgroup::Row largeNull;
@@ -1394,8 +1394,8 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep
boost::scoped_array<uint8_t> joinedBaseRowData; boost::scoped_array<uint8_t> joinedBaseRowData;
boost::scoped_array<uint8_t> joinFERowData; boost::scoped_array<uint8_t> joinFERowData;
std::shared_ptr<int[]> largeMapping; std::shared_ptr<int[]> largeMapping;
vector<std::shared_ptr<int[]>> smallMappings; std::vector<std::shared_ptr<int[]>> smallMappings;
vector<std::shared_ptr<int[]>> fergMappings; std::vector<std::shared_ptr<int[]>> fergMappings;
rowgroup::RGData joinedData; rowgroup::RGData joinedData;
boost::scoped_array<uint8_t> largeNullMemory; boost::scoped_array<uint8_t> largeNullMemory;
boost::scoped_array<std::shared_ptr<uint8_t[]>> smallNullMemory; boost::scoped_array<std::shared_ptr<uint8_t[]>> smallNullMemory;

View File

@@ -28,7 +28,7 @@
// //
#include "jobstep.h" #include "jobstep.h"
#include <tr1/unordered_set> #include <unordered.h>
#include "stlpoolallocator.h" #include "stlpoolallocator.h"
#include "threadnaming.h" #include "threadnaming.h"
@@ -116,7 +116,7 @@ class TupleUnion : public JobStep, public TupleDeliveryStep
uint64_t group : 48; uint64_t group : 48;
uint64_t row : 16; uint64_t row : 16;
inline explicit RowPosition(uint64_t i = 0, uint64_t j = 0) : group(i), row(j){}; inline explicit RowPosition(uint64_t i = 0, uint64_t j = 0) : group(i), row(j) {};
static const uint64_t normalizedFlag = 0x800000000000ULL; // 48th bit is set static const uint64_t normalizedFlag = 0x800000000000ULL; // 48th bit is set
}; };

View File

@@ -24,12 +24,11 @@
/** @file */ /** @file */
/** class FromSubSelect definition */ /** class FromSubSelect definition */
//#define NDEBUG // #define NDEBUG
#define PREFER_MY_CONFIG_H #define PREFER_MY_CONFIG_H
#include <my_config.h> #include <my_config.h>
#include <cassert> #include <cassert>
#include <map> #include <map>
using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"
@@ -39,7 +38,7 @@ using namespace std;
#include "constantcolumn.h" #include "constantcolumn.h"
#include "simplecolumn.h" #include "simplecolumn.h"
using namespace execplan; using namespace execplan;
using namespace std;
#include "ha_subquery.h" #include "ha_subquery.h"
namespace cal_impl_if namespace cal_impl_if

View File

@@ -27,10 +27,9 @@
#define PREFER_MY_CONFIG_H #define PREFER_MY_CONFIG_H
#include <my_config.h> #include <my_config.h>
#include <stdint.h> #include <stdint.h>
//#define NDEBUG // #define NDEBUG
#include <cassert> #include <cassert>
#include <vector> #include <vector>
using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"
@@ -50,6 +49,8 @@ using namespace logging;
#include "ha_subquery.h" #include "ha_subquery.h"
using namespace std;
namespace cal_impl_if namespace cal_impl_if
{ {
extern void parse_item(Item* item, vector<Item_field*>& field_vec, bool& hasNonSupportItem, extern void parse_item(Item* item, vector<Item_field*>& field_vec, bool& hasNonSupportItem,

View File

@@ -585,7 +585,7 @@ extern "C"
stmt->serialize(bytestream); stmt->serialize(bytestream);
ByteStream::byte b = 0; ByteStream::byte b = 0;
THD* thd = current_thd; THD* thd = current_thd;
string emsg; std::string emsg;
mq.write(bytestream); mq.write(bytestream);
try try
@@ -606,7 +606,7 @@ extern "C"
bytestream >> emsg; bytestream >> emsg;
} }
} }
catch (runtime_error&) catch (std::runtime_error&)
{ {
thd->get_stmt_da()->set_overwrite_status(true); thd->get_stmt_da()->set_overwrite_status(true);
thd->raise_error_printf(ER_INTERNAL_ERROR, "Lost connection to DDLProc"); thd->raise_error_printf(ER_INTERNAL_ERROR, "Lost connection to DDLProc");

View File

@@ -25,16 +25,14 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <stack> #include <stack>
#include <tr1/unordered_map>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
#include <regex> #include <regex>
#include <tr1/unordered_set> #include <unordered.h>
#include <utility> #include <utility>
#include <cassert> #include <cassert>
using namespace std;
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
@@ -81,6 +79,7 @@ using namespace execplan;
#include "resourcemanager.h" #include "resourcemanager.h"
using namespace joblist; using namespace joblist;
using namespace std;
namespace namespace
{ {
@@ -761,7 +760,7 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta
#ifdef MCS_DEBUG #ifdef MCS_DEBUG
cout << "ProcessDDLStatement: " << schema << "." << table << ":" << ddlStatement << endl; cout << "ProcessDDLStatement: " << schema << "." << table << ":" << ddlStatement << endl;
#endif #endif
parser.setDefaultSchema(schema); parser.setDefaultSchema(schema);
parser.setDefaultCharset(default_table_charset); parser.setDefaultCharset(default_table_charset);
int rc = 0; int rc = 0;
@@ -2203,34 +2202,46 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta
if (ddlStatement.find("AUTO_INCREMENT") != string::npos) if (ddlStatement.find("AUTO_INCREMENT") != string::npos)
{ {
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "The syntax auto_increment is not supported in Columnstore. Please check the Columnstore syntax guide for supported syntax or data types."); thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED,
"The syntax auto_increment is not supported in Columnstore. Please check the "
"Columnstore syntax guide for supported syntax or data types.");
} }
else if(ddlStatement.find("RENAME COLUMN") != string::npos) else if (ddlStatement.find("RENAME COLUMN") != string::npos)
{ {
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "The syntax rename column is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types."); thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED,
"The syntax rename column is not supported by Columnstore. Please check the "
"Columnstore syntax guide for supported syntax or data types.");
} }
else if(ddlStatement.find("MAX_ROWS") != string::npos || ddlStatement.find("MIN_ROWS") != string::npos) else if (ddlStatement.find("MAX_ROWS") != string::npos || ddlStatement.find("MIN_ROWS") != string::npos)
{ {
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "The syntax min_rows/max_rows is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types."); thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED,
"The syntax min_rows/max_rows is not supported by Columnstore. Please check "
"the Columnstore syntax guide for supported syntax or data types.");
} }
else if(ddlStatement.find("REPLACE TABLE") != string::npos) else if (ddlStatement.find("REPLACE TABLE") != string::npos)
{ {
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "The syntax replace table is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types."); thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED,
"The syntax replace table is not supported by Columnstore. Please check the "
"Columnstore syntax guide for supported syntax or data types.");
} }
else if(ddlStatement.find("DROP COLUMN IF EXISTS") != string::npos) else if (ddlStatement.find("DROP COLUMN IF EXISTS") != string::npos)
{ {
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "The syntax drop column if exists is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types."); thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED,
"The syntax drop column if exists is not supported by Columnstore. Please "
"check the Columnstore syntax guide for supported syntax or data types.");
} }
else else
{ {
//@Bug 1888,1885. update error message //@Bug 1888,1885. update error message
thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED, "The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types."); thd->raise_error_printf(ER_CHECK_NOT_IMPLEMENTED,
"The syntax or the data type(s) is not supported by Columnstore. Please check "
"the Columnstore syntax guide for supported syntax or data types.");
} }
ci->alterTableState = cal_connection_info::NOT_ALTER; ci->alterTableState = cal_connection_info::NOT_ALTER;
ci->isAlter = false; ci->isAlter = false;
} }
return rc; return rc;
} }

View File

@@ -25,13 +25,11 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <stack> #include <stack>
#include <tr1/unordered_map> #include <unordered.h>
#include <tr1/unordered_set>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
using namespace std;
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
using namespace boost; using namespace boost;
@@ -75,6 +73,8 @@ using namespace joblist;
#include "nullstring.h" #include "nullstring.h"
using namespace std;
namespace namespace
{ {
#define BATCH_INSERT_GROUP_ROWS_FOR_CACHE 100000 #define BATCH_INSERT_GROUP_ROWS_FOR_CACHE 100000

View File

@@ -21,8 +21,7 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <stack> #include <stack>
#include <tr1/unordered_map> #include <unordered.h>
#include <tr1/unordered_set>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <cerrno> #include <cerrno>
@@ -36,8 +35,6 @@
#include <string.h> #include <string.h>
using namespace std;
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
@@ -99,6 +96,8 @@ using namespace funcexp;
#include "ha_view.h" #include "ha_view.h"
using namespace std;
namespace cal_impl_if namespace cal_impl_if
{ {
// This is taken from Item_cond::fix_fields in sql/item_cmpfunc.cc. // This is taken from Item_cond::fix_fields in sql/item_cmpfunc.cc.

View File

@@ -26,6 +26,8 @@
#include "rowcolumn.h" #include "rowcolumn.h"
#include "simplefilter.h" #include "simplefilter.h"
using namespace std;
namespace cal_impl_if namespace cal_impl_if
{ {
// In certain cases, gp_walk is called recursively. When done so, // In certain cases, gp_walk is called recursively. When done so,
@@ -121,15 +123,15 @@ void gp_walk(const Item* item, void* arg)
if (!scp) if (!scp)
break; break;
string aliasTableName(scp->tableAlias()); std::string aliasTableName(scp->tableAlias());
scp->tableAlias(aliasTableName); scp->tableAlias(aliasTableName);
gwip->rcWorkStack.push(scp->clone()); gwip->rcWorkStack.push(scp->clone());
boost::shared_ptr<execplan::SimpleColumn> scsp(scp); boost::shared_ptr<execplan::SimpleColumn> scsp(scp);
gwip->scsp = scsp; gwip->scsp = scsp;
gwip->funcName.clear(); gwip->funcName.clear();
gwip->columnMap.insert( gwip->columnMap.insert(execplan::CalpontSelectExecutionPlan::ColumnMap::value_type(
execplan::CalpontSelectExecutionPlan::ColumnMap::value_type(string(ifp->field_name.str), scsp)); std::string(ifp->field_name.str), scsp));
//@bug4636 take where clause column as dummy projection column, but only on local column. //@bug4636 take where clause column as dummy projection column, but only on local column.
// varbinary aggregate is not supported yet, so rule it out // varbinary aggregate is not supported yet, so rule it out
@@ -138,7 +140,7 @@ void gp_walk(const Item* item, void* arg)
{ {
TABLE_LIST* tmp = (ifp->cached_table ? ifp->cached_table : 0); TABLE_LIST* tmp = (ifp->cached_table ? ifp->cached_table : 0);
gwip->tableMap[execplan::make_aliastable(scp->schemaName(), scp->tableName(), scp->tableAlias(), gwip->tableMap[execplan::make_aliastable(scp->schemaName(), scp->tableName(), scp->tableAlias(),
scp->isColumnStore())] = make_pair(1, tmp); scp->isColumnStore())] = std::make_pair(1, tmp);
} }
} }
@@ -162,7 +164,8 @@ void gp_walk(const Item* item, void* arg)
if (item->type_handler() == &type_handler_hex_hybrid) if (item->type_handler() == &type_handler_hex_hybrid)
{ {
Item_hex_hybrid* hip = static_cast<Item_hex_hybrid*>(const_cast<Item*>(item)); Item_hex_hybrid* hip = static_cast<Item_hex_hybrid*>(const_cast<Item*>(item));
gwip->rcWorkStack.push(new execplan::ConstantColumn((int64_t)hip->val_int(), execplan::ConstantColumn::NUM)); gwip->rcWorkStack.push(
new execplan::ConstantColumn((int64_t)hip->val_int(), execplan::ConstantColumn::NUM));
execplan::ConstantColumn* cc = dynamic_cast<execplan::ConstantColumn*>(gwip->rcWorkStack.top()); execplan::ConstantColumn* cc = dynamic_cast<execplan::ConstantColumn*>(gwip->rcWorkStack.top());
cc->timeZone(gwip->timeZone); cc->timeZone(gwip->timeZone);
break; break;
@@ -175,7 +178,7 @@ void gp_walk(const Item* item, void* arg)
String val, *str = isp->val_str(&val); String val, *str = isp->val_str(&val);
if (str) if (str)
{ {
string cval; std::string cval;
if (str->ptr()) if (str->ptr())
{ {
@@ -218,7 +221,7 @@ void gp_walk(const Item* item, void* arg)
break; break;
} }
ostringstream oss; std::ostringstream oss;
oss << "Unhandled Item type(): " << item->type(); oss << "Unhandled Item type(): " << item->type();
gwip->parseErrorText = oss.str(); gwip->parseErrorText = oss.str();
gwip->fatalParseError = true; gwip->fatalParseError = true;
@@ -248,7 +251,7 @@ void gp_walk(const Item* item, void* arg)
Item* ncitem = const_cast<Item*>(item); Item* ncitem = const_cast<Item*>(item);
Item_func* ifp = static_cast<Item_func*>(ncitem); Item_func* ifp = static_cast<Item_func*>(ncitem);
string funcName = ifp->func_name(); std::string funcName = ifp->func_name();
if (!gwip->condPush) if (!gwip->condPush)
{ {
@@ -323,14 +326,14 @@ void gp_walk(const Item* item, void* arg)
} }
// try to evaluate const F&E // try to evaluate const F&E
vector<Item_field*> tmpVec; std::vector<Item_field*> tmpVec;
uint16_t parseInfo = 0; uint16_t parseInfo = 0;
parse_item(ifp, tmpVec, gwip->fatalParseError, parseInfo, gwip); parse_item(ifp, tmpVec, gwip->fatalParseError, parseInfo, gwip);
// table mode takes only one table filter // table mode takes only one table filter
if (gwip->condPush) if (gwip->condPush)
{ {
set<string> tableSet; std::set<std::string> tableSet;
for (uint32_t i = 0; i < tmpVec.size(); i++) for (uint32_t i = 0; i < tmpVec.size(); i++)
{ {
@@ -389,7 +392,8 @@ void gp_walk(const Item* item, void* arg)
{ {
logging::Message::Args args; logging::Message::Args args;
args.add(funcName); args.add(funcName);
gwip->parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_NON_SUPPORTED_FUNCTION, args); gwip->parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_NON_SUPPORTED_FUNCTION, args);
} }
return; return;
@@ -463,14 +467,15 @@ void gp_walk(const Item* item, void* arg)
//@bug3495, @bug5865 error out non-supported OR with correlated subquery //@bug3495, @bug5865 error out non-supported OR with correlated subquery
if (isOr) if (isOr)
{ {
vector<Item_field*> fieldVec; std::vector<Item_field*> fieldVec;
uint16_t parseInfo = 0; uint16_t parseInfo = 0;
parse_item(it, fieldVec, gwip->fatalParseError, parseInfo, gwip); parse_item(it, fieldVec, gwip->fatalParseError, parseInfo, gwip);
if (parseInfo & CORRELATED) if (parseInfo & CORRELATED)
{ {
gwip->fatalParseError = true; gwip->fatalParseError = true;
gwip->parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_CORRELATED_SUB_OR); gwip->parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_CORRELATED_SUB_OR);
return; return;
} }
} }
@@ -664,7 +669,8 @@ void gp_walk(const Item* item, void* arg)
else if (col->type() == Item::FIELD_ITEM && gwip->clauseType == HAVING) else if (col->type() == Item::FIELD_ITEM && gwip->clauseType == HAVING)
{ {
// ReturnedColumn* rc = buildAggFrmTempField(const_cast<Item*>(item), *gwip); // ReturnedColumn* rc = buildAggFrmTempField(const_cast<Item*>(item), *gwip);
execplan::ReturnedColumn* rc = buildReturnedColumn(const_cast<Item*>(item), *gwip, gwip->fatalParseError); execplan::ReturnedColumn* rc =
buildReturnedColumn(const_cast<Item*>(item), *gwip, gwip->fatalParseError);
if (rc) if (rc)
gwip->rcWorkStack.push(rc); gwip->rcWorkStack.push(rc);
@@ -735,7 +741,8 @@ void gp_walk(const Item* item, void* arg)
// temp change clause type because the elements of row column are not walked yet // temp change clause type because the elements of row column are not walked yet
gwip->clauseType = SELECT; gwip->clauseType = SELECT;
for (uint32_t i = 0; i < row->cols(); i++) for (uint32_t i = 0; i < row->cols(); i++)
cols.push_back(execplan::SRCP(buildReturnedColumn(row->element_index(i), *gwip, gwip->fatalParseError))); cols.push_back(
execplan::SRCP(buildReturnedColumn(row->element_index(i), *gwip, gwip->fatalParseError)));
gwip->clauseType = WHERE; gwip->clauseType = WHERE;
rowCol->columnVec(cols); rowCol->columnVec(cols);
@@ -971,7 +978,8 @@ void parse_item(Item* item, vector<Item_field*>& field_vec, bool& hasNonSupportI
gwi->fatalParseError = true; gwi->fatalParseError = true;
// DRRTUY The questionable error text. I've seen // DRRTUY The questionable error text. I've seen
// ERR_CORRELATED_SUB_OR // ERR_CORRELATED_SUB_OR
string parseErrorText = logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_NON_SUPPORT_SUB_QUERY_TYPE); string parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_NON_SUPPORT_SUB_QUERY_TYPE);
setError(gwi->thd, ER_CHECK_NOT_IMPLEMENTED, parseErrorText); setError(gwi->thd, ER_CHECK_NOT_IMPLEMENTED, parseErrorText);
break; break;
} }
@@ -1633,4 +1641,4 @@ void debug_walk(const Item* item, void* arg)
} }
} }
} } // namespace cal_impl_if

View File

@@ -24,8 +24,8 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <stack> #include <stack>
#include <tr1/unordered_map> #include <unordered.h>
#include <tr1/unordered_set>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <cerrno> #include <cerrno>
@@ -36,7 +36,6 @@
#include <map> #include <map>
#include <limits> #include <limits>
#include <wait.h> //wait() #include <wait.h> //wait()
using namespace std;
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
@@ -132,6 +131,8 @@ using namespace funcexp;
#include "ha_subquery.h" #include "ha_subquery.h"
#include "statistics_manager/statistics.h" #include "statistics_manager/statistics.h"
using namespace std;
namespace cal_impl_if namespace cal_impl_if
{ {
extern bool nonConstFunc(Item_func* ifp); extern bool nonConstFunc(Item_func* ifp);
@@ -176,26 +177,26 @@ const string infinidb_autoswitch_warning =
"was switched to standard mode with downgraded performance."; "was switched to standard mode with downgraded performance.";
// copied from item_timefunc.cc // copied from item_timefunc.cc
static const string interval_names[] = {"year", [[maybe_unused]] static const string interval_names[] = {"year",
"quarter", "quarter",
"month", "month",
"week", "week",
"day", "day",
"hour", "hour",
"minute", "minute",
"second", "second",
"microsecond", "microsecond",
"year_month", "year_month",
"day_hour", "day_hour",
"day_minute", "day_minute",
"day_second", "day_second",
"hour_minute", "hour_minute",
"hour_second", "hour_second",
"minute_second", "minute_second",
"day_microsecond", "day_microsecond",
"hour_microsecond", "hour_microsecond",
"minute_microsecond", "minute_microsecond",
"second_microsecond"}; "second_microsecond"};
// HDFS is never used nowadays, so don't bother // HDFS is never used nowadays, so don't bother
bool useHdfs = false; // ResourceManager::instance()->useHdfs(); bool useHdfs = false; // ResourceManager::instance()->useHdfs();
@@ -4108,7 +4109,7 @@ int ha_mcs_impl_pushdown_init(mcs_handler_info* handler_info, TABLE* table, bool
boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID); boost::shared_ptr<CalpontSystemCatalog> csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
csc->identity(CalpontSystemCatalog::FE); csc->identity(CalpontSystemCatalog::FE);
if (!get_fe_conn_info_ptr()) if (!get_fe_conn_info_ptr())
{ {
set_fe_conn_info_ptr((void*)new cal_connection_info()); set_fe_conn_info_ptr((void*)new cal_connection_info());
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr()); thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());

View File

@@ -21,7 +21,7 @@
#include <bitset> #include <bitset>
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
#include <tr1/unordered_map> #include <unordered.h>
#include <iosfwd> #include <iosfwd>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <stack> #include <stack>

View File

@@ -29,7 +29,6 @@
#include <sstream> #include <sstream>
// #include <unistd.h> // #include <unistd.h>
#include <iomanip> #include <iomanip>
using namespace std;
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
@@ -65,6 +64,7 @@ using namespace logging;
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
using namespace boost; using namespace boost;
using namespace std;
namespace namespace
{ {

View File

@@ -21,7 +21,8 @@
*/ */
#include <my_config.h> #include <my_config.h>
#include <tr1/unordered_map> #include <unordered.h>
using namespace std; using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"

View File

@@ -3,7 +3,6 @@
// #include <cmath> // #include <cmath>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"
@@ -24,6 +23,7 @@ using namespace execplan;
#include "ha_mcs_impl_if.h" #include "ha_mcs_impl_if.h"
#include "ha_mcs_sysvars.h" #include "ha_mcs_sysvars.h"
using namespace cal_impl_if; using namespace cal_impl_if;
using namespace std;
namespace namespace
{ {

View File

@@ -24,12 +24,11 @@
/** @file */ /** @file */
/** class ScalarSub definition */ /** class ScalarSub definition */
//#define NDEBUG // #define NDEBUG
#define PREFER_MY_CONFIG_H #define PREFER_MY_CONFIG_H
#include <my_config.h> #include <my_config.h>
#include <cassert> #include <cassert>
#include <vector> #include <vector>
using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"
@@ -49,6 +48,8 @@ using namespace logging;
#include "ha_subquery.h" #include "ha_subquery.h"
using namespace std;
namespace cal_impl_if namespace cal_impl_if
{ {
ScalarSub::ScalarSub(gp_walk_info& gwip) : WhereSubQuery(gwip), fReturnedColPos(0) ScalarSub::ScalarSub(gp_walk_info& gwip) : WhereSubQuery(gwip), fReturnedColPos(0)

View File

@@ -23,11 +23,10 @@
***********************************************************************/ ***********************************************************************/
/** class SelectSubQuery definition */ /** class SelectSubQuery definition */
//#define NDEBUG // #define NDEBUG
#define PREFER_MY_CONFIG_H #define PREFER_MY_CONFIG_H
#include <my_config.h> #include <my_config.h>
#include <cassert> #include <cassert>
using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"
@@ -44,6 +43,7 @@ using namespace execplan;
using namespace logging; using namespace logging;
#include "ha_subquery.h" #include "ha_subquery.h"
using namespace std;
namespace cal_impl_if namespace cal_impl_if
{ {

View File

@@ -25,7 +25,6 @@
#include <my_config.h> #include <my_config.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"
#include "ha_mcs_impl_if.h" #include "ha_mcs_impl_if.h"
@@ -53,6 +52,8 @@ using namespace mcsv1sdk;
#include "vlarray.h" #include "vlarray.h"
using namespace std;
namespace cal_impl_if namespace cal_impl_if
{ {
ReturnedColumn* nullOnError(gp_walk_info& gwi) ReturnedColumn* nullOnError(gp_walk_info& gwi)
@@ -96,7 +97,8 @@ WF_FRAME frame(Window_frame_bound::Bound_precedence_type bound, Item* offset)
} }
ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi) ReturnedColumn* buildBoundExp(WF_Boundary& bound, SRCP& order, gp_walk_info& gwi)
{ {
if (get_fe_conn_info_ptr() == NULL) { if (get_fe_conn_info_ptr() == NULL)
{
set_fe_conn_info_ptr((void*)new cal_connection_info()); set_fe_conn_info_ptr((void*)new cal_connection_info());
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr()); thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
} }
@@ -305,7 +307,8 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
// String str; // String str;
// item->print(&str, QT_INFINIDB_NO_QUOTE); // item->print(&str, QT_INFINIDB_NO_QUOTE);
// cout << str.c_ptr() << endl; // cout << str.c_ptr() << endl;
if (get_fe_conn_info_ptr() == NULL) { if (get_fe_conn_info_ptr() == NULL)
{
set_fe_conn_info_ptr((void*)new cal_connection_info()); set_fe_conn_info_ptr((void*)new cal_connection_info());
thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr()); thd_set_ha_data(current_thd, mcs_hton, get_fe_conn_info_ptr());
} }
@@ -530,8 +533,8 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
return nullOnError(gwi); return nullOnError(gwi);
srcp->asc(orderCol->direction == ORDER::ORDER_ASC ? true : false); srcp->asc(orderCol->direction == ORDER::ORDER_ASC ? true : false);
// srcp->nullsFirst(orderCol->nulls); // nulls 2-default, 1-nulls first, // srcp->nullsFirst(orderCol->nulls); // nulls 2-default, 1-nulls
//0-nulls last //first, 0-nulls last
srcp->nullsFirst(orderCol->direction == ORDER::ORDER_ASC srcp->nullsFirst(orderCol->direction == ORDER::ORDER_ASC
? 1 ? 1
: 0); // WINDOWS TODO: implement NULLS FIRST/LAST in 10.2 front end : 0); // WINDOWS TODO: implement NULLS FIRST/LAST in 10.2 front end
@@ -881,7 +884,7 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
} }
#if 0 #if 0
if (item_sum->sum_func() != Item_sum::UDF_SUM_FUNC && if (item_sum->sum_func() != Item_sum::UDF_SUM_FUNC &&
item_sum->sum_func() != Item_sum::SUM_FUNC && item_sum->sum_func() != Item_sum::SUM_FUNC &&
item_sum->sum_func() != Item_sum::SUM_DISTINCT_FUNC && item_sum->sum_func() != Item_sum::SUM_DISTINCT_FUNC &&
item_sum->sum_func() != Item_sum::AVG_FUNC && item_sum->sum_func() != Item_sum::AVG_FUNC &&
item_sum->sum_func() != Item_sum::AVG_DISTINCT_FUNC) item_sum->sum_func() != Item_sum::AVG_DISTINCT_FUNC)

View File

@@ -86,6 +86,24 @@ if(WITH_TSAN)
set(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${TSAN_PATH}.storagemanager) set(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${TSAN_PATH}.storagemanager)
endif() endif()
if(WITH_MSAN)
set(MSAN_PATH "/tmp/msan")
if(WITH_COLUMNSTORE_REPORT_PATH)
set(MSAN_PATH "${WITH_COLUMNSTORE_REPORT_PATH}/msan")
endif(WITH_COLUMNSTORE_REPORT_PATH)
set(LD_PRELOAD_STRING "")
set(MSAN_OPTIONS abort_on_error=0:log_path=${MSAN_PATH})
set(ALLOC_CONFIG MSAN_OPTIONS=${MSAN_OPTIONS})
set(PRIMPROC_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${MSAN_PATH}.primproc)
set(DMLPROC_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${MSAN_PATH}.dmlproc)
set(DDLPROC_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${MSAN_PATH}.ddlproc)
set(WRITEENGINE_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${MSAN_PATH}.writeengine)
set(CONTROLLERNODE_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${MSAN_PATH}.controllernode)
set(WORKERNODE_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${MSAN_PATH}.workernode)
set(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${MSAN_PATH}.storagemanager)
endif()
configure_file( configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh" "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh"
@ONLY @ONLY

View File

@@ -53,7 +53,7 @@
#if defined(__GNUC__) #if defined(__GNUC__)
#include <string> #include <string>
static const std::string optim( [[maybe_unused]] static const std::string optim(
"Build is " "Build is "
#if !defined(__OPTIMIZE__) #if !defined(__OPTIMIZE__)
"NOT " "NOT "

View File

@@ -26,7 +26,8 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <tr1/unordered_set> #include <unordered.h>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <deque> #include <deque>

View File

@@ -48,8 +48,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <tr1/unordered_map> #include <unordered.h>
#include <tr1/unordered_set>
#include <set> #include <set>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -61,7 +60,7 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/thread/condition.hpp> #include <boost/thread/condition.hpp>
#include <pthread.h> #include <pthread.h>
//#define NDEBUG // #define NDEBUG
#include <cassert> #include <cassert>
using namespace std; using namespace std;
@@ -648,7 +647,7 @@ void* thr_popper(ioManager* arg)
fdCountSort.clear(); fdCountSort.clear();
} // if (fdcache.size()... } // if (fdcache.size()...
} // if (oid > 3000) } // if (oid > 3000)
int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0; int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0;
fp = NULL; fp = NULL;

View File

@@ -20,15 +20,16 @@
* *
****************************************************************************/ ****************************************************************************/
//#define NDEBUG // #define NDEBUG
#include <cassert> #include <cassert>
#ifdef __linux__ #ifdef __linux__
#include <sys/types.h> #include <sys/types.h>
#endif #endif
using namespace std;
#include "primitiveprocessor.h" #include "primitiveprocessor.h"
using namespace std;
namespace primitives namespace primitives
{ {
PrimitiveProcessor::PrimitiveProcessor(int debugLevel) PrimitiveProcessor::PrimitiveProcessor(int debugLevel)

View File

@@ -27,7 +27,8 @@
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
#include <tr1/unordered_set> #include <unordered.h>
#include "joblisttypes.h" #include "joblisttypes.h"
#define POSIX_REGEX #define POSIX_REGEX
@@ -40,7 +41,6 @@
#include <cstddef> #include <cstddef>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include "primitivemsg.h" #include "primitivemsg.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
#include "stats.h" #include "stats.h"
@@ -50,7 +50,7 @@
class PrimTest; class PrimTest;
// XXX: turn off dictionary range setting during scan. // XXX: turn off dictionary range setting during scan.
//#define XXX_PRIMITIVES_TOKEN_RANGES_XXX // #define XXX_PRIMITIVES_TOKEN_RANGES_XXX
namespace primitives namespace primitives
{ {
@@ -121,13 +121,16 @@ class DictEqualityFilter : public std::tr1::unordered_set<std::string, datatypes
: std::tr1::unordered_set<std::string, datatypes::CollationAwareHasher, : std::tr1::unordered_set<std::string, datatypes::CollationAwareHasher,
datatypes::CollationAwareComparator>(10, datatypes::CollationAwareHasher(cs), datatypes::CollationAwareComparator>(10, datatypes::CollationAwareHasher(cs),
datatypes::CollationAwareComparator(cs)) datatypes::CollationAwareComparator(cs))
, charset(cs.getCharset())
{ {
} }
CHARSET_INFO& getCharset() const CHARSET_INFO& getCharset() const
{ {
idbassert(&_M_h1.getCharset() == &_M_eq.getCharset()); return charset;
return _M_h1.getCharset();
} }
private:
CHARSET_INFO& charset;
}; };
// Not the safest way b/c it doesn't cover uint128_t but the type // Not the safest way b/c it doesn't cover uint128_t but the type
@@ -493,7 +496,8 @@ T getNullValue(uint8_t type)
case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::TEXT: return joblist::CHAR8NULL; case execplan::CalpontSystemCatalog::TEXT: return joblist::CHAR8NULL;
// VARCHARs with width >= 8 are stored as dictionaries (used TypeHandlerVarchar::getNullValueForType as a reference) // VARCHARs with width >= 8 are stored as dictionaries (used TypeHandlerVarchar::getNullValueForType as a
// reference)
case execplan::CalpontSystemCatalog::VARCHAR: return joblist::UBIGINTNULL; case execplan::CalpontSystemCatalog::VARCHAR: return joblist::UBIGINTNULL;
case execplan::CalpontSystemCatalog::UBIGINT: return joblist::UBIGINTNULL; case execplan::CalpontSystemCatalog::UBIGINT: return joblist::UBIGINTNULL;
@@ -581,7 +585,7 @@ boost::shared_ptr<ParsedColumnFilter> _parseColumnFilter(
{ {
using UT = typename std::conditional<std::is_unsigned<T>::value || datatypes::is_uint128_t<T>::value, T, using UT = typename std::conditional<std::is_unsigned<T>::value || datatypes::is_uint128_t<T>::value, T,
typename datatypes::make_unsigned<T>::type>::type; typename datatypes::make_unsigned<T>::type>::type;
const uint32_t WIDTH = sizeof(T); // Sizeof of the column to be filtered const uint32_t WIDTH = sizeof(T); // Sizeof of the column to be filtered
boost::shared_ptr<ParsedColumnFilter> ret; // Place for building the value to return boost::shared_ptr<ParsedColumnFilter> ret; // Place for building the value to return
if (filterCount == 0) if (filterCount == 0)
return ret; return ret;

View File

@@ -34,7 +34,8 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <unistd.h> #include <unistd.h>
#include <tr1/unordered_map> #include <unordered.h>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include "batchprimitiveprocessor.h" #include "batchprimitiveprocessor.h"

View File

@@ -65,7 +65,7 @@ void BPPSendThread::sendResult(const Msg_t& msg, bool newConnection)
std::unique_lock<std::mutex> sl(msgQueueLock); std::unique_lock<std::mutex> sl(msgQueueLock);
if (gotException) if (gotException)
throw runtime_error(exceptionString); throw std::runtime_error(exceptionString);
(void)atomicops::atomicAdd<uint64_t>(&currentByteSize, msg.msg->lengthWithHdrOverhead()); (void)atomicops::atomicAdd<uint64_t>(&currentByteSize, msg.msg->lengthWithHdrOverhead());
msgQueue.push(msg); msgQueue.push(msg);
@@ -91,7 +91,7 @@ void BPPSendThread::sendResult(const Msg_t& msg, bool newConnection)
queueNotEmpty.notify_one(); queueNotEmpty.notify_one();
} }
void BPPSendThread::sendResults(const vector<Msg_t>& msgs, bool newConnection) void BPPSendThread::sendResults(const std::vector<Msg_t>& msgs, bool newConnection)
{ {
// Wait for the queue to empty out a bit if it's stuffed full // Wait for the queue to empty out a bit if it's stuffed full
if (sizeTooBig()) if (sizeTooBig())
@@ -110,7 +110,7 @@ void BPPSendThread::sendResults(const vector<Msg_t>& msgs, bool newConnection)
std::unique_lock<std::mutex> sl(msgQueueLock); std::unique_lock<std::mutex> sl(msgQueueLock);
if (gotException) if (gotException)
throw runtime_error(exceptionString); throw std::runtime_error(exceptionString);
if (!sawAllConnections && newConnection) if (!sawAllConnections && newConnection)
{ {

View File

@@ -36,13 +36,11 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/thread/condition.hpp> #include <boost/thread/condition.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <tr1/unordered_map> #include <unordered.h>
#include <tr1/unordered_set>
#include <pthread.h> #include <pthread.h>
#include <cerrno> #include <cerrno>
using namespace std;
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
#include <utility> #include <utility>
@@ -91,6 +89,8 @@ using namespace idbdatafile;
using namespace threadpool; using namespace threadpool;
using namespace std;
#include "threadnaming.h" #include "threadnaming.h"
#include "atomicops.h" #include "atomicops.h"

View File

@@ -25,8 +25,8 @@
#pragma once #pragma once
#include <map> #include <map>
#include <tr1/unordered_map> #include <unordered.h>
#include <tr1/unordered_set>
#include <unordered_map> #include <unordered_map>
#include <boost/thread.hpp> #include <boost/thread.hpp>

View File

@@ -31,7 +31,7 @@
#include <csignal> #include <csignal>
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <tr1/unordered_set> #include <unordered.h>
#include <clocale> #include <clocale>
#include <iterator> #include <iterator>

View File

@@ -339,7 +339,7 @@ class ServiceExeMgr : public Service, public Opt
} }
void getLocalNetIfacesSins() void getLocalNetIfacesSins()
{ {
string ipAddress = "Unable to get IP Address"; std::string ipAddress = "Unable to get IP Address";
struct ifaddrs* netIfacesList = nullptr; struct ifaddrs* netIfacesList = nullptr;
struct ifaddrs* ifaceListMembPtr = nullptr; struct ifaddrs* ifaceListMembPtr = nullptr;
int success = 0; int success = 0;

View File

@@ -23,7 +23,7 @@
#include <signal.h> #include <signal.h>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <sys/poll.h> #include <sys/poll.h>
#include <tr1/unordered_map> #include <unordered.h>
namespace storagemanager namespace storagemanager
{ {

View File

@@ -8,11 +8,17 @@ endif()
if(WITH_UNITTESTS) if(WITH_UNITTESTS)
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external) set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
set(cxxflags "")
if(WITH_MSAN)
set(cxxflags "'${cxxflags} -fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE -stdlib=libc++'")
endif()
ExternalProject_Add( ExternalProject_Add(
googletest googletest
GIT_REPOSITORY https://github.com/google/googletest GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG release-1.12.0 GIT_TAG release-1.12.0
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DBUILD_SHARED_LIBS=ON CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DBUILD_SHARED_LIBS=ON
-DCMAKE_CXX_FLAGS:STRING=${cxxflags}
) )
# this is a workaround for gtest's bug still not closed https://github.com/google/googletest/issues/3659 # this is a workaround for gtest's bug still not closed https://github.com/google/googletest/issues/3659
@@ -93,23 +99,25 @@ if(WITH_UNITTESTS)
columnstore_link(stlpoolallocator ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${GTEST_LIBRARIES}) columnstore_link(stlpoolallocator ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${GTEST_LIBRARIES})
gtest_add_tests(TARGET stlpoolallocator TEST_PREFIX columnstore:) gtest_add_tests(TARGET stlpoolallocator TEST_PREFIX columnstore:)
add_executable(comparators_tests comparators-tests.cpp)
columnstore_link(comparators_tests ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${CPPUNIT_LIBRARIES} cppunit)
add_test(NAME columnstore:comparators_tests COMMAND comparators_tests)
add_executable(bytestream bytestream.cpp)
columnstore_link(bytestream ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${CPPUNIT_LIBRARIES} cppunit)
add_test(NAME columnstore:bytestream COMMAND bytestream)
add_executable(idbdatafile_test BufferedFile.cpp) add_executable(idbdatafile_test BufferedFile.cpp)
columnstore_link(idbdatafile_test ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} gtest gtest_main) columnstore_link(idbdatafile_test ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} gtest gtest_main)
add_test(NAME columnstore:idbdatafile_test COMMAND idbdatafile_test) add_test(NAME columnstore:idbdatafile_test COMMAND idbdatafile_test)
# standalone EM routines test if(NOT DEFINED WITH_MSAN) # CPPUnit is not build from sources
add_executable(brm_em_standalone brm-em-standalone.cpp) add_executable(comparators_tests comparators-tests.cpp)
columnstore_link(brm_em_standalone ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${CPPUNIT_LIBRARIES} cppunit) columnstore_link(comparators_tests ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${CPPUNIT_LIBRARIES} cppunit)
add_test(NAME columnstore:brm_em_standalone COMMAND brm_em_standalone) add_test(NAME columnstore:comparators_tests COMMAND comparators_tests)
set_tests_properties(columnstore:brm_em_standalone PROPERTIES DISABLED True)
add_executable(bytestream bytestream.cpp)
columnstore_link(bytestream ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${CPPUNIT_LIBRARIES} cppunit)
add_test(NAME columnstore:bytestream COMMAND bytestream)
# standalone EM routines test
add_executable(brm_em_standalone brm-em-standalone.cpp)
columnstore_link(brm_em_standalone ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${CPPUNIT_LIBRARIES} cppunit)
add_test(NAME columnstore:brm_em_standalone COMMAND brm_em_standalone)
set_tests_properties(columnstore:brm_em_standalone PROPERTIES DISABLED True)
endif()
endif() endif()
if(WITH_MICROBENCHMARKS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")) if(WITH_MICROBENCHMARKS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug"))

View File

@@ -24,7 +24,7 @@
class CompressionTest : public ::testing::Test class CompressionTest : public ::testing::Test
{ {
protected: protected:
std::string genPermutations(string& data) std::string genPermutations(std::string& data)
{ {
std::string generated; std::string generated;
generate(data, 0, generated); generate(data, 0, generated);
@@ -32,7 +32,7 @@ class CompressionTest : public ::testing::Test
} }
private: private:
void generate(string& data, uint32_t i, std::string& generated) void generate(std::string& data, uint32_t i, std::string& generated)
{ {
if (i == data.size()) if (i == data.size())
{ {

View File

@@ -23,6 +23,8 @@
#include "mcs_decimal.h" #include "mcs_decimal.h"
#include "dataconvert.h" #include "dataconvert.h"
using namespace std;
TEST(Decimal, compareCheckInt64) TEST(Decimal, compareCheckInt64)
{ {
// remainder-based checks // remainder-based checks

View File

@@ -80,8 +80,9 @@ TEST_F(RebuildEMTest, File2OidCheckFileFormatTest)
FileId fExpected(getOid(0, 0, 8, 28), 00, 79); FileId fExpected(getOid(0, 0, 8, 28), 00, 79);
std::vector<std::pair<std::string, FileId>> expectedFileIds = { std::vector<std::pair<std::string, FileId>> expectedFileIds = {
make_pair(aFileName, aExpected), make_pair(bFileName, bExpected), make_pair(cFileName, cExpected), std::make_pair(aFileName, aExpected), std::make_pair(bFileName, bExpected),
make_pair(dFileName, dExpected), make_pair(eFileName, eExpected), make_pair(fFileName, fExpected)}; std::make_pair(cFileName, cExpected), std::make_pair(dFileName, dExpected),
std::make_pair(eFileName, eExpected), std::make_pair(fFileName, fExpected)};
for (const auto& expectedPair : expectedFileIds) for (const auto& expectedPair : expectedFileIds)
{ {

View File

@@ -25,7 +25,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <tr1/unordered_map> #include <unordered.h>
#include <stddef.h> #include <stddef.h>

View File

@@ -104,7 +104,6 @@ const int64_t IDB_pow[19] = {1,
100000000000000000LL, 100000000000000000LL,
1000000000000000000LL}; 1000000000000000000LL};
const int32_t SECS_PER_MIN = 60; const int32_t SECS_PER_MIN = 60;
const int32_t MINS_PER_HOUR = 60; const int32_t MINS_PER_HOUR = 60;
const int32_t HOURS_PER_DAY = 24; const int32_t HOURS_PER_DAY = 24;
@@ -1089,7 +1088,7 @@ void number_int_value(const std::string& data, cscDataType typeCode,
const datatypes::SystemCatalog::TypeAttributesStd& ct, bool& pushwarning, const datatypes::SystemCatalog::TypeAttributesStd& ct, bool& pushwarning,
bool noRoundup, T& intVal, bool* saturate = 0); bool noRoundup, T& intVal, bool* saturate = 0);
uint64_t number_uint_value(const string& data, cscDataType typeCode, uint64_t number_uint_value(const std::string& data, cscDataType typeCode,
const datatypes::SystemCatalog::TypeAttributesStd& ct, bool& pushwarning, const datatypes::SystemCatalog::TypeAttributesStd& ct, bool& pushwarning,
bool noRoundup); bool noRoundup);
@@ -1319,7 +1318,7 @@ inline void DataConvert::datetimeToString(long long datetimevalue, char* buf, un
if ((datetimevalue & 0xfffff) > 0) if ((datetimevalue & 0xfffff) > 0)
{ {
msec = (unsigned)((datetimevalue)&0xfffff); msec = (unsigned)((datetimevalue) & 0xfffff);
} }
snprintf(buf, buflen, "%04d-%02d-%02d %02d:%02d:%02d", (unsigned)((datetimevalue >> 48) & 0xffff), snprintf(buf, buflen, "%04d-%02d-%02d %02d:%02d:%02d", (unsigned)((datetimevalue >> 48) & 0xffff),
@@ -1377,7 +1376,7 @@ inline void DataConvert::timeToString(long long timevalue, char* buf, unsigned i
if ((timevalue & 0xffffff) > 0) if ((timevalue & 0xffffff) > 0)
{ {
msec = (unsigned)((timevalue)&0xffffff); msec = (unsigned)((timevalue) & 0xffffff);
} }
if ((hour >= 0) && (timevalue >> 63)) if ((hour >= 0) && (timevalue >> 63))
@@ -1554,7 +1553,6 @@ inline int128_t strtoll128(const char* data, bool& saturate, char** ep)
return res; return res;
} }
template <class T> template <class T>
T decimalRangeUp(int32_t precision) T decimalRangeUp(int32_t precision)
{ {

View File

@@ -22,14 +22,14 @@ CalpontSystemCatalog::ColType Func_json_array::operationType(FunctionParm& fp,
return fp.size() > 0 ? fp[0]->data()->resultType() : resultType; return fp.size() > 0 ? fp[0]->data()->resultType() : resultType;
} }
string Func_json_array::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_array::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& type) execplan::CalpontSystemCatalog::ColType& type)
{ {
if (fp.size() == 0) if (fp.size() == 0)
return "[]"; return "[]";
const CHARSET_INFO* retCS = type.getCharset(); const CHARSET_INFO* retCS = type.getCharset();
string ret("["); std::string ret("[");
if (appendJSValue(ret, retCS, row, fp[0])) if (appendJSValue(ret, retCS, row, fp[0]))
goto error; goto error;

View File

@@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_array_append::operationType(
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto& js = fp[0]->data()->getStrVal(row, isNull); const auto& js = fp[0]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
@@ -32,7 +32,7 @@ string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, b
json_engine_t jsEg; json_engine_t jsEg;
const uchar* arrEnd; const uchar* arrEnd;
size_t strRestLen; size_t strRestLen;
string retJS; std::string retJS;
retJS.reserve(js.length() + padding); retJS.reserve(js.length() + padding);
initJSPaths(paths, fp, 1, 2); initJSPaths(paths, fp, 1, 2);

View File

@@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_array_insert::operationType(
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto& js = fp[0]->data()->getStrVal(row, isNull); const auto& js = fp[0]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
@@ -30,7 +30,7 @@ string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, b
const CHARSET_INFO* cs = getCharset(fp[0]); const CHARSET_INFO* cs = getCharset(fp[0]);
json_engine_t jsEg; json_engine_t jsEg;
string retJS; std::string retJS;
retJS.reserve(js.length() + 8); retJS.reserve(js.length() + 8);
initJSPaths(paths, fp, 1, 2); initJSPaths(paths, fp, 1, 2);

View File

@@ -32,7 +32,7 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
if (isNull) if (isNull)
return false; return false;
const string_view js = js_ns.unsafeStringRef(); const std::string_view js = js_ns.unsafeStringRef();
#if MYSQL_VERSION_ID >= 100900 #if MYSQL_VERSION_ID >= 100900
int arrayCounters[JSON_DEPTH_LIMIT]; int arrayCounters[JSON_DEPTH_LIMIT];
@@ -48,7 +48,7 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul
auto mode_ns = fp[1]->data()->getStrVal(row, isNull); auto mode_ns = fp[1]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
return false; return false;
string mode = mode_ns.unsafeStringRef(); std::string mode = mode_ns.unsafeStringRef();
transform(mode.begin(), mode.end(), mode.begin(), ::tolower); transform(mode.begin(), mode.end(), mode.begin(), ::tolower);
if (mode != "one" && mode != "all") if (mode != "one" && mode != "all")

View File

@@ -13,7 +13,7 @@ using namespace funcexp::helpers;
namespace funcexp namespace funcexp
{ {
int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* type, string& retJS, int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* type, std::string& retJS,
bool compareWhole = true) bool compareWhole = true)
{ {
bool isNull = false; bool isNull = false;
@@ -34,7 +34,7 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t
bool hasNegPath = false; bool hasNegPath = false;
#endif #endif
const size_t argSize = fp.size(); const size_t argSize = fp.size();
string tmp; std::string tmp;
initJSPaths(paths, fp, 1, 1); initJSPaths(paths, fp, 1, 1);
@@ -151,10 +151,10 @@ CalpontSystemCatalog::ColType Func_json_extract::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_extract::getStrVal(Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_extract::getStrVal(Row& row, FunctionParm& fp, bool& isNull,
CalpontSystemCatalog::ColType& /*type*/) CalpontSystemCatalog::ColType& /*type*/)
{ {
string retJS; std::string retJS;
json_value_types valType; json_value_types valType;
if (doExtract(row, fp, &valType, retJS) == 0) if (doExtract(row, fp, &valType, retJS) == 0)
return retJS; return retJS;
@@ -166,7 +166,7 @@ string Func_json_extract::getStrVal(Row& row, FunctionParm& fp, bool& isNull,
int64_t Func_json_extract::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& /*isNull*/, int64_t Func_json_extract::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& /*isNull*/,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
string retJS; std::string retJS;
json_value_types valType; json_value_types valType;
int64_t ret = 0; int64_t ret = 0;
if (doExtract(row, fp, &valType, retJS, false) == 0) if (doExtract(row, fp, &valType, retJS, false) == 0)
@@ -192,7 +192,7 @@ int64_t Func_json_extract::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool&
double Func_json_extract::getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& /*isNull*/, double Func_json_extract::getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& /*isNull*/,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
string retJS; std::string retJS;
json_value_types valType; json_value_types valType;
double ret = 0.0; double ret = 0.0;
if (doExtract(row, fp, &valType, retJS, false) == 0) if (doExtract(row, fp, &valType, retJS, false) == 0)
@@ -219,7 +219,7 @@ execplan::IDB_Decimal Func_json_extract::getDecimalVal(rowgroup::Row& row, Funct
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
json_value_types valType; json_value_types valType;
string retJS; std::string retJS;
if (doExtract(row, fp, &valType, retJS, false) == 0) if (doExtract(row, fp, &valType, retJS, false) == 0)
{ {

View File

@@ -22,8 +22,8 @@ CalpontSystemCatalog::ColType Func_json_format::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_format::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_format::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto& js = fp[0]->data()->getStrVal(row, isNull); const auto& js = fp[0]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
@@ -48,7 +48,7 @@ string Func_json_format::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
json_engine_t jsEg; json_engine_t jsEg;
initJSEngine(jsEg, getCharset(fp[0]), js); initJSEngine(jsEg, getCharset(fp[0]), js);
string ret; std::string ret;
if (doFormat(&jsEg, ret, fmt, tabSize)) if (doFormat(&jsEg, ret, fmt, tabSize))
{ {
isNull = true; isNull = true;

View File

@@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_insert::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto& js = fp[0]->data()->getStrVal(row, isNull); const auto& js = fp[0]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
@@ -40,7 +40,7 @@ string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
initJSPaths(paths, fp, 1, 2); initJSPaths(paths, fp, 1, 2);
// Save the result of each merge and the result of the final merge separately // Save the result of each merge and the result of the final merge separately
string retJS; std::string retJS;
utils::NullString tmpJS(js); utils::NullString tmpJS(js);
for (size_t i = 1, j = 0; i < fp.size(); i += 2, j++) for (size_t i = 1, j = 0; i < fp.size(); i += 2, j++)
{ {

View File

@@ -14,7 +14,7 @@ using namespace funcexp::helpers;
namespace namespace
{ {
bool checkKeyInList(const string& res, const uchar* key, const int keyLen) bool checkKeyInList(const std::string& res, const uchar* key, const int keyLen)
{ {
const uchar* curr = (const uchar*)res.c_str() + 2; /* beginning '["' */ const uchar* curr = (const uchar*)res.c_str() + 2; /* beginning '["' */
const uchar* end = (const uchar*)res.c_str() + res.size() - 1; /* ending '"' */ const uchar* end = (const uchar*)res.c_str() + res.size() - 1; /* ending '"' */
@@ -51,15 +51,15 @@ CalpontSystemCatalog::ColType Func_json_keys::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_keys::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_keys::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto js = fp[0]->data()->getStrVal(row, isNull); const auto js = fp[0]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
return ""; return "";
IntType keySize = 0; IntType keySize = 0;
string ret; std::string ret;
json_engine_t jsEg; json_engine_t jsEg;
initJSEngine(jsEg, getCharset(fp[0]), js); initJSEngine(jsEg, getCharset(fp[0]), js);

View File

@@ -13,7 +13,7 @@ using namespace funcexp::helpers;
namespace namespace
{ {
int doMerge(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2) int doMerge(std::string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2)
{ {
if (json_read_value(jsEg1) || json_read_value(jsEg2)) if (json_read_value(jsEg1) || json_read_value(jsEg2))
return 1; return 1;
@@ -214,8 +214,8 @@ CalpontSystemCatalog::ColType Func_json_merge::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto js = fp[0]->data()->getStrVal(row, isNull); const auto js = fp[0]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
@@ -226,7 +226,7 @@ string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is
json_engine_t jsEg1, jsEg2; json_engine_t jsEg1, jsEg2;
utils::NullString tmpJS(js); utils::NullString tmpJS(js);
string retJS; std::string retJS;
for (size_t i = 1; i < fp.size(); i++) for (size_t i = 1; i < fp.size(); i++)
{ {

View File

@@ -13,7 +13,7 @@ using namespace funcexp::helpers;
namespace namespace
{ {
int copyValuePatch(string& retJS, json_engine_t* jsEg) int copyValuePatch(std::string& retJS, json_engine_t* jsEg)
{ {
int firstKey = 1; int firstKey = 1;
@@ -69,7 +69,7 @@ int copyValuePatch(string& retJS, json_engine_t* jsEg)
return 0; return 0;
} }
int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool& isEmpty) int doMergePatch(std::string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool& isEmpty)
{ {
if (json_read_value(jsEg1)) if (json_read_value(jsEg1))
{ {
@@ -266,8 +266,8 @@ CalpontSystemCatalog::ColType Func_json_merge_patch::operationType(
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
// JSON_MERGE_PATCH return NULL if any argument is NULL // JSON_MERGE_PATCH return NULL if any argument is NULL
bool isEmpty = false, hasNullArg = false; bool isEmpty = false, hasNullArg = false;
@@ -279,7 +279,7 @@ string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bo
jsEg1.s.error = jsEg2.s.error = 0; jsEg1.s.error = jsEg2.s.error = 0;
utils::NullString tmpJS(js); utils::NullString tmpJS(js);
string retJS; std::string retJS;
for (size_t i = 1; i < fp.size(); i++) for (size_t i = 1; i < fp.size(); i++)
{ {
const auto& js2 = fp[i]->data()->getStrVal(row, isNull); const auto& js2 = fp[i]->data()->getStrVal(row, isNull);

View File

@@ -22,13 +22,13 @@ CalpontSystemCatalog::ColType Func_json_normalize::operationType(
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_normalize::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_normalize::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto js_ns = fp[0]->data()->getStrVal(row, isNull); const auto js_ns = fp[0]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
return ""; return "";
const string_view js = js_ns.unsafeStringRef(); const std::string_view js = js_ns.unsafeStringRef();
using DynamicString = unique_ptr<DYNAMIC_STRING, decltype(&dynstr_free)>; using DynamicString = unique_ptr<DYNAMIC_STRING, decltype(&dynstr_free)>;

View File

@@ -25,14 +25,14 @@ CalpontSystemCatalog::ColType Func_json_object::operationType(FunctionParm& fp,
return fp.size() > 0 ? fp[0]->data()->resultType() : resultType; return fp.size() > 0 ? fp[0]->data()->resultType() : resultType;
} }
string Func_json_object::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_object::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& type) execplan::CalpontSystemCatalog::ColType& type)
{ {
if (fp.size() == 0) if (fp.size() == 0)
return "{}"; return "{}";
const CHARSET_INFO* retCS = type.getCharset(); const CHARSET_INFO* retCS = type.getCharset();
string ret("{"); std::string ret("{");
if (appendJSKeyName(ret, retCS, row, fp[0]) || appendJSValue(ret, retCS, row, fp[1])) if (appendJSKeyName(ret, retCS, row, fp[0]) || appendJSValue(ret, retCS, row, fp[1]))
goto error; goto error;

View File

@@ -14,13 +14,13 @@ namespace funcexp
class QueryJSONPathWrapper : public JSONPathWrapper class QueryJSONPathWrapper : public JSONPathWrapper
{ {
bool checkAndGetValue(JSONEgWrapper* je, string& res, int* error) override bool checkAndGetValue(JSONEgWrapper* je, std::string& res, int* error) override
{ {
return je->checkAndGetComplexVal(res, error); return je->checkAndGetComplexVal(res, error);
} }
}; };
bool JSONEgWrapper::checkAndGetComplexVal(string& ret, int* error) bool JSONEgWrapper::checkAndGetComplexVal(std::string& ret, int* error)
{ {
if (json_value_scalar(this)) if (json_value_scalar(this))
{ {
@@ -47,10 +47,10 @@ CalpontSystemCatalog::ColType Func_json_query::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_query::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_query::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
string ret; std::string ret;
QueryJSONPathWrapper qpw; QueryJSONPathWrapper qpw;
isNull = qpw.extract(ret, row, fp[0], fp[1]); isNull = qpw.extract(ret, row, fp[0], fp[1]);
return isNull ? "" : ret; return isNull ? "" : ret;

View File

@@ -35,7 +35,7 @@ std::string Func_json_quote::getStrVal(rowgroup::Row& row, FunctionParm& fp, boo
return ""; return "";
} }
string ret("\""); std::string ret("\"");
isNull = appendEscapedJS(ret, &my_charset_utf8mb4_bin, js, getCharset(fp[0])); isNull = appendEscapedJS(ret, &my_charset_utf8mb4_bin, js, getCharset(fp[0]));
if (isNull) if (isNull)

View File

@@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_remove::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto& js = fp[0]->data()->getStrVal(row, isNull); const auto& js = fp[0]->data()->getStrVal(row, isNull);
@@ -37,7 +37,7 @@ string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
initJSPaths(paths, fp, 1, 1); initJSPaths(paths, fp, 1, 1);
string retJS; std::string retJS;
utils::NullString tmpJS(js); utils::NullString tmpJS(js);
for (size_t i = 1, j = 0; i < fp.size(); i++, j++) for (size_t i = 1, j = 0; i < fp.size(); i++, j++)
{ {

View File

@@ -17,7 +17,7 @@ using namespace funcexp::helpers;
namespace namespace
{ {
static bool appendJSPath(string& ret, const json_path_t* p) static bool appendJSPath(std::string& ret, const json_path_t* p)
{ {
const json_path_step_t* c; const json_path_step_t* c;
@@ -35,7 +35,7 @@ static bool appendJSPath(string& ret, const json_path_t* p)
else /*JSON_PATH_ARRAY*/ else /*JSON_PATH_ARRAY*/
{ {
ret.append("["); ret.append("[");
ret.append(to_string(c->n_item)); ret.append(std::to_string(c->n_item));
ret.append("]"); ret.append("]");
} }
} }
@@ -81,10 +81,10 @@ CalpontSystemCatalog::ColType Func_json_search::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
string ret; std::string ret;
bool isNullJS = false, isNullVal = false; bool isNullJS = false, isNullVal = false;
const auto& js = fp[0]->data()->getStrVal(row, isNull); const auto& js = fp[0]->data()->getStrVal(row, isNull);
const auto& cmpStr = fp[2]->data()->getStrVal(row, isNull); const auto& cmpStr = fp[2]->data()->getStrVal(row, isNull);
@@ -102,7 +102,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i
const auto& mode_ns = fp[1]->data()->getStrVal(row, isNull); const auto& mode_ns = fp[1]->data()->getStrVal(row, isNull);
if (isNull) if (isNull)
return ""; return "";
string mode = mode_ns.safeString(""); std::string mode = mode_ns.safeString("");
transform(mode.begin(), mode.end(), mode.begin(), ::tolower); transform(mode.begin(), mode.end(), mode.begin(), ::tolower);
if (mode != "one" && mode != "all") if (mode != "one" && mode != "all")

View File

@@ -19,7 +19,7 @@ CalpontSystemCatalog::ColType Func_json_type::operationType(FunctionParm& fp,
return fp[0]->data()->resultType(); return fp[0]->data()->resultType();
} }
string Func_json_type::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_type::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
const auto js = fp[0]->data()->getStrVal(row, isNull); const auto js = fp[0]->data()->getStrVal(row, isNull);
@@ -27,7 +27,7 @@ string Func_json_type::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN
return ""; return "";
json_engine_t jsEg; json_engine_t jsEg;
string result; std::string result;
initJSEngine(jsEg, getCharset(fp[0]), js); initJSEngine(jsEg, getCharset(fp[0]), js);

View File

@@ -42,7 +42,7 @@ std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, b
(uchar*)buf, (uchar*)(buf + jsEg.value_len))) >= 0) (uchar*)buf, (uchar*)(buf + jsEg.value_len))) >= 0)
{ {
buf[strLen] = '\0'; buf[strLen] = '\0';
string ret = buf; std::string ret = buf;
return strLen == 0 ? "" : ret; return strLen == 0 ? "" : ret;
} }

View File

@@ -14,7 +14,7 @@ using namespace funcexp::helpers;
namespace funcexp namespace funcexp
{ {
bool JSONEgWrapper::checkAndGetScalar(string& ret, int* error) bool JSONEgWrapper::checkAndGetScalar(std::string& ret, int* error)
{ {
CHARSET_INFO* cs; CHARSET_INFO* cs;
const uchar* js; const uchar* js;
@@ -111,16 +111,16 @@ class JSONPathWrapperValue : public JSONPathWrapper
{ {
} }
bool checkAndGetValue(JSONEgWrapper* je, string& res, int* error) override bool checkAndGetValue(JSONEgWrapper* je, std::string& res, int* error) override
{ {
return je->checkAndGetScalar(res, error); return je->checkAndGetScalar(res, error);
} }
}; };
string Func_json_value::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, std::string Func_json_value::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull,
execplan::CalpontSystemCatalog::ColType& /*type*/) execplan::CalpontSystemCatalog::ColType& /*type*/)
{ {
string ret; std::string ret;
JSONPathWrapperValue pw; JSONPathWrapperValue pw;
isNull = pw.extract(ret, row, fp[0], fp[1]); isNull = pw.extract(ret, row, fp[0], fp[1]);
return isNull ? "" : ret; return isNull ? "" : ret;

View File

@@ -26,7 +26,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include "rowgroup.h" #include "rowgroup.h"

View File

@@ -202,7 +202,8 @@ inline void get_date_from_mysql_daynr(long daynr, dataconvert::DateTime& dateTim
// else: // else:
// 0 = Monday, 1 = Tuesday, ..., 6 = Sunday // 0 = Monday, 1 = Tuesday, ..., 6 = Sunday
// This is a mirror of calc_weekday, at a later date we should use sql_time.h // This is a mirror of calc_weekday, at a later date we should use sql_time.h
inline uint32_t calc_mysql_weekday(uint32_t year, uint32_t month, uint32_t day, bool sundayFirst, bool& isNull) inline uint32_t calc_mysql_weekday(uint32_t year, uint32_t month, uint32_t day, bool sundayFirst,
bool& isNull)
{ {
if (!dataconvert::isDateValid(day, month, year) || (day == 0 && month == 0 && year == 0)) if (!dataconvert::isDateValid(day, month, year) || (day == 0 && month == 0 && year == 0))
{ {
@@ -642,21 +643,21 @@ inline int dayOfWeek(std::string day) // Sunday = 0
return -1; return -1;
} }
inline string intToString(int64_t i) inline std::string intToString(int64_t i)
{ {
char buf[32]; char buf[32];
snprintf(buf, sizeof(buf), "%" PRId64 "", i); snprintf(buf, sizeof(buf), "%" PRId64 "", i);
return buf; return buf;
} }
inline string uintToString(uint64_t i) inline std::string uintToString(uint64_t i)
{ {
char buf[32]; char buf[32];
snprintf(buf, sizeof(buf), "%" PRIu64 "", i); snprintf(buf, sizeof(buf), "%" PRIu64 "", i);
return buf; return buf;
} }
inline string doubleToString(double d) inline std::string doubleToString(double d)
{ {
// double's can be *really* long to print out. Max mysql // double's can be *really* long to print out. Max mysql
// is e308 so allow for 308 + 36 decimal places minimum. // is e308 so allow for 308 + 36 decimal places minimum.
@@ -665,7 +666,7 @@ inline string doubleToString(double d)
return buf; return buf;
} }
inline string longDoubleToString(long double ld) inline std::string longDoubleToString(long double ld)
{ {
// long double's can be *really* long to print out. Max mysql // long double's can be *really* long to print out. Max mysql
// is e308 so allow for 308 + 36 decimal places minimum. // is e308 so allow for 308 + 36 decimal places minimum.

View File

@@ -30,19 +30,19 @@ static const int NO_WILDCARD_ALLOWED = 1;
Checks if the path has '.*' '[*]' or '**' constructions Checks if the path has '.*' '[*]' or '**' constructions
and sets the NO_WILDCARD_ALLOWED error if the case. and sets the NO_WILDCARD_ALLOWED error if the case.
*/ */
int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const string_view& str, bool wildcards); int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const std::string_view& str, bool wildcards);
// Return true if err occur, let the outer function handle the exception // Return true if err occur, let the outer function handle the exception
bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const utils::NullString& js, bool appendEscapedJS(std::string& ret, const CHARSET_INFO* retCS, const utils::NullString& js,
const CHARSET_INFO* jsCS); const CHARSET_INFO* jsCS);
bool appendJSKeyName(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm); bool appendJSKeyName(std::string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm);
bool appendJSValue(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm); bool appendJSValue(std::string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm);
static const int TAB_SIZE_LIMIT = 8; static const int TAB_SIZE_LIMIT = 8;
static const char tab_arr[TAB_SIZE_LIMIT + 1] = " "; static const char tab_arr[TAB_SIZE_LIMIT + 1] = " ";
// Format the json using format mode // Format the json using format mode
int doFormat(json_engine_t* je, string& niceJS, Func_json_format::FORMATS mode, int tabSize = 4); int doFormat(json_engine_t* je, std::string& niceJS, Func_json_format::FORMATS mode, int tabSize = 4);
static const int SHOULD_END_WITH_ARRAY = 2; static const int SHOULD_END_WITH_ARRAY = 2;
static const int TRIVIAL_PATH_NOT_ALLOWED = 3; static const int TRIVIAL_PATH_NOT_ALLOWED = 3;
@@ -94,13 +94,13 @@ inline void initJSEngine(json_engine_t& jsEg, const CHARSET_INFO* jsCS, const ut
int parseJSPath(JSONPath& path, rowgroup::Row& row, execplan::SPTP& parm, bool wildcards = true); int parseJSPath(JSONPath& path, rowgroup::Row& row, execplan::SPTP& parm, bool wildcards = true);
inline void initJSPaths(vector<JSONPath>& paths, FunctionParm& fp, const int start, const int step) inline void initJSPaths(std::vector<JSONPath>& paths, FunctionParm& fp, const int start, const int step)
{ {
if (paths.empty()) if (paths.empty())
for (size_t i = start; i < fp.size(); i += step) for (size_t i = start; i < fp.size(); i += step)
paths.emplace_back(); paths.emplace_back();
} }
bool matchJSPath(const vector<funcexp::JSONPath>& paths, const json_path_t* p, json_value_types valType, bool matchJSPath(const std::vector<funcexp::JSONPath>& paths, const json_path_t* p, json_value_types valType,
const int* arrayCounter = nullptr, bool exact = true); const int* arrayCounter = nullptr, bool exact = true);
} // namespace funcexp::helpers } // namespace funcexp::helpers

View File

@@ -21,7 +21,7 @@
#include <vector> #include <vector>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <tr1/unordered_map> #include <unordered.h>
#include "../common/simpleallocator.h" #include "../common/simpleallocator.h"
#include "../joblist/elementtype.h" #include "../joblist/elementtype.h"

View File

@@ -124,7 +124,7 @@ class TypelessDataDecoder
void checkAvailableData(uint32_t nbytes) const void checkAvailableData(uint32_t nbytes) const
{ {
if (mPtr + nbytes > mEnd) if (mPtr + nbytes > mEnd)
throw runtime_error("TypelessData is too short"); throw std::runtime_error("TypelessData is too short");
} }
public: public:
@@ -172,7 +172,7 @@ class TypelessDataDecoder
class LongDoubleEq class LongDoubleEq
{ {
public: public:
LongDoubleEq(){}; LongDoubleEq() {};
inline bool operator()(const long double& pos1, const long double& pos2) const inline bool operator()(const long double& pos1, const long double& pos2) const
{ {
return pos1 == pos2; return pos1 == pos2;
@@ -204,7 +204,6 @@ class TypelessDataStructure
} }
}; };
using RowPointersVec = using RowPointersVec =
std::vector<rowgroup::Row::Pointer, allocators::CountingAllocator<rowgroup::Row::Pointer>>; std::vector<rowgroup::Row::Pointer, allocators::CountingAllocator<rowgroup::Row::Pointer>>;
using RowPointersVecUP = std::unique_ptr<RowPointersVec>; using RowPointersVecUP = std::unique_ptr<RowPointersVec>;
@@ -279,7 +278,8 @@ class TupleJoiner
/* ctor to use for string & compound join */ /* ctor to use for string & compound join */
TupleJoiner(const rowgroup::RowGroup& smallInput, const rowgroup::RowGroup& largeInput, TupleJoiner(const rowgroup::RowGroup& smallInput, const rowgroup::RowGroup& largeInput,
const std::vector<uint32_t>& smallJoinColumns, const std::vector<uint32_t>& largeJoinColumns, const std::vector<uint32_t>& smallJoinColumns, const std::vector<uint32_t>& largeJoinColumns,
joblist::JoinType jt, threadpool::ThreadPool* jsThreadPool, joblist::ResourceManager* rm, const uint64_t numCores); joblist::JoinType jt, threadpool::ThreadPool* jsThreadPool, joblist::ResourceManager* rm,
const uint64_t numCores);
~TupleJoiner(); ~TupleJoiner();
@@ -454,7 +454,7 @@ class TupleJoiner
// Wide-DECIMAL JOIN // Wide-DECIMAL JOIN
bool joinHasSkewedKeyColumn(); bool joinHasSkewedKeyColumn();
inline const vector<uint32_t>& getSmallSideColumnsWidths() const inline const std::vector<uint32_t>& getSmallSideColumnsWidths() const
{ {
return smallRG.getColWidths(); return smallRG.getColWidths();
} }
@@ -473,10 +473,11 @@ class TupleJoiner
void initHashMaps(uint32_t& smallJoinColumn); void initHashMaps(uint32_t& smallJoinColumn);
void clearHashMaps(); void clearHashMaps();
private: private:
template<typename K, typename V> template <typename K, typename V>
using HashMapTemplate = std::unordered_multimap<K, V, hasher, std::equal_to<K>, using HashMapTemplate =
utils::STLPoolAllocator<std::pair<const K, V>>>; std::unordered_multimap<K, V, hasher, std::equal_to<K>, utils::STLPoolAllocator<std::pair<const K, V>>>;
using hash_t = HashMapTemplate<int64_t, uint8_t*>; using hash_t = HashMapTemplate<int64_t, uint8_t*>;
using sthash_t = HashMapTemplate<int64_t, rowgroup::Row::Pointer>; using sthash_t = HashMapTemplate<int64_t, rowgroup::Row::Pointer>;
using typelesshash_t = HashMapTemplate<TypelessData, rowgroup::Row::Pointer>; using typelesshash_t = HashMapTemplate<TypelessData, rowgroup::Row::Pointer>;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class corr : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
corr() : mcsv1_UDAF(){}; corr() : mcsv1_UDAF() {};
~corr() override = default; ~corr() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class covar_pop : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
covar_pop() : mcsv1_UDAF(){}; covar_pop() : mcsv1_UDAF() {};
~covar_pop() override = default; ~covar_pop() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class covar_samp : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
covar_samp() : mcsv1_UDAF(){}; covar_samp() : mcsv1_UDAF() {};
~covar_samp() override = default; ~covar_samp() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -24,6 +24,7 @@
#include "columnwidth.h" #include "columnwidth.h"
using namespace mcsv1sdk; using namespace mcsv1sdk;
using namespace std;
// This is the standard way to get a UDAF function into the system's // This is the standard way to get a UDAF function into the system's
// map of UDAF for lookup // map of UDAF for lookup
@@ -104,9 +105,7 @@ mcsv1_UDAF* moda::getImpl(mcsv1Context* context)
case execplan::CalpontSystemCatalog::LONGDOUBLE: data->modaImpl = &moda_impl_longdouble; break; case execplan::CalpontSystemCatalog::LONGDOUBLE: data->modaImpl = &moda_impl_longdouble; break;
case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::VARCHAR:
case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::CHAR: data->modaImpl = &moda_impl_string; break;
data->modaImpl = &moda_impl_string;
break;
default: data->modaImpl = NULL; default: data->modaImpl = NULL;
} }
@@ -368,8 +367,7 @@ void ModaData::serialize(messageqcpp::ByteStream& bs) const
case execplan::CalpontSystemCatalog::DOUBLE: serializeMap<double>(bs); break; case execplan::CalpontSystemCatalog::DOUBLE: serializeMap<double>(bs); break;
case execplan::CalpontSystemCatalog::LONGDOUBLE: serializeMap<long double>(bs); break; case execplan::CalpontSystemCatalog::LONGDOUBLE: serializeMap<long double>(bs); break;
case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::VARCHAR: serializeMap<string>(bs); break;
serializeMap<string>(bs); break;
default: throw std::runtime_error("ModaData::serialize with bad data type"); break; default: throw std::runtime_error("ModaData::serialize with bad data type"); break;
} }
} }
@@ -408,8 +406,7 @@ void ModaData::unserialize(messageqcpp::ByteStream& bs)
case execplan::CalpontSystemCatalog::DOUBLE: unserializeMap<double>(bs); break; case execplan::CalpontSystemCatalog::DOUBLE: unserializeMap<double>(bs); break;
case execplan::CalpontSystemCatalog::LONGDOUBLE: unserializeMap<long double>(bs); break; case execplan::CalpontSystemCatalog::LONGDOUBLE: unserializeMap<long double>(bs); break;
case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::VARCHAR: unserializeMap<string>(bs); break;
unserializeMap<string>(bs); break;
default: throw std::runtime_error("ModaData::unserialize with bad data type"); break; default: throw std::runtime_error("ModaData::unserialize with bad data type"); break;
} }
} }
@@ -503,7 +500,7 @@ void ModaData::cleanup()
/************************************************************************************************ /************************************************************************************************
* String Specialization * String Specialization
************************************************************************************************/ ************************************************************************************************/
mcsv1_UDAF::ReturnCode Moda_impl_T<string>::init(mcsv1Context* context, ColumnDatum* /*colTypes*/) mcsv1_UDAF::ReturnCode Moda_impl_T<string>::init(mcsv1Context* context, ColumnDatum* /*colTypes*/)
{ {
@@ -524,7 +521,7 @@ mcsv1_UDAF::ReturnCode Moda_impl_T<string>::reset(mcsv1Context* context)
mcsv1_UDAF::ReturnCode Moda_impl_T<string>::nextValue(mcsv1Context* context, ColumnDatum* valsIn) mcsv1_UDAF::ReturnCode Moda_impl_T<string>::nextValue(mcsv1Context* context, ColumnDatum* valsIn)
{ {
static_any::any& valIn = valsIn[0].columnData; static_any::any& valIn = valsIn[0].columnData;
ModaData* data = static_cast<ModaData*>(context->getUserData()); ModaData* data = static_cast<ModaData*>(context->getUserData());
std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* map = data->getMap<string>(); std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* map = data->getMap<string>();
if (valIn.empty()) if (valIn.empty())
@@ -554,9 +551,10 @@ mcsv1_UDAF::ReturnCode Moda_impl_T<string>::subEvaluate(mcsv1Context* context, c
} }
ModaData* outData = static_cast<ModaData*>(context->getUserData()); ModaData* outData = static_cast<ModaData*>(context->getUserData());
const ModaData* inData = static_cast<const ModaData*>(userDataIn); const ModaData* inData = static_cast<const ModaData*>(userDataIn);
std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* outMap = outData->getMap<string>(); std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* outMap =
std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* inMap = inData->getMap<string>(); outData->getMap<string>();
std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* inMap = inData->getMap<string>();
typename std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >::const_iterator iter; typename std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >::const_iterator iter;
for (iter = inMap->begin(); iter != inMap->end(); ++iter) for (iter = inMap->begin(); iter != inMap->end(); ++iter)
@@ -615,7 +613,7 @@ mcsv1_UDAF::ReturnCode Moda_impl_T<string>::dropValue(mcsv1Context* context, Col
{ {
static_any::any& valDropped = valsDropped[0].columnData; static_any::any& valDropped = valsDropped[0].columnData;
ModaData* data = static_cast<ModaData*>(context->getUserData()); ModaData* data = static_cast<ModaData*>(context->getUserData());
std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* map = data->getMap<string>(); std::unordered_map<string, uint32_t, hasher<string>, comparator<string> >* map = data->getMap<string>();
if (valDropped.empty()) if (valDropped.empty())
{ {
@@ -630,5 +628,3 @@ mcsv1_UDAF::ReturnCode Moda_impl_T<string>::dropValue(mcsv1Context* context, Col
return mcsv1_UDAF::SUCCESS; return mcsv1_UDAF::SUCCESS;
} }

View File

@@ -91,12 +91,12 @@ struct hasher<long double>
// A collation aware hasher for strings // A collation aware hasher for strings
template <> template <>
struct hasher<string> struct hasher<std::string>
{ {
explicit hasher(uint32_t cs_num) : fHasher(cs_num) explicit hasher(uint32_t cs_num) : fHasher(cs_num)
{ {
} }
inline size_t operator()(string val) const inline size_t operator()(std::string val) const
{ {
return fHasher(val.c_str(), val.size()); return fHasher(val.c_str(), val.size());
} }
@@ -273,7 +273,7 @@ class Moda_impl_T : public mcsv1_UDAF
}; };
template <> // string specialization template <> // string specialization
class Moda_impl_T<string> : public mcsv1_UDAF class Moda_impl_T<std::string> : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
@@ -357,7 +357,7 @@ class moda : public mcsv1_UDAF
Moda_impl_T<float> moda_impl_float; Moda_impl_T<float> moda_impl_float;
Moda_impl_T<double> moda_impl_double; Moda_impl_T<double> moda_impl_double;
Moda_impl_T<long double> moda_impl_longdouble; Moda_impl_T<long double> moda_impl_longdouble;
Moda_impl_T<string> moda_impl_string; Moda_impl_T<std::string> moda_impl_string;
}; };
}; // namespace mcsv1sdk }; // namespace mcsv1sdk

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -59,7 +59,7 @@ class regr_avgx : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_avgx() : mcsv1_UDAF(){}; regr_avgx() : mcsv1_UDAF() {};
~regr_avgx() override = default; ~regr_avgx() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_avgy : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_avgy() : mcsv1_UDAF(){}; regr_avgy() : mcsv1_UDAF() {};
~regr_avgy() override = default; ~regr_avgy() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_count : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_count() : mcsv1_UDAF(){}; regr_count() : mcsv1_UDAF() {};
~regr_count() override = default; ~regr_count() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_intercept : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_intercept() : mcsv1_UDAF(){}; regr_intercept() : mcsv1_UDAF() {};
~regr_intercept() override = default; ~regr_intercept() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_r2 : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_r2() : mcsv1_UDAF(){}; regr_r2() : mcsv1_UDAF() {};
~regr_r2() override = default; ~regr_r2() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_slope : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_slope() : mcsv1_UDAF(){}; regr_slope() : mcsv1_UDAF() {};
~regr_slope() override = default; ~regr_slope() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_sxx : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_sxx() : mcsv1_UDAF(){}; regr_sxx() : mcsv1_UDAF() {};
~regr_sxx() override = default; ~regr_sxx() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_sxy : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_sxy() : mcsv1_UDAF(){}; regr_sxy() : mcsv1_UDAF() {};
~regr_sxy() override = default; ~regr_sxy() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -33,7 +33,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -49,7 +49,7 @@ class regr_syy : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
regr_syy() : mcsv1_UDAF(){}; regr_syy() : mcsv1_UDAF() {};
~regr_syy() override = default; ~regr_syy() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -3,10 +3,11 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <string.h> #include <string.h>
using namespace std;
#include "idb_mysql.h" #include "idb_mysql.h"
using namespace std;
namespace namespace
{ {
inline bool isNumeric(int type, const char* attr) inline bool isNumeric(int type, const char* attr)

View File

@@ -32,8 +32,8 @@
#include <cstdint> #include <cstdint>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include <tr1/unordered_set>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>

View File

@@ -26,7 +26,7 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <tr1/unordered_map> #include <unordered.h>
#ifndef NDEBUG #ifndef NDEBUG
#define NDEBUG #define NDEBUG
@@ -239,16 +239,12 @@ again:
} }
catch (std::exception& ex) catch (std::exception& ex)
{ {
cerr << cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception: " << ex.what() << endl;
__PRETTY_FUNCTION__ <<
":" << __LINE__ << ": caught an exception: " << ex.what() << endl;
throw; throw;
} }
catch (...) catch (...)
{ {
cerr << cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception" << endl;
__PRETTY_FUNCTION__ <<
":" << __LINE__ << ": caught an exception" << endl;
throw runtime_error("RWLock::down(): caught an exception"); throw runtime_error("RWLock::down(): caught an exception");
} }
} }
@@ -293,16 +289,12 @@ again:
} }
catch (std::exception& ex) catch (std::exception& ex)
{ {
cerr << cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception: " << ex.what() << endl;
__PRETTY_FUNCTION__ <<
":" << __LINE__ << ": caught an exception: " << ex.what() << endl;
throw; throw;
} }
catch (...) catch (...)
{ {
cerr << cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception" << endl;
__PRETTY_FUNCTION__ <<
":" << __LINE__ << ": caught an exception" << endl;
throw runtime_error("RWLock::timed_down(): caught an exception"); throw runtime_error("RWLock::timed_down(): caught an exception");
} }

View File

@@ -28,7 +28,7 @@
using namespace idbdatafile; using namespace idbdatafile;
using namespace logging; using namespace logging;
using namespace std;
namespace statistics namespace statistics
{ {
StatisticsManager* StatisticsManager::instance() StatisticsManager* StatisticsManager::instance()

View File

@@ -47,7 +47,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -70,7 +70,7 @@ class allnull : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
allnull() : mcsv1_UDAF(){}; allnull() : mcsv1_UDAF() {};
~allnull() override = default; ~allnull() override = default;
/** /**

View File

@@ -55,7 +55,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -101,7 +101,7 @@ class avg_mode : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
avg_mode() : mcsv1_UDAF(){}; avg_mode() : mcsv1_UDAF() {};
~avg_mode() override = default; ~avg_mode() override = default;
/** /**

View File

@@ -34,7 +34,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -60,7 +60,7 @@ class avgx : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
avgx() : mcsv1_UDAF(){}; avgx() : mcsv1_UDAF() {};
~avgx() override = default; ~avgx() override = default;
ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override;

View File

@@ -67,7 +67,8 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <tr1/unordered_map> #include <unordered.h>
#include "any.hpp" #include "any.hpp"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
#include "wf_frame.h" #include "wf_frame.h"

View File

@@ -55,7 +55,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -101,7 +101,7 @@ class median : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
median() : mcsv1_UDAF(){}; median() : mcsv1_UDAF() {};
~median() override = default; ~median() override = default;
/** /**

View File

@@ -55,7 +55,7 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include <vector> #include <vector>
#include <tr1/unordered_map> #include <unordered.h>
#include "mcsv1_udaf.h" #include "mcsv1_udaf.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@@ -80,7 +80,7 @@ class ssq : public mcsv1_UDAF
{ {
public: public:
// Defaults OK // Defaults OK
ssq() : mcsv1_UDAF(){}; ssq() : mcsv1_UDAF() {};
~ssq() override = default; ~ssq() override = default;
/** /**

Some files were not shown because too many files have changed in this diff Show More