diff --git a/.drone.jsonnet b/.drone.jsonnet index 4971389ea..a2697c330 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -11,9 +11,9 @@ local platforms = { [current_branch]: ["rockylinux:8", "rockylinux:9", "debian:12", "ubuntu:22.04", "ubuntu:24.04"], }; -local platforms_arm = { - [current_branch]: ["rockylinux:8", "rockylinux:9", "debian:12", "ubuntu:22.04", "ubuntu:24.04"], -}; + +//local archs = ["amd64", "arm64"]; +local archs = ["amd64"]; local builddir = "verylongdirnameforverystrangecpackbehavior"; @@ -95,7 +95,7 @@ local make_clickable_link(link) = "echo -e '\\e]8;;" + link + "\\e\\\\" + link local echo_running_on = ["echo running on ${DRONE_STAGE_MACHINE}", make_clickable_link("https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#Instances:search=:${DRONE_STAGE_MACHINE};v=3;$case=tags:true%5C,client:false;$regex=tags:false%5C,client:false;sort=desc:launchTime")]; -local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", customBootstrapParamsKey="", customBuildEnvCommandsMapKey="") = { +local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", customBootstrapParamsKey="", customBuildEnvCommandsMapKey="", ignoreFailureStepList=[]) = { local pkg_format = if (std.split(platform, ":")[0] == "rockylinux") then "rpm" else "deb", local img = if (platform == "rockylinux:8") then platform else "detravi/" + std.strReplace(platform, "/", "-"), local branch_ref = if (branch == any_branch) then current_branch else branch, @@ -206,7 +206,9 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", " --docker-image " + img + " --result-path " + result + " --packages-url " + packages_url + - " --do-setup " + std.toString(do_setup) + '"', + " --do-setup " + std.toString(do_setup) + + (if result=="ubuntu24.04_clang-20_libcpp" then " --install-libcpp " else "") + + '"', local reportTestStage(containerName, result, stage) = 'sh -c "apk add bash && ' + get_build_command("report_test_stage.sh") + @@ -311,6 +313,8 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", ' --suite-list $${MTR_SUITE_LIST}' + ' --triggering-event ' + event, ], + [if (std.member(ignoreFailureStepList, "mtr")) then "failure"]: "ignore", + }, mtrlog:: { name: "mtrlog", @@ -323,8 +327,10 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", when: { status: ["success", "failure"], }, + [if (std.member(ignoreFailureStepList, "mtr")) then "failure"]: "ignore", + }, - regression(name, depends_on):: { + regression(name, depends_on, ):: { name: name, depends_on: depends_on, image: "docker:git", @@ -332,7 +338,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", when: { status: ["success", "failure"], }, - [if (name != "test000.sh" && name != "test001.sh") then "failure"]: "ignore", + [if (std.member(ignoreFailureStepList, name) || std.member(ignoreFailureStepList, "regression")) then "failure"]: "ignore", environment: { REGRESSION_TIMEOUT: { from_secret: "regression_timeout", @@ -357,6 +363,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", " --regression-branch $$REGRESSION_REF" + " --regression-timeout $${REGRESSION_TIMEOUT}", ], + }, regressionlog:: { name: "regressionlog", @@ -369,6 +376,8 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", when: { status: ["success", "failure"], }, + [if (std.member(ignoreFailureStepList, "regression")) then "failure"]: "ignore", + }, dockerfile:: { name: "dockerfile", @@ -396,7 +405,6 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", dockerhub:: { name: "dockerhub", depends_on: ["dockerfile"], - //failure: 'ignore', image: "plugins/docker", environment: { VERSION: container_version, @@ -626,6 +634,61 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise", }, }; + +local AllPipelines = [ + Pipeline(b, p, e, a, s) + for b in std.objectFields(platforms) + for p in platforms[b] + for s in servers[b] + for e in events + for a in archs +] + +[ + Pipeline(any_branch, p, "custom", a, server) + for p in platforms[current_branch] + for server in servers[current_branch] + for a in archs +] + +[ + Pipeline(b, platform, triggeringEvent, a, server, "", buildenv) + for a in ["amd64"] + for b in std.objectFields(platforms) + for platform in ["ubuntu:24.04"] + for buildenv in std.objectFields(customEnvCommandsMap) + for triggeringEvent in events + for server in servers[current_branch] +] + +// last argument is to ignore mtr and regression failures +[ + Pipeline(b, platform, triggeringEvent, a, server, flag, envcommand, ["regression", "mtr"]) + for a in ["amd64"] + for b in std.objectFields(platforms) + for platform in ["ubuntu:24.04"] + for flag in ["libcpp"] + for envcommand in ["clang-20"] + for triggeringEvent in events + for server in servers[current_branch] +] + +// last argument is to ignore mtr and regression failures +[ + Pipeline(b, platform, triggeringEvent, a, server, flag, "", ["regression", "mtr"]) + for a in ["amd64"] + for b in std.objectFields(platforms) + for platform in ["ubuntu:24.04"] + for flag in ["ASan", "UBSan"] + for triggeringEvent in events + for server in servers[current_branch] +] + +[ + Pipeline(b, platform, triggeringEvent, a, server, flag, "") + for a in ["amd64"] + for b in std.objectFields(platforms) + for platform in ["rockylinux:8"] + for flag in ["gcc-toolset"] + for triggeringEvent in events + for server in servers[current_branch] +]; + local FinalPipeline(branch, event) = { kind: "pipeline", name: std.join(" ", ["after", branch, event]), @@ -650,55 +713,13 @@ local FinalPipeline(branch, event) = { "failure", ], } + (if event == "cron" then { cron: ["nightly-" + std.strReplace(branch, ".", "-")] } else {}), - depends_on: std.map(function(p) std.join(" ", [branch, p, event, "amd64", "10.6-enterprise", "", ""]), platforms[current_branch]), - // +std.map(function(p) std.join(" ", [branch, p, event, "arm64", "10.6-enterprise", "", ""]), platforms_arm.develop), + depends_on: std.map(function(p) p.name, AllPipelines), }; -[ - Pipeline(b, p, e, "amd64", s) - for b in std.objectFields(platforms) - for p in platforms[b] - for s in servers[b] - for e in events -] + -// [ -// Pipeline(b, p, e, "arm64", s) -// for b in std.objectFields(platforms_arm) -// for p in platforms_arm[b] -// for s in servers[b] -// for e in events -// ] + + +AllPipelines + [ FinalPipeline(b, "cron") for b in std.objectFields(platforms) -] + - -[ - Pipeline(any_branch, p, "custom", "amd64", "10.6-enterprise") - for p in platforms[current_branch] -] + -// [ -// Pipeline(any_branch, p, "custom", "arm64", "10.6-enterprise") -// for p in platforms_arm[current_branch]; -// ] -// + -[ - Pipeline(b, platform, triggeringEvent, a, server, "", buildenv) - for a in ["amd64"] - for b in std.objectFields(platforms) - for platform in ["ubuntu:24.04"] - for buildenv in std.objectFields(customEnvCommandsMap) - for triggeringEvent in events - for server in servers[current_branch] -] -+ -[ - Pipeline(b, platform, triggeringEvent, a, server, flag, "") - for a in ["amd64"] - for b in std.objectFields(platforms) - for platform in ["rockylinux:8"] - for flag in ["gcc-toolset"] - for triggeringEvent in events - for server in servers[current_branch] ] diff --git a/build/bootstrap_mcs.sh b/build/bootstrap_mcs.sh index 902a14455..60474c38b 100755 --- a/build/bootstrap_mcs.sh +++ b/build/bootstrap_mcs.sh @@ -32,7 +32,7 @@ source "$SCRIPT_LOCATION"/utils.sh 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=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 @@ -44,7 +44,9 @@ 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=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=M long=skip-smoke desc="Skip final smoke test" variable=SKIP_SMOKE default=false value=true +optparse.define short=L long=libcpp desc="Build with libc++" variable=WITH_LIBCPP 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=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 @@ -55,9 +57,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=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=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=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=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 @@ -397,6 +399,16 @@ construct_cmake_flags() { MDB_CMAKE_FLAGS+=(-DWITH_UBSAN=ON -DWITH_COLUMNSTORE_REPORT_PATH=${REPORT_PATH}) fi + if [[ $MSAN = true ]]; then + warn "Building with Memory Sanitizer" + MDB_CMAKE_FLAGS+=(-DWITH_MSAN=ON -DCOLUMNSTORE_WITH_LIBCPP=YES -DWITH_COLUMNSTORE_REPORT_PATH=${REPORT_PATH}) + fi + + if [[ $WITH_LIBCPP = true ]]; then + warn "Building with libc++" + MDB_CMAKE_FLAGS+=(-DCOLUMNSTORE_WITH_LIBCPP=YES) + fi + if [[ $WITHOUT_COREDUMPS = true ]]; then warn "Cores are not dumped" else @@ -794,6 +806,7 @@ init_submodules if [[ $BUILD_PACKAGES = true ]]; then modify_packaging fix_config_files + (build_package && run_unit_tests) exit_code=$? diff --git a/build/createrepo.sh b/build/createrepo.sh index 03c1b89c1..7e1db274d 100755 --- a/build/createrepo.sh +++ b/build/createrepo.sh @@ -47,6 +47,7 @@ if [[ $(compgen -G "$COLUMNSTORE_RPM_PACKAGES_PATH") ]]; then elif [[ $(compgen -G "$COLUMNSTORE_DEB_PACKAGES_PATH") ]]; then mv -v $COLUMNSTORE_DEB_PACKAGES_PATH "./${RESULT}/" mv -v $COLUMNSTORE_DEBUG_DEB_PACKAGES_PATH "./${RESULT}/" || true + # debian 12 produces debug packages as *.deb else echo "Columnstore packages are not found!" fi diff --git a/build/prepare_test_container.sh b/build/prepare_test_container.sh index 1f1258029..3fb0572fe 100755 --- a/build/prepare_test_container.sh +++ b/build/prepare_test_container.sh @@ -15,6 +15,8 @@ optparse.define short=i long=docker-image desc="Docker image name to start conta optparse.define short=r long=result-path desc="Name suffix used in core dump file path" variable=RESULT optparse.define short=s long=do-setup desc="Run setup-repo.sh inside the container" variable=DO_SETUP optparse.define short=u long=packages-url desc="Packages url" variable=PACKAGES_URL +optparse.define short=l long=install-libcpp desc="Install libcpp" variable=INSTALL_LIBCPP default=false value=true + source $(optparse.build) if [[ "$EUID" -ne 0 ]]; then @@ -103,6 +105,15 @@ prepare_container() { execInnerDocker "$CONTAINER_NAME" '/setup-repo.sh' fi + # FIX THIS HACK + if [[ "$INSTALL_LIBCPP" == "true" ]]; then + docker cp "$COLUMNSTORE_SOURCE_PATH"/build/install_clang_deb.sh "$CONTAINER_NAME":/ + docker cp "$COLUMNSTORE_SOURCE_PATH"/build/install_libc++.sh "$CONTAINER_NAME":/ + + execInnerDocker "$CONTAINER_NAME" '/install_clang_deb.sh 20' + execInnerDocker "$CONTAINER_NAME" '/install_libc++.sh 20' + fi + # install deps if [[ "$RESULT" == *rocky* ]]; then execInnerDockerWithRetry "$CONTAINER_NAME" 'yum --nobest update -y && yum --nobest install -y cracklib-dicts diffutils elfutils epel-release expect findutils iproute gawk gcc-c++ gdb hostname lz4 patch perl procps-ng rsyslog sudo tar wget which' diff --git a/build/update-clang-version.sh b/build/update-clang-version.sh old mode 100644 new mode 100755 diff --git a/cmake/boost.cmake b/cmake/boost.cmake index f9b052f18..d8379858f 100644 --- a/cmake/boost.cmake +++ b/cmake/boost.cmake @@ -15,6 +15,8 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(_toolset "intel-linux") endif() +message("${_toolset} will be used for Boost compilation with compiler ${CMAKE_CXX_COMPILER_ID}") + set(INSTALL_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/.boost/boost-lib) set(BOOST_ROOT "${INSTALL_LOCATION}") set(Boost_INCLUDE_DIRS "${INSTALL_LOCATION}/include") @@ -22,8 +24,18 @@ set(Boost_LIBRARY_DIRS "${INSTALL_LOCATION}/lib") link_directories("${Boost_LIBRARY_DIRS}") set(_cxxargs "-fPIC -DBOOST_NO_AUTO_PTR -fvisibility=default") +set(_linkflags "") + +if(WITH_MSAN) + set(_cxxargs "${_cxxargs} -fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE") + set(_linkflags "-stdlib=libc++") +elseif(COLUMNSTORE_WITH_LIBCPP) + set(_cxxargs "${_cxxargs} -stdlib=libc++") + set(_linkflags "-stdlib=libc++") +endif() + 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} linkflags=${_linkflags} ) set(byproducts) @@ -48,8 +60,7 @@ ExternalProject_Add( BUILD_COMMAND ./b2 -q ${_b2args} BUILD_IN_SOURCE TRUE INSTALL_COMMAND ./b2 -q install ${_b2args} - #LOG_BUILD TRUE - #LOG_INSTALL TRUE + # LOG_BUILD TRUE LOG_INSTALL TRUE EXCLUDE_FROM_ALL TRUE ${byproducts} ) diff --git a/cmake/compiler_flags.cmake b/cmake/compiler_flags.cmake index 6a0b7e66f..f33e7da73 100644 --- a/cmake/compiler_flags.cmake +++ b/cmake/compiler_flags.cmake @@ -59,6 +59,9 @@ set(FLAGS_ALL -DHAVE_CONFIG_H -DBOOST_BIND_GLOBAL_PLACEHOLDERS ) +if(COLUMNSTORE_WITH_LIBCPP) + list(APPEND FLAGS_ALL -stdlib=libc++) +endif() set(FLAGS_RELEASE -O3 -DDBUG_OFF) diff --git a/cmake/thrift.cmake b/cmake/thrift.cmake index 10763e8ac..514e590ac 100644 --- a/cmake/thrift.cmake +++ b/cmake/thrift.cmake @@ -33,6 +33,17 @@ set(THRIFT_INCLUDE_DIRS "${INSTALL_LOCATION}/include") set(THRIFT_LIBRARY_DIRS "${INSTALL_LOCATION}/lib") set(THRIFT_LIBRARY ${THRIFT_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}thrift${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(cxxflags -fPIC) + +set(linkflags "") +if(WITH_MSAN) + set(cxxflags "'${cxxflags} -fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE -stdlib=libc++'") + set(linkflags "'${linkflags} -stdlib=libc++'") +elseif(COLUMNSTORE_WITH_LIBCPP) + set(cxxflags "'${cxxflags} -stdlib=libc++'") + set(linkflags "'${linkflags} -stdlib=libc++'") +endif() + ExternalProject_Add( external_thrift URL https://github.com/apache/thrift/archive/refs/tags/v0.22.0.tar.gz @@ -49,8 +60,14 @@ ExternalProject_Add( -DBUILD_PYTHON=NO -DBUILD_TESTING=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} + -DCMAKE_EXE_LINKER_FLAGS=${linkflags} + -DCMAKE_SHARED_LINKER_FLAGS=${linkflags} + -DCMAKE_MODULE_LINKER_FLAGS=${linkflags} BUILD_BYPRODUCTS "${THRIFT_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}thrift${CMAKE_STATIC_LIBRARY_SUFFIX}" EXCLUDE_FROM_ALL TRUE ) diff --git a/core_dumps/core_dump_format.sh b/core_dumps/core_dump_format.sh index 95c792904..3dc5fdc23 100755 --- a/core_dumps/core_dump_format.sh +++ b/core_dumps/core_dump_format.sh @@ -11,7 +11,7 @@ STEP_NAME=$5 save_ansi_to_html() { echo "

$1

" >>"${FILENAME}" - cat "$DUMPNAME" | bash "${SCRIPT_LOCATION}"/ansi2html.sh --palette=solarized >>"${FILENAME}" + cat "$DUMPNAME" | bash "${SCRIPT_LOCATION}"/ansi2html.sh --bg=dark --palette=tango >>"${FILENAME}" } invoke_gdb_command() { diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index 4941be977..face4efdb 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -19,18 +19,18 @@ #include #include #include -#include #include #include #include #include -#include + #include #include using namespace std; #include +#include #include "dataconvert.h" using namespace dataconvert; diff --git a/datatypes/mcs_datatype.h b/datatypes/mcs_datatype.h index e5abe1112..0d8706c91 100644 --- a/datatypes/mcs_datatype.h +++ b/datatypes/mcs_datatype.h @@ -35,8 +35,6 @@ typedef int32_t mcs_sint32_t; struct charset_info_st; typedef const struct charset_info_st CHARSET_INFO; -using namespace std; // e.g. string - namespace ddlpackage { struct ColumnType; @@ -1019,8 +1017,8 @@ class TypeHandler static const TypeHandler* find_by_ddltype(const ddlpackage::ColumnType& ct); virtual ~TypeHandler() = default; - virtual const string& name() const = 0; - virtual const string print(const SystemCatalog::TypeAttributesStd& /*attr*/) const + virtual const std::string& name() const = 0; + virtual const std::string print(const SystemCatalog::TypeAttributesStd& /*attr*/) const { return name(); } @@ -1062,10 +1060,10 @@ class TypeHandler virtual MinMaxPartitionInfo getExtentPartitionInfo(const SystemCatalog::TypeAttributesStd& attr, BRM::DBRM& em, const BRM::EMEntry& entry, int* state) const; - virtual string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const + virtual std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const { return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1086,7 +1084,7 @@ class TypeHandler // QQ: perhaps not needed yet class TypeHandlerBit : public TypeHandler { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::BIT; @@ -1155,7 +1153,7 @@ class TypeHandlerInt : public TypeHandler class TypeHandlerSInt8 : public TypeHandlerInt { public: - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::TINYINT; @@ -1202,7 +1200,7 @@ class TypeHandlerSInt8 : public TypeHandlerInt class TypeHandlerSInt16 : public TypeHandlerInt { public: - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::SMALLINT; @@ -1248,7 +1246,7 @@ class TypeHandlerSInt16 : public TypeHandlerInt class TypeHandlerSInt24 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::MEDINT; @@ -1297,7 +1295,7 @@ class TypeHandlerSInt24 : public TypeHandlerInt class TypeHandlerSInt32 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::INT; @@ -1346,7 +1344,7 @@ class TypeHandlerSInt32 : public TypeHandlerInt class TypeHandlerSInt64 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::BIGINT; @@ -1392,7 +1390,7 @@ class TypeHandlerSInt64 : public TypeHandlerInt class TypeHandlerUInt8 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::UTINYINT; @@ -1435,10 +1433,10 @@ class TypeHandlerUInt8 : public TypeHandlerInt { return MinMaxInfo::widenUInt64(a, b); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1457,7 +1455,7 @@ class TypeHandlerUInt8 : public TypeHandlerInt class TypeHandlerUInt16 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::USMALLINT; @@ -1499,10 +1497,10 @@ class TypeHandlerUInt16 : public TypeHandlerInt { return MinMaxInfo::widenUInt64(a, b); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1521,7 +1519,7 @@ class TypeHandlerUInt16 : public TypeHandlerInt class TypeHandlerUInt24 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::UMEDINT; @@ -1566,10 +1564,10 @@ class TypeHandlerUInt24 : public TypeHandlerInt { return MinMaxInfo::widenUInt64(a, b); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1588,7 +1586,7 @@ class TypeHandlerUInt24 : public TypeHandlerInt class TypeHandlerUInt32 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::UINT; @@ -1633,10 +1631,10 @@ class TypeHandlerUInt32 : public TypeHandlerInt { return MinMaxInfo::widenUInt64(a, b); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1655,7 +1653,7 @@ class TypeHandlerUInt32 : public TypeHandlerInt class TypeHandlerUInt64 : public TypeHandlerInt { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::BIGINT; @@ -1697,10 +1695,10 @@ class TypeHandlerUInt64 : public TypeHandlerInt { return MinMaxInfo::widenUInt64(a, b); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValueUInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1739,9 +1737,10 @@ class TypeHandlerXDecimal : public TypeHandler const BRM::EMEntry& entry, int* state) const; MinMaxPartitionInfo getExtentPartitionInfo128(const SystemCatalog::TypeAttributesStd& attr, BRM::DBRM& em, const BRM::EMEntry& entry, int* state) const; - string PrintPartitionValue128(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, round_style_t rfMax) const; + std::string PrintPartitionValue128(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const; public: size_t ColWriteBatch(WriteBatchField* field, const unsigned char* buf, bool nullVal, @@ -1760,7 +1759,7 @@ class TypeHandlerXDecimal : public TypeHandler class TypeHandlerSDecimal64 : public TypeHandlerXDecimal { public: - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::DECIMAL; @@ -1804,10 +1803,10 @@ class TypeHandlerSDecimal64 : public TypeHandlerXDecimal { return getExtentPartitionInfo64(attr, em, entry, state); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1826,7 +1825,7 @@ class TypeHandlerSDecimal64 : public TypeHandlerXDecimal class TypeHandlerUDecimal64 : public TypeHandlerXDecimal { public: - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::UDECIMAL; @@ -1870,10 +1869,10 @@ class TypeHandlerUDecimal64 : public TypeHandlerXDecimal { return getExtentPartitionInfo64(attr, em, entry, state); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValueSInt64(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1892,7 +1891,7 @@ class TypeHandlerUDecimal64 : public TypeHandlerXDecimal class TypeHandlerSDecimal128 : public TypeHandlerXDecimal { public: - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::DECIMAL; @@ -1936,10 +1935,10 @@ class TypeHandlerSDecimal128 : public TypeHandlerXDecimal { return getExtentPartitionInfo128(attr, em, entry, state); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValue128(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -1958,7 +1957,7 @@ class TypeHandlerSDecimal128 : public TypeHandlerXDecimal class TypeHandlerUDecimal128 : public TypeHandlerXDecimal { public: - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::UDECIMAL; @@ -2002,10 +2001,10 @@ class TypeHandlerUDecimal128 : public TypeHandlerXDecimal { return getExtentPartitionInfo128(attr, em, entry, state); } - string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, - const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, - round_style_t rfMin, const SimpleValue& endVal, - round_style_t rfMax) const override + std::string PrintPartitionValue(const SystemCatalog::TypeAttributesStd& attr, + const MinMaxPartitionInfo& partInfo, const SimpleValue& startVal, + round_style_t rfMin, const SimpleValue& endVal, + round_style_t rfMax) const override { return PrintPartitionValue128(attr, partInfo, startVal, rfMin, endVal, rfMax); } @@ -2043,7 +2042,7 @@ class TypeHandlerReal : public TypeHandler class TypeHandlerSFloat : public TypeHandlerReal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::FLOAT; @@ -2071,7 +2070,7 @@ class TypeHandlerSFloat : public TypeHandlerReal class TypeHandlerSDouble : public TypeHandlerReal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::DOUBLE; @@ -2099,7 +2098,7 @@ class TypeHandlerSDouble : public TypeHandlerReal class TypeHandlerUFloat : public TypeHandlerReal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::UFLOAT; @@ -2127,7 +2126,7 @@ class TypeHandlerUFloat : public TypeHandlerReal class TypeHandlerUDouble : public TypeHandlerReal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::UDOUBLE; @@ -2155,7 +2154,7 @@ class TypeHandlerUDouble : public TypeHandlerReal class TypeHandlerSLongDouble : public TypeHandlerReal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::LONGDOUBLE; @@ -2219,14 +2218,14 @@ class TypeHandlerStr : public TypeHandler class TypeHandlerChar : public TypeHandlerStr { - const string& name() const override; + const std::string& name() const override; code_t code() const override { 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 << ")"; return oss.str(); } @@ -2256,14 +2255,14 @@ class TypeHandlerChar : public TypeHandlerStr class TypeHandlerVarchar : public TypeHandlerStr { - const string& name() const override; + const std::string& name() const override; code_t code() const override { 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 << ")"; return oss.str(); } @@ -2297,7 +2296,7 @@ class TypeHandlerVarchar : public TypeHandlerStr class TypeHandlerVarbinary : public TypeHandlerStr { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::VARBINARY; @@ -2317,7 +2316,7 @@ class TypeHandlerVarbinary : public TypeHandlerStr class TypeHandlerBlob : public TypeHandlerStr { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::BLOB; @@ -2344,7 +2343,7 @@ class TypeHandlerBlob : public TypeHandlerStr class TypeHandlerText : public TypeHandlerStr { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::TEXT; @@ -2374,7 +2373,7 @@ class TypeHandlerText : public TypeHandlerStr class TypeHandlerClob : public TypeHandlerStr { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::CLOB; @@ -2423,7 +2422,7 @@ class TypeHandlerTemporal : public TypeHandler class TypeHandlerDate : public TypeHandlerTemporal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::DATE; @@ -2449,7 +2448,7 @@ class TypeHandlerDate : public TypeHandlerTemporal class TypeHandlerDatetime : public TypeHandlerTemporal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::DATETIME; @@ -2475,7 +2474,7 @@ class TypeHandlerDatetime : public TypeHandlerTemporal class TypeHandlerTime : public TypeHandlerTemporal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::TIME; @@ -2501,7 +2500,7 @@ class TypeHandlerTime : public TypeHandlerTemporal class TypeHandlerTimestamp : public TypeHandlerTemporal { - const string& name() const override; + const std::string& name() const override; code_t code() const override { return SystemCatalog::TIMESTAMP; diff --git a/datatypes/unordered.h b/datatypes/unordered.h new file mode 100644 index 000000000..9027212b0 --- /dev/null +++ b/datatypes/unordered.h @@ -0,0 +1,23 @@ +#pragma once + +#if (_LIBCPP_VERSION) +#include +#include +#pragma message("libcpp do not support tr1, so we are using std::unordered_[set|map] instead") +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 +#pragma message("Using std::tr1::unordered_[set|map]") + +#include +#include +#endif \ No newline at end of file diff --git a/dbcon/execplan/calpontselectexecutionplan.h b/dbcon/execplan/calpontselectexecutionplan.h index e9425ed45..9e540b9ba 100644 --- a/dbcon/execplan/calpontselectexecutionplan.h +++ b/dbcon/execplan/calpontselectexecutionplan.h @@ -801,7 +801,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan * Return a string rep of the CSEP * @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; /** @brief Is this an internal query? @@ -968,7 +968,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan uint32_t fDJSMaxPartitionTreeDepth = 8; bool fDJSForceRun = false; uint32_t fMaxPmJoinResultCount = 1048576; - int64_t fUMMemLimit = numeric_limits::max(); + int64_t fUMMemLimit = std::numeric_limits::max(); bool fIsDML = false; long fTimeZone = 0; std::vector fDynamicParseTreeVec; diff --git a/dbcon/execplan/groupconcatcolumn.h b/dbcon/execplan/groupconcatcolumn.h index 55c391f45..1bf4722d8 100644 --- a/dbcon/execplan/groupconcatcolumn.h +++ b/dbcon/execplan/groupconcatcolumn.h @@ -135,7 +135,7 @@ class GroupConcatColumn : public AggregateColumn using AggregateColumn::operator!=; virtual bool operator!=(const GroupConcatColumn& t) const; - string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: std::vector fOrderCols; diff --git a/dbcon/execplan/parsetree.h b/dbcon/execplan/parsetree.h index aaa417e5d..b068129a1 100644 --- a/dbcon/execplan/parsetree.h +++ b/dbcon/execplan/parsetree.h @@ -698,7 +698,7 @@ inline void ParseTree::drawTree(std::string filename) dotFile.close(); } -inline string ParseTree::toCppCode(IncludeSet& includes) const +inline std::string ParseTree::toCppCode(IncludeSet& includes) const { includes.insert("parsetree.h"); 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 { - ofstream hFile(filename.c_str(), std::ios::app); + std::ofstream hFile(filename.c_str(), std::ios::app); IncludeSet includes; auto result = toCppCode(includes); for (const auto& inc : includes) diff --git a/dbcon/execplan/simplefilter.h b/dbcon/execplan/simplefilter.h index a732e5762..42123374b 100644 --- a/dbcon/execplan/simplefilter.h +++ b/dbcon/execplan/simplefilter.h @@ -222,7 +222,7 @@ class SimpleFilter : public Filter static std::string escapeString(const std::string& input); - string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: SOP fOp; /// operator diff --git a/dbcon/execplan/simplescalarfilter.h b/dbcon/execplan/simplescalarfilter.h index dc2e6f3d2..420b6f3e5 100644 --- a/dbcon/execplan/simplescalarfilter.h +++ b/dbcon/execplan/simplescalarfilter.h @@ -154,7 +154,7 @@ class SimpleScalarFilter : public Filter */ bool operator!=(const SimpleScalarFilter& t) const; - string toCppCode(IncludeSet& includes) const override; + std::string toCppCode(IncludeSet& includes) const override; private: // default okay? diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index a86cb4b07..54a9f084b 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -754,7 +754,7 @@ inline uint64_t TreeNode::getUintVal() literal::Converter cnv(fResult.strVal.safeString(""), cnverr); 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(cnverr); } diff --git a/dbcon/joblist/diskjoinstep.h b/dbcon/joblist/diskjoinstep.h index 76e760fd3..3611aca8d 100644 --- a/dbcon/joblist/diskjoinstep.h +++ b/dbcon/joblist/diskjoinstep.h @@ -49,7 +49,7 @@ class DiskJoinStep : public JobStep private: void initializeFIFO(uint32_t threadCount); void processJoinPartitions(const uint32_t threadID, const uint32_t smallSideSizeLimitPerThread, - const vector& joinPartitions); + const std::vector& joinPartitions); void prepareJobs(const std::vector& joinPartitions, JoinPartitionJobs& joinPartitionsJobs); void outputResult(const std::vector& result); diff --git a/dbcon/joblist/groupconcat.h b/dbcon/joblist/groupconcat.h index a036705be..693b15d14 100644 --- a/dbcon/joblist/groupconcat.h +++ b/dbcon/joblist/groupconcat.h @@ -124,7 +124,7 @@ class GroupConcator virtual void merge(GroupConcator*) = 0; virtual uint8_t* getResultImpl(const std::string& sep) = 0; 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; @@ -178,7 +178,10 @@ class GroupConcatNoOrder : public GroupConcator const std::string toString() const override; protected: - std::vector& getRGDatas() { return fDataVec; } + std::vector& getRGDatas() + { + return fDataVec; + } void createNewRGData(); rowgroup::RowGroup fRowGroup; @@ -247,8 +250,14 @@ class GroupConcatOrderBy : public GroupConcator, public ordering::IdbCompare void createNewRGData(); uint64_t getCurrentRowIdx() const; static uint64_t shiftGroupIdxBy(uint64_t idx, uint32_t shift); - std::vector& getRGDatas() { return fDataVec; } - SortingPQ* getQueue() { return fOrderByQueue.get(); } + std::vector& getRGDatas() + { + return fDataVec; + } + SortingPQ* getQueue() + { + return fOrderByQueue.get(); + } rowgroup::RGDataSizeType fMemSize{0}; static constexpr uint64_t fRowsPerRG{128}; diff --git a/dbcon/joblist/largehashjoin.h b/dbcon/joblist/largehashjoin.h index dd1a96280..f85f091ba 100644 --- a/dbcon/joblist/largehashjoin.h +++ b/dbcon/joblist/largehashjoin.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -55,10 +55,10 @@ extern void timespec_sub(const struct timespec& tv1, const struct timespec& tv2, namespace joblist { -const string createHashStr("create hash"); -const string hashJoinStr("hash join"); -const string insertResultsStr("insert results"); -const string insertLastResultsStr("insert last results"); +const std::string createHashStr("create hash"); +const std::string hashJoinStr("hash join"); +const std::string insertResultsStr("insert results"); +const std::string insertLastResultsStr("insert last results"); template void* HashJoinByBucket_thr(void* arg); diff --git a/dbcon/joblist/lbidlist.h b/dbcon/joblist/lbidlist.h index 4e294341d..8a977ee50 100644 --- a/dbcon/joblist/lbidlist.h +++ b/dbcon/joblist/lbidlist.h @@ -31,7 +31,7 @@ #include "bytestream.h" #include #include "brm.h" -#include +#include namespace joblist { diff --git a/dbcon/joblist/primitivestep.h b/dbcon/joblist/primitivestep.h index 008a0e81f..7061d23a2 100644 --- a/dbcon/joblist/primitivestep.h +++ b/dbcon/joblist/primitivestep.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include @@ -888,9 +888,9 @@ class BatchPrimitive : public JobStep, public DECEventListener struct _CPInfo { _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) - : bigMin(BIGMIN), bigMax(BIGMAX), LBID(l), valid(val), dictScan(false){}; + : bigMin(BIGMIN), bigMax(BIGMAX), LBID(l), valid(val), dictScan(false) {}; union { int128_t bigMin; @@ -946,9 +946,9 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep void receiveMultiPrimitiveMessages(); // Processes the vector of `bytestream` starting from `begin` index to the `end` index, non inclusive. - void processByteStreamVector(vector>& bsv, const uint32_t begin, - const uint32_t end, vector<_CPInfo>& cpv, RowGroupDL* dlp, - const uint32_t threadID); + void processByteStreamVector(std::vector>& bsv, + const uint32_t begin, const uint32_t end, std::vector<_CPInfo>& cpv, + RowGroupDL* dlp, const uint32_t threadID); /** @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 startAggregationThread(); // Processes the vector of `bytestream` starting from `begin` index to the `end` index, non inclusive. - void startProcessingThread(TupleBPS* tbps, vector>& bsv, - const uint32_t begin, const uint32_t end, vector<_CPInfo>& cpv, RowGroupDL* dlp, - const uint32_t threadID); + void startProcessingThread(TupleBPS* tbps, std::vector>& bsv, + const uint32_t begin, const uint32_t end, std::vector<_CPInfo>& cpv, + RowGroupDL* dlp, const uint32_t threadID); void initializeConfigParms(); uint64_t getFBO(uint64_t lbid); void checkDupOutputColumns(const rowgroup::RowGroup& rg); @@ -1362,7 +1362,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep private: uint64_t generateJoinResultSet(const uint32_t depth, std::vector& outputData, RowGroupDL* dlp); - void processFE2(vector& rgData); + void processFE2(std::vector& rgData); TupleBPS* tbps; // Parent rowgroup::RowGroup local_primRG; @@ -1384,7 +1384,7 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep bool doJoin; // Join vars. - vector> joinerOutput; + std::vector> joinerOutput; rowgroup::Row largeSideRow; rowgroup::Row joinedBaseRow; rowgroup::Row largeNull; @@ -1394,8 +1394,8 @@ class TupleBPS : public BatchPrimitive, public TupleDeliveryStep boost::scoped_array joinedBaseRowData; boost::scoped_array joinFERowData; std::shared_ptr largeMapping; - vector> smallMappings; - vector> fergMappings; + std::vector> smallMappings; + std::vector> fergMappings; rowgroup::RGData joinedData; boost::scoped_array largeNullMemory; boost::scoped_array> smallNullMemory; diff --git a/dbcon/joblist/tupleunion.h b/dbcon/joblist/tupleunion.h index 8ede13b49..551642b99 100644 --- a/dbcon/joblist/tupleunion.h +++ b/dbcon/joblist/tupleunion.h @@ -28,7 +28,7 @@ // #include "jobstep.h" -#include +#include #include "stlpoolallocator.h" #include "threadnaming.h" @@ -116,7 +116,7 @@ class TupleUnion : public JobStep, public TupleDeliveryStep uint64_t group : 48; 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 }; diff --git a/dbcon/mysql/ha_from_sub.cpp b/dbcon/mysql/ha_from_sub.cpp index fd35de219..442743c2d 100644 --- a/dbcon/mysql/ha_from_sub.cpp +++ b/dbcon/mysql/ha_from_sub.cpp @@ -24,12 +24,11 @@ /** @file */ /** class FromSubSelect definition */ -//#define NDEBUG +// #define NDEBUG #define PREFER_MY_CONFIG_H #include #include #include -using namespace std; #include "idb_mysql.h" @@ -39,7 +38,7 @@ using namespace std; #include "constantcolumn.h" #include "simplecolumn.h" using namespace execplan; - +using namespace std; #include "ha_subquery.h" namespace cal_impl_if diff --git a/dbcon/mysql/ha_in_sub.cpp b/dbcon/mysql/ha_in_sub.cpp index 8b2772efd..c17834e76 100644 --- a/dbcon/mysql/ha_in_sub.cpp +++ b/dbcon/mysql/ha_in_sub.cpp @@ -27,10 +27,9 @@ #define PREFER_MY_CONFIG_H #include #include -//#define NDEBUG +// #define NDEBUG #include #include -using namespace std; #include "idb_mysql.h" @@ -50,6 +49,8 @@ using namespace logging; #include "ha_subquery.h" +using namespace std; + namespace cal_impl_if { extern void parse_item(Item* item, vector& field_vec, bool& hasNonSupportItem, diff --git a/dbcon/mysql/ha_mcs_client_udfs.cpp b/dbcon/mysql/ha_mcs_client_udfs.cpp index c6dfc14a1..e7a57c70b 100644 --- a/dbcon/mysql/ha_mcs_client_udfs.cpp +++ b/dbcon/mysql/ha_mcs_client_udfs.cpp @@ -585,7 +585,7 @@ extern "C" stmt->serialize(bytestream); ByteStream::byte b = 0; THD* thd = current_thd; - string emsg; + std::string emsg; mq.write(bytestream); try @@ -606,7 +606,7 @@ extern "C" bytestream >> emsg; } } - catch (runtime_error&) + catch (std::runtime_error&) { thd->get_stmt_da()->set_overwrite_status(true); thd->raise_error_printf(ER_INTERNAL_ERROR, "Lost connection to DDLProc"); diff --git a/dbcon/mysql/ha_mcs_ddl.cpp b/dbcon/mysql/ha_mcs_ddl.cpp index 0c7fece2f..703fee1e5 100644 --- a/dbcon/mysql/ha_mcs_ddl.cpp +++ b/dbcon/mysql/ha_mcs_ddl.cpp @@ -25,16 +25,14 @@ #include #include #include -#include #include #include #include #include #include -#include +#include #include #include -using namespace std; #include #include @@ -81,6 +79,7 @@ using namespace execplan; #include "resourcemanager.h" using namespace joblist; +using namespace std; namespace { @@ -761,7 +760,7 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta #ifdef MCS_DEBUG cout << "ProcessDDLStatement: " << schema << "." << table << ":" << ddlStatement << endl; #endif - + parser.setDefaultSchema(schema); parser.setDefaultCharset(default_table_charset); int rc = 0; @@ -2203,34 +2202,46 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& /*ta 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 { //@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->isAlter = false; } - + return rc; } diff --git a/dbcon/mysql/ha_mcs_dml.cpp b/dbcon/mysql/ha_mcs_dml.cpp index a469b4ab8..77e69bd62 100644 --- a/dbcon/mysql/ha_mcs_dml.cpp +++ b/dbcon/mysql/ha_mcs_dml.cpp @@ -25,13 +25,11 @@ #include #include #include -#include -#include +#include #include #include #include #include -using namespace std; #include using namespace boost; @@ -75,6 +73,8 @@ using namespace joblist; #include "nullstring.h" +using namespace std; + namespace { #define BATCH_INSERT_GROUP_ROWS_FOR_CACHE 100000 diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index 1807c97d7..7618dd180 100644 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -21,8 +21,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -36,8 +35,6 @@ #include -using namespace std; - #include #include #include @@ -99,6 +96,8 @@ using namespace funcexp; #include "ha_view.h" +using namespace std; + namespace cal_impl_if { // This is taken from Item_cond::fix_fields in sql/item_cmpfunc.cc. diff --git a/dbcon/mysql/ha_mcs_execplan_walks.cpp b/dbcon/mysql/ha_mcs_execplan_walks.cpp index 55f66e1dc..55d52e713 100644 --- a/dbcon/mysql/ha_mcs_execplan_walks.cpp +++ b/dbcon/mysql/ha_mcs_execplan_walks.cpp @@ -26,6 +26,8 @@ #include "rowcolumn.h" #include "simplefilter.h" +using namespace std; + namespace cal_impl_if { // 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) break; - string aliasTableName(scp->tableAlias()); + std::string aliasTableName(scp->tableAlias()); scp->tableAlias(aliasTableName); gwip->rcWorkStack.push(scp->clone()); boost::shared_ptr scsp(scp); gwip->scsp = scsp; gwip->funcName.clear(); - gwip->columnMap.insert( - execplan::CalpontSelectExecutionPlan::ColumnMap::value_type(string(ifp->field_name.str), scsp)); + gwip->columnMap.insert(execplan::CalpontSelectExecutionPlan::ColumnMap::value_type( + std::string(ifp->field_name.str), scsp)); //@bug4636 take where clause column as dummy projection column, but only on local column. // 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); 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) { Item_hex_hybrid* hip = static_cast(const_cast(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(gwip->rcWorkStack.top()); cc->timeZone(gwip->timeZone); break; @@ -175,7 +178,7 @@ void gp_walk(const Item* item, void* arg) String val, *str = isp->val_str(&val); if (str) { - string cval; + std::string cval; if (str->ptr()) { @@ -218,7 +221,7 @@ void gp_walk(const Item* item, void* arg) break; } - ostringstream oss; + std::ostringstream oss; oss << "Unhandled Item type(): " << item->type(); gwip->parseErrorText = oss.str(); gwip->fatalParseError = true; @@ -248,7 +251,7 @@ void gp_walk(const Item* item, void* arg) Item* ncitem = const_cast(item); Item_func* ifp = static_cast(ncitem); - string funcName = ifp->func_name(); + std::string funcName = ifp->func_name(); if (!gwip->condPush) { @@ -323,14 +326,14 @@ void gp_walk(const Item* item, void* arg) } // try to evaluate const F&E - vector tmpVec; + std::vector tmpVec; uint16_t parseInfo = 0; parse_item(ifp, tmpVec, gwip->fatalParseError, parseInfo, gwip); // table mode takes only one table filter if (gwip->condPush) { - set tableSet; + std::set tableSet; 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; 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; @@ -463,14 +467,15 @@ void gp_walk(const Item* item, void* arg) //@bug3495, @bug5865 error out non-supported OR with correlated subquery if (isOr) { - vector fieldVec; + std::vector fieldVec; uint16_t parseInfo = 0; parse_item(it, fieldVec, gwip->fatalParseError, parseInfo, gwip); if (parseInfo & CORRELATED) { 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; } } @@ -664,7 +669,8 @@ void gp_walk(const Item* item, void* arg) else if (col->type() == Item::FIELD_ITEM && gwip->clauseType == HAVING) { // ReturnedColumn* rc = buildAggFrmTempField(const_cast(item), *gwip); - execplan::ReturnedColumn* rc = buildReturnedColumn(const_cast(item), *gwip, gwip->fatalParseError); + execplan::ReturnedColumn* rc = + buildReturnedColumn(const_cast(item), *gwip, gwip->fatalParseError); if (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 gwip->clauseType = SELECT; 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; rowCol->columnVec(cols); @@ -971,7 +978,8 @@ void parse_item(Item* item, vector& field_vec, bool& hasNonSupportI gwi->fatalParseError = true; // DRRTUY The questionable error text. I've seen // 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); break; } @@ -1633,4 +1641,4 @@ void debug_walk(const Item* item, void* arg) } } -} \ No newline at end of file +} // namespace cal_impl_if \ No newline at end of file diff --git a/dbcon/mysql/ha_mcs_impl.cpp b/dbcon/mysql/ha_mcs_impl.cpp index c385be180..e6619f7c0 100644 --- a/dbcon/mysql/ha_mcs_impl.cpp +++ b/dbcon/mysql/ha_mcs_impl.cpp @@ -24,8 +24,8 @@ #include #include #include -#include -#include +#include + #include #include #include @@ -36,7 +36,6 @@ #include #include #include //wait() -using namespace std; #include #include @@ -132,6 +131,8 @@ using namespace funcexp; #include "ha_subquery.h" #include "statistics_manager/statistics.h" +using namespace std; + namespace cal_impl_if { extern bool nonConstFunc(Item_func* ifp); @@ -176,26 +177,26 @@ const string infinidb_autoswitch_warning = "was switched to standard mode with downgraded performance."; // copied from item_timefunc.cc -static const string interval_names[] = {"year", - "quarter", - "month", - "week", - "day", - "hour", - "minute", - "second", - "microsecond", - "year_month", - "day_hour", - "day_minute", - "day_second", - "hour_minute", - "hour_second", - "minute_second", - "day_microsecond", - "hour_microsecond", - "minute_microsecond", - "second_microsecond"}; +[[maybe_unused]] static const string interval_names[] = {"year", + "quarter", + "month", + "week", + "day", + "hour", + "minute", + "second", + "microsecond", + "year_month", + "day_hour", + "day_minute", + "day_second", + "hour_minute", + "hour_second", + "minute_second", + "day_microsecond", + "hour_microsecond", + "minute_microsecond", + "second_microsecond"}; // HDFS is never used nowadays, so don't bother 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 csc = CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID); 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()); thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr()); diff --git a/dbcon/mysql/ha_mcs_impl_if.h b/dbcon/mysql/ha_mcs_impl_if.h index 7bf0581ef..aed13d202 100644 --- a/dbcon/mysql/ha_mcs_impl_if.h +++ b/dbcon/mysql/ha_mcs_impl_if.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/dbcon/mysql/ha_mcs_partition.cpp b/dbcon/mysql/ha_mcs_partition.cpp index 6835fa83c..651d0d2dc 100644 --- a/dbcon/mysql/ha_mcs_partition.cpp +++ b/dbcon/mysql/ha_mcs_partition.cpp @@ -29,7 +29,6 @@ #include // #include #include -using namespace std; #include @@ -65,6 +64,7 @@ using namespace logging; #include using namespace boost; +using namespace std; namespace { diff --git a/dbcon/mysql/ha_mcs_udf.cpp b/dbcon/mysql/ha_mcs_udf.cpp index 737d93df4..182ad0004 100644 --- a/dbcon/mysql/ha_mcs_udf.cpp +++ b/dbcon/mysql/ha_mcs_udf.cpp @@ -21,7 +21,8 @@ */ #include -#include +#include + using namespace std; #include "idb_mysql.h" diff --git a/dbcon/mysql/ha_pseudocolumn.cpp b/dbcon/mysql/ha_pseudocolumn.cpp index 459085d1e..e9053b5ac 100644 --- a/dbcon/mysql/ha_pseudocolumn.cpp +++ b/dbcon/mysql/ha_pseudocolumn.cpp @@ -3,7 +3,6 @@ // #include #include #include -using namespace std; #include "idb_mysql.h" @@ -24,6 +23,7 @@ using namespace execplan; #include "ha_mcs_impl_if.h" #include "ha_mcs_sysvars.h" using namespace cal_impl_if; +using namespace std; namespace { diff --git a/dbcon/mysql/ha_scalar_sub.cpp b/dbcon/mysql/ha_scalar_sub.cpp index e2afd8367..dfcbb1d43 100644 --- a/dbcon/mysql/ha_scalar_sub.cpp +++ b/dbcon/mysql/ha_scalar_sub.cpp @@ -24,12 +24,11 @@ /** @file */ /** class ScalarSub definition */ -//#define NDEBUG +// #define NDEBUG #define PREFER_MY_CONFIG_H #include #include #include -using namespace std; #include "idb_mysql.h" @@ -49,6 +48,8 @@ using namespace logging; #include "ha_subquery.h" +using namespace std; + namespace cal_impl_if { ScalarSub::ScalarSub(gp_walk_info& gwip) : WhereSubQuery(gwip), fReturnedColPos(0) diff --git a/dbcon/mysql/ha_select_sub.cpp b/dbcon/mysql/ha_select_sub.cpp index 8f29b2e22..8b5bde3bd 100644 --- a/dbcon/mysql/ha_select_sub.cpp +++ b/dbcon/mysql/ha_select_sub.cpp @@ -23,11 +23,10 @@ ***********************************************************************/ /** class SelectSubQuery definition */ -//#define NDEBUG +// #define NDEBUG #define PREFER_MY_CONFIG_H #include #include -using namespace std; #include "idb_mysql.h" @@ -44,6 +43,7 @@ using namespace execplan; using namespace logging; #include "ha_subquery.h" +using namespace std; namespace cal_impl_if { diff --git a/dbcon/mysql/ha_window_function.cpp b/dbcon/mysql/ha_window_function.cpp index b3d992077..87a1ccde9 100644 --- a/dbcon/mysql/ha_window_function.cpp +++ b/dbcon/mysql/ha_window_function.cpp @@ -25,7 +25,6 @@ #include #include #include -using namespace std; #include "idb_mysql.h" #include "ha_mcs_impl_if.h" @@ -53,6 +52,8 @@ using namespace mcsv1sdk; #include "vlarray.h" +using namespace std; + namespace cal_impl_if { 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) { - if (get_fe_conn_info_ptr() == NULL) { + if (get_fe_conn_info_ptr() == NULL) + { set_fe_conn_info_ptr((void*)new cal_connection_info()); 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; // item->print(&str, QT_INFINIDB_NO_QUOTE); // 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()); 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); srcp->asc(orderCol->direction == ORDER::ORDER_ASC ? true : false); - // srcp->nullsFirst(orderCol->nulls); // nulls 2-default, 1-nulls first, - //0-nulls last + // srcp->nullsFirst(orderCol->nulls); // nulls 2-default, 1-nulls + //first, 0-nulls last srcp->nullsFirst(orderCol->direction == ORDER::ORDER_ASC ? 1 : 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 (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::AVG_FUNC && item_sum->sum_func() != Item_sum::AVG_DISTINCT_FUNC) diff --git a/oam/install_scripts/CMakeLists.txt b/oam/install_scripts/CMakeLists.txt index 056dbc1a8..758ca18ce 100644 --- a/oam/install_scripts/CMakeLists.txt +++ b/oam/install_scripts/CMakeLists.txt @@ -86,6 +86,24 @@ if(WITH_TSAN) set(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG},log_path=${TSAN_PATH}.storagemanager) 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( "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh" @ONLY diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index 60b704780..2f27b389f 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -53,7 +53,7 @@ #if defined(__GNUC__) #include -static const std::string optim( +[[maybe_unused]] static const std::string optim( "Build is " #if !defined(__OPTIMIZE__) "NOT " diff --git a/primitives/blockcache/filebuffermgr.h b/primitives/blockcache/filebuffermgr.h index 20cac5857..3cbf2f6b5 100644 --- a/primitives/blockcache/filebuffermgr.h +++ b/primitives/blockcache/filebuffermgr.h @@ -26,7 +26,8 @@ #include #include #include -#include +#include + #include #include diff --git a/primitives/blockcache/iomanager.cpp b/primitives/blockcache/iomanager.cpp index 4456bc171..bfc728b2d 100644 --- a/primitives/blockcache/iomanager.cpp +++ b/primitives/blockcache/iomanager.cpp @@ -48,8 +48,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -61,7 +60,7 @@ #include #include #include -//#define NDEBUG +// #define NDEBUG #include using namespace std; @@ -648,7 +647,7 @@ void* thr_popper(ioManager* arg) fdCountSort.clear(); } // if (fdcache.size()... - } // if (oid > 3000) + } // if (oid > 3000) int opts = primitiveprocessor::directIOFlag ? IDBDataFile::USE_ODIRECT : 0; fp = NULL; diff --git a/primitives/linux-port/primitiveprocessor.cpp b/primitives/linux-port/primitiveprocessor.cpp index fe746ccae..485aad615 100644 --- a/primitives/linux-port/primitiveprocessor.cpp +++ b/primitives/linux-port/primitiveprocessor.cpp @@ -20,15 +20,16 @@ * ****************************************************************************/ -//#define NDEBUG +// #define NDEBUG #include #ifdef __linux__ #include #endif -using namespace std; #include "primitiveprocessor.h" +using namespace std; + namespace primitives { PrimitiveProcessor::PrimitiveProcessor(int debugLevel) diff --git a/primitives/linux-port/primitiveprocessor.h b/primitives/linux-port/primitiveprocessor.h index a07cf750a..08d3ea1c1 100644 --- a/primitives/linux-port/primitiveprocessor.h +++ b/primitives/linux-port/primitiveprocessor.h @@ -27,7 +27,8 @@ #include #include -#include +#include + #include "joblisttypes.h" #define POSIX_REGEX @@ -40,7 +41,6 @@ #include #include - #include "primitivemsg.h" #include "calpontsystemcatalog.h" #include "stats.h" @@ -50,7 +50,7 @@ class PrimTest; // XXX: turn off dictionary range setting during scan. -//#define XXX_PRIMITIVES_TOKEN_RANGES_XXX +// #define XXX_PRIMITIVES_TOKEN_RANGES_XXX namespace primitives { @@ -121,13 +121,16 @@ class DictEqualityFilter : public std::tr1::unordered_set(10, datatypes::CollationAwareHasher(cs), datatypes::CollationAwareComparator(cs)) + , charset(cs.getCharset()) { } CHARSET_INFO& getCharset() const { - idbassert(&_M_h1.getCharset() == &_M_eq.getCharset()); - return _M_h1.getCharset(); + return charset; } + + private: + CHARSET_INFO& charset; }; // 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::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::UBIGINT: return joblist::UBIGINTNULL; @@ -581,7 +585,7 @@ boost::shared_ptr _parseColumnFilter( { using UT = typename std::conditional::value || datatypes::is_uint128_t::value, T, typename datatypes::make_unsigned::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 ret; // Place for building the value to return if (filterCount == 0) return ret; diff --git a/primitives/primproc/bppseeder.h b/primitives/primproc/bppseeder.h index b3c8eec7e..6bf9dde79 100644 --- a/primitives/primproc/bppseeder.h +++ b/primitives/primproc/bppseeder.h @@ -34,7 +34,8 @@ #include #include #include -#include +#include + #include #include "batchprimitiveprocessor.h" diff --git a/primitives/primproc/bppsendthread.cpp b/primitives/primproc/bppsendthread.cpp index 831754e79..3b45928e2 100644 --- a/primitives/primproc/bppsendthread.cpp +++ b/primitives/primproc/bppsendthread.cpp @@ -65,7 +65,7 @@ void BPPSendThread::sendResult(const Msg_t& msg, bool newConnection) std::unique_lock sl(msgQueueLock); if (gotException) - throw runtime_error(exceptionString); + throw std::runtime_error(exceptionString); (void)atomicops::atomicAdd(¤tByteSize, msg.msg->lengthWithHdrOverhead()); msgQueue.push(msg); @@ -91,7 +91,7 @@ void BPPSendThread::sendResult(const Msg_t& msg, bool newConnection) queueNotEmpty.notify_one(); } -void BPPSendThread::sendResults(const vector& msgs, bool newConnection) +void BPPSendThread::sendResults(const std::vector& msgs, bool newConnection) { // Wait for the queue to empty out a bit if it's stuffed full if (sizeTooBig()) @@ -110,7 +110,7 @@ void BPPSendThread::sendResults(const vector& msgs, bool newConnection) std::unique_lock sl(msgQueueLock); if (gotException) - throw runtime_error(exceptionString); + throw std::runtime_error(exceptionString); if (!sawAllConnections && newConnection) { diff --git a/primitives/primproc/primitiveserver.cpp b/primitives/primproc/primitiveserver.cpp index b193643c5..8b48452d4 100644 --- a/primitives/primproc/primitiveserver.cpp +++ b/primitives/primproc/primitiveserver.cpp @@ -36,13 +36,11 @@ #include #include #include -#include -#include +#include + #include #include -using namespace std; - #include #include #include @@ -91,6 +89,8 @@ using namespace idbdatafile; using namespace threadpool; +using namespace std; + #include "threadnaming.h" #include "atomicops.h" diff --git a/primitives/primproc/primitiveserver.h b/primitives/primproc/primitiveserver.h index d500f66dd..df446fd81 100644 --- a/primitives/primproc/primitiveserver.h +++ b/primitives/primproc/primitiveserver.h @@ -25,8 +25,8 @@ #pragma once #include -#include -#include +#include + #include #include diff --git a/primitives/primproc/primproc.cpp b/primitives/primproc/primproc.cpp index 69a05ff10..4fe5a268a 100644 --- a/primitives/primproc/primproc.cpp +++ b/primitives/primproc/primproc.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/primitives/primproc/serviceexemgr.h b/primitives/primproc/serviceexemgr.h index 9da16ce0a..3f1eb6545 100644 --- a/primitives/primproc/serviceexemgr.h +++ b/primitives/primproc/serviceexemgr.h @@ -339,7 +339,7 @@ class ServiceExeMgr : public Service, public Opt } void getLocalNetIfacesSins() { - string ipAddress = "Unable to get IP Address"; + std::string ipAddress = "Unable to get IP Address"; struct ifaddrs* netIfacesList = nullptr; struct ifaddrs* ifaceListMembPtr = nullptr; int success = 0; diff --git a/storage-manager/src/SessionManager.h b/storage-manager/src/SessionManager.h index f427ce57b..cdaa9e6b2 100644 --- a/storage-manager/src/SessionManager.h +++ b/storage-manager/src/SessionManager.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace storagemanager { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3176fcfe6..a70782061 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,11 +8,22 @@ endif() if(WITH_UNITTESTS) cmake_policy(SET CMP0054 NEW) set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external) + set(cxxflags "") + set(linkflags "") + if(WITH_MSAN) + set(cxxflags "'${cxxflags} -fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE -stdlib=libc++'") + set(linkflags "'${linkflags} -stdlib=libc++'") + elseif(COLUMNSTORE_WITH_LIBCPP) + set(cxxflags "'${cxxflags} -stdlib=libc++'") + set(linkflags "'${linkflags} -stdlib=libc++'") + endif() ExternalProject_Add( googletest GIT_REPOSITORY https://github.com/google/googletest GIT_TAG release-1.12.0 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DBUILD_SHARED_LIBS=ON + -DCMAKE_CXX_FLAGS:STRING=${cxxflags} -DCMAKE_EXE_LINKER_FLAGS=${linkflags} + -DCMAKE_SHARED_LINKER_FLAGS=${linkflags} -DCMAKE_MODULE_LINKER_FLAGS=${linkflags} ) # this is a workaround for gtest's bug still not closed https://github.com/google/googletest/issues/3659 @@ -93,23 +104,25 @@ if(WITH_UNITTESTS) columnstore_link(stlpoolallocator ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${GTEST_LIBRARIES}) 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) columnstore_link(idbdatafile_test ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} gtest gtest_main) add_test(NAME columnstore:idbdatafile_test COMMAND idbdatafile_test) - # 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) + if(NOT DEFINED WITH_MSAN) # CPPUnit is not build from sources + 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) + + # 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() if(WITH_MICROBENCHMARKS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")) diff --git a/tests/compression-tests.cpp b/tests/compression-tests.cpp index 9b6523f01..d91f7bc24 100644 --- a/tests/compression-tests.cpp +++ b/tests/compression-tests.cpp @@ -24,7 +24,7 @@ class CompressionTest : public ::testing::Test { protected: - std::string genPermutations(string& data) + std::string genPermutations(std::string& data) { std::string generated; generate(data, 0, generated); @@ -32,7 +32,7 @@ class CompressionTest : public ::testing::Test } 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()) { diff --git a/tests/mcs_decimal-tests.cpp b/tests/mcs_decimal-tests.cpp index 79ea1eee6..0c98e49cc 100644 --- a/tests/mcs_decimal-tests.cpp +++ b/tests/mcs_decimal-tests.cpp @@ -23,6 +23,8 @@ #include "mcs_decimal.h" #include "dataconvert.h" +using namespace std; + TEST(Decimal, compareCheckInt64) { // remainder-based checks diff --git a/tests/rebuild-em-tests.cpp b/tests/rebuild-em-tests.cpp index 464b314e2..cb3f9921f 100644 --- a/tests/rebuild-em-tests.cpp +++ b/tests/rebuild-em-tests.cpp @@ -80,8 +80,9 @@ TEST_F(RebuildEMTest, File2OidCheckFileFormatTest) FileId fExpected(getOid(0, 0, 8, 28), 00, 79); std::vector> expectedFileIds = { - make_pair(aFileName, aExpected), make_pair(bFileName, bExpected), make_pair(cFileName, cExpected), - make_pair(dFileName, dExpected), make_pair(eFileName, eExpected), make_pair(fFileName, fExpected)}; + std::make_pair(aFileName, aExpected), std::make_pair(bFileName, bExpected), + 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) { diff --git a/utils/configcpp/writeonce.h b/utils/configcpp/writeonce.h index 7a145daca..f15fc3007 100644 --- a/utils/configcpp/writeonce.h +++ b/utils/configcpp/writeonce.h @@ -25,7 +25,7 @@ #pragma once #include -#include +#include #include diff --git a/utils/dataconvert/dataconvert.h b/utils/dataconvert/dataconvert.h index 136b6df0b..6b788cc86 100644 --- a/utils/dataconvert/dataconvert.h +++ b/utils/dataconvert/dataconvert.h @@ -104,7 +104,6 @@ const int64_t IDB_pow[19] = {1, 100000000000000000LL, 1000000000000000000LL}; - const int32_t SECS_PER_MIN = 60; const int32_t MINS_PER_HOUR = 60; 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, 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, bool noRoundup); @@ -1319,7 +1318,7 @@ inline void DataConvert::datetimeToString(long long datetimevalue, char* buf, un 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), @@ -1377,7 +1376,7 @@ inline void DataConvert::timeToString(long long timevalue, char* buf, unsigned i if ((timevalue & 0xffffff) > 0) { - msec = (unsigned)((timevalue)&0xffffff); + msec = (unsigned)((timevalue) & 0xffffff); } if ((hour >= 0) && (timevalue >> 63)) @@ -1554,7 +1553,6 @@ inline int128_t strtoll128(const char* data, bool& saturate, char** ep) return res; } - template T decimalRangeUp(int32_t precision) { diff --git a/utils/funcexp/func_json_array.cpp b/utils/funcexp/func_json_array.cpp index 948bf1754..02b02e519 100644 --- a/utils/funcexp/func_json_array.cpp +++ b/utils/funcexp/func_json_array.cpp @@ -22,14 +22,14 @@ CalpontSystemCatalog::ColType Func_json_array::operationType(FunctionParm& fp, return fp.size() > 0 ? fp[0]->data()->resultType() : resultType; } -string Func_json_array::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type) +std::string Func_json_array::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& type) { if (fp.size() == 0) return "[]"; const CHARSET_INFO* retCS = type.getCharset(); - string ret("["); + std::string ret("["); if (appendJSValue(ret, retCS, row, fp[0])) goto error; diff --git a/utils/funcexp/func_json_array_append.cpp b/utils/funcexp/func_json_array_append.cpp index e038e37f1..a163cf869 100644 --- a/utils/funcexp/func_json_array_append.cpp +++ b/utils/funcexp/func_json_array_append.cpp @@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_array_append::operationType( return fp[0]->data()->resultType(); } -string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) @@ -32,7 +32,7 @@ string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, b json_engine_t jsEg; const uchar* arrEnd; size_t strRestLen; - string retJS; + std::string retJS; retJS.reserve(js.length() + padding); initJSPaths(paths, fp, 1, 2); diff --git a/utils/funcexp/func_json_array_insert.cpp b/utils/funcexp/func_json_array_insert.cpp index 9e6c5186a..5c6ee56ed 100644 --- a/utils/funcexp/func_json_array_insert.cpp +++ b/utils/funcexp/func_json_array_insert.cpp @@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_array_insert::operationType( return fp[0]->data()->resultType(); } -string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { const auto& js = fp[0]->data()->getStrVal(row, 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]); json_engine_t jsEg; - string retJS; + std::string retJS; retJS.reserve(js.length() + 8); initJSPaths(paths, fp, 1, 2); diff --git a/utils/funcexp/func_json_contains_path.cpp b/utils/funcexp/func_json_contains_path.cpp index 65cd28ada..2d3bb8393 100644 --- a/utils/funcexp/func_json_contains_path.cpp +++ b/utils/funcexp/func_json_contains_path.cpp @@ -32,7 +32,7 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul if (isNull) return false; - const string_view js = js_ns.unsafeStringRef(); + const std::string_view js = js_ns.unsafeStringRef(); #if MYSQL_VERSION_ID >= 100900 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); if (isNull) return false; - string mode = mode_ns.unsafeStringRef(); + std::string mode = mode_ns.unsafeStringRef(); transform(mode.begin(), mode.end(), mode.begin(), ::tolower); if (mode != "one" && mode != "all") diff --git a/utils/funcexp/func_json_extract.cpp b/utils/funcexp/func_json_extract.cpp index 5e6e9dfa9..d07986faf 100644 --- a/utils/funcexp/func_json_extract.cpp +++ b/utils/funcexp/func_json_extract.cpp @@ -13,7 +13,7 @@ using namespace funcexp::helpers; 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 isNull = false; @@ -34,7 +34,7 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t bool hasNegPath = false; #endif const size_t argSize = fp.size(); - string tmp; + std::string tmp; initJSPaths(paths, fp, 1, 1); @@ -151,10 +151,10 @@ CalpontSystemCatalog::ColType Func_json_extract::operationType(FunctionParm& fp, return fp[0]->data()->resultType(); } -string Func_json_extract::getStrVal(Row& row, FunctionParm& fp, bool& isNull, - CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_extract::getStrVal(Row& row, FunctionParm& fp, bool& isNull, + CalpontSystemCatalog::ColType& /*type*/) { - string retJS; + std::string retJS; json_value_types valType; if (doExtract(row, fp, &valType, retJS) == 0) 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*/, execplan::CalpontSystemCatalog::ColType& /*type*/) { - string retJS; + std::string retJS; json_value_types valType; int64_t ret = 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*/, execplan::CalpontSystemCatalog::ColType& /*type*/) { - string retJS; + std::string retJS; json_value_types valType; double ret = 0.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*/) { json_value_types valType; - string retJS; + std::string retJS; if (doExtract(row, fp, &valType, retJS, false) == 0) { diff --git a/utils/funcexp/func_json_format.cpp b/utils/funcexp/func_json_format.cpp index 73f88fdab..71759a0ec 100644 --- a/utils/funcexp/func_json_format.cpp +++ b/utils/funcexp/func_json_format.cpp @@ -22,8 +22,8 @@ CalpontSystemCatalog::ColType Func_json_format::operationType(FunctionParm& fp, return fp[0]->data()->resultType(); } -string Func_json_format::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_format::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) @@ -48,7 +48,7 @@ string Func_json_format::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i json_engine_t jsEg; initJSEngine(jsEg, getCharset(fp[0]), js); - string ret; + std::string ret; if (doFormat(&jsEg, ret, fmt, tabSize)) { isNull = true; diff --git a/utils/funcexp/func_json_insert.cpp b/utils/funcexp/func_json_insert.cpp index 1a59d974e..df464a64a 100644 --- a/utils/funcexp/func_json_insert.cpp +++ b/utils/funcexp/func_json_insert.cpp @@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_insert::operationType(FunctionParm& fp, return fp[0]->data()->resultType(); } -string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) @@ -40,7 +40,7 @@ string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i initJSPaths(paths, fp, 1, 2); // Save the result of each merge and the result of the final merge separately - string retJS; + std::string retJS; utils::NullString tmpJS(js); for (size_t i = 1, j = 0; i < fp.size(); i += 2, j++) { diff --git a/utils/funcexp/func_json_keys.cpp b/utils/funcexp/func_json_keys.cpp index 8634fce50..d926ff8b3 100644 --- a/utils/funcexp/func_json_keys.cpp +++ b/utils/funcexp/func_json_keys.cpp @@ -14,7 +14,7 @@ using namespace funcexp::helpers; 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* 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(); } -string Func_json_keys::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_keys::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; IntType keySize = 0; - string ret; + std::string ret; json_engine_t jsEg; initJSEngine(jsEg, getCharset(fp[0]), js); diff --git a/utils/funcexp/func_json_merge.cpp b/utils/funcexp/func_json_merge.cpp index 3d4b241bb..24dc9d069 100644 --- a/utils/funcexp/func_json_merge.cpp +++ b/utils/funcexp/func_json_merge.cpp @@ -13,7 +13,7 @@ using namespace funcexp::helpers; 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)) return 1; @@ -214,8 +214,8 @@ CalpontSystemCatalog::ColType Func_json_merge::operationType(FunctionParm& fp, return fp[0]->data()->resultType(); } -string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) @@ -226,7 +226,7 @@ string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is json_engine_t jsEg1, jsEg2; utils::NullString tmpJS(js); - string retJS; + std::string retJS; for (size_t i = 1; i < fp.size(); i++) { diff --git a/utils/funcexp/func_json_merge_patch.cpp b/utils/funcexp/func_json_merge_patch.cpp index 250c11736..cf02445b9 100644 --- a/utils/funcexp/func_json_merge_patch.cpp +++ b/utils/funcexp/func_json_merge_patch.cpp @@ -13,7 +13,7 @@ using namespace funcexp::helpers; namespace { -int copyValuePatch(string& retJS, json_engine_t* jsEg) +int copyValuePatch(std::string& retJS, json_engine_t* jsEg) { int firstKey = 1; @@ -69,7 +69,7 @@ int copyValuePatch(string& retJS, json_engine_t* jsEg) 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)) { @@ -266,8 +266,8 @@ CalpontSystemCatalog::ColType Func_json_merge_patch::operationType( return fp[0]->data()->resultType(); } -string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { // JSON_MERGE_PATCH return NULL if any argument is NULL 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; utils::NullString tmpJS(js); - string retJS; + std::string retJS; for (size_t i = 1; i < fp.size(); i++) { const auto& js2 = fp[i]->data()->getStrVal(row, isNull); diff --git a/utils/funcexp/func_json_normalize.cpp b/utils/funcexp/func_json_normalize.cpp index 0470f8a80..f25f2f6fe 100644 --- a/utils/funcexp/func_json_normalize.cpp +++ b/utils/funcexp/func_json_normalize.cpp @@ -22,13 +22,13 @@ CalpontSystemCatalog::ColType Func_json_normalize::operationType( return fp[0]->data()->resultType(); } -string Func_json_normalize::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_normalize::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { const auto js_ns = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; - const string_view js = js_ns.unsafeStringRef(); + const std::string_view js = js_ns.unsafeStringRef(); using DynamicString = unique_ptr; diff --git a/utils/funcexp/func_json_object.cpp b/utils/funcexp/func_json_object.cpp index 3a65d5561..2a8790e3b 100644 --- a/utils/funcexp/func_json_object.cpp +++ b/utils/funcexp/func_json_object.cpp @@ -25,14 +25,14 @@ CalpontSystemCatalog::ColType Func_json_object::operationType(FunctionParm& fp, return fp.size() > 0 ? fp[0]->data()->resultType() : resultType; } -string Func_json_object::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& type) +std::string Func_json_object::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& type) { if (fp.size() == 0) return "{}"; const CHARSET_INFO* retCS = type.getCharset(); - string ret("{"); + std::string ret("{"); if (appendJSKeyName(ret, retCS, row, fp[0]) || appendJSValue(ret, retCS, row, fp[1])) goto error; diff --git a/utils/funcexp/func_json_query.cpp b/utils/funcexp/func_json_query.cpp index e019fbcd2..5e25a0a7f 100644 --- a/utils/funcexp/func_json_query.cpp +++ b/utils/funcexp/func_json_query.cpp @@ -14,13 +14,13 @@ namespace funcexp 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); } }; -bool JSONEgWrapper::checkAndGetComplexVal(string& ret, int* error) +bool JSONEgWrapper::checkAndGetComplexVal(std::string& ret, int* error) { if (json_value_scalar(this)) { @@ -47,10 +47,10 @@ CalpontSystemCatalog::ColType Func_json_query::operationType(FunctionParm& fp, return fp[0]->data()->resultType(); } -string Func_json_query::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_query::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { - string ret; + std::string ret; QueryJSONPathWrapper qpw; isNull = qpw.extract(ret, row, fp[0], fp[1]); return isNull ? "" : ret; diff --git a/utils/funcexp/func_json_quote.cpp b/utils/funcexp/func_json_quote.cpp index 8ab3e0784..9b0e25b5a 100644 --- a/utils/funcexp/func_json_quote.cpp +++ b/utils/funcexp/func_json_quote.cpp @@ -35,7 +35,7 @@ std::string Func_json_quote::getStrVal(rowgroup::Row& row, FunctionParm& fp, boo return ""; } - string ret("\""); + std::string ret("\""); isNull = appendEscapedJS(ret, &my_charset_utf8mb4_bin, js, getCharset(fp[0])); if (isNull) diff --git a/utils/funcexp/func_json_remove.cpp b/utils/funcexp/func_json_remove.cpp index ca9e958ea..35745dff2 100644 --- a/utils/funcexp/func_json_remove.cpp +++ b/utils/funcexp/func_json_remove.cpp @@ -20,8 +20,8 @@ CalpontSystemCatalog::ColType Func_json_remove::operationType(FunctionParm& fp, return fp[0]->data()->resultType(); } -string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { 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); - string retJS; + std::string retJS; utils::NullString tmpJS(js); for (size_t i = 1, j = 0; i < fp.size(); i++, j++) { diff --git a/utils/funcexp/func_json_search.cpp b/utils/funcexp/func_json_search.cpp index efad86fa5..1365064cf 100644 --- a/utils/funcexp/func_json_search.cpp +++ b/utils/funcexp/func_json_search.cpp @@ -17,7 +17,7 @@ using namespace funcexp::helpers; 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; @@ -35,7 +35,7 @@ static bool appendJSPath(string& ret, const json_path_t* p) else /*JSON_PATH_ARRAY*/ { ret.append("["); - ret.append(to_string(c->n_item)); + ret.append(std::to_string(c->n_item)); ret.append("]"); } } @@ -81,10 +81,10 @@ CalpontSystemCatalog::ColType Func_json_search::operationType(FunctionParm& fp, return fp[0]->data()->resultType(); } -string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { - string ret; + std::string ret; bool isNullJS = false, isNullVal = false; const auto& js = fp[0]->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); if (isNull) return ""; - string mode = mode_ns.safeString(""); + std::string mode = mode_ns.safeString(""); transform(mode.begin(), mode.end(), mode.begin(), ::tolower); if (mode != "one" && mode != "all") diff --git a/utils/funcexp/func_json_type.cpp b/utils/funcexp/func_json_type.cpp index be248a794..6b75f75e1 100644 --- a/utils/funcexp/func_json_type.cpp +++ b/utils/funcexp/func_json_type.cpp @@ -19,7 +19,7 @@ CalpontSystemCatalog::ColType Func_json_type::operationType(FunctionParm& fp, 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*/) { 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 ""; json_engine_t jsEg; - string result; + std::string result; initJSEngine(jsEg, getCharset(fp[0]), js); diff --git a/utils/funcexp/func_json_unquote.cpp b/utils/funcexp/func_json_unquote.cpp index 35f11694c..9eefec324 100644 --- a/utils/funcexp/func_json_unquote.cpp +++ b/utils/funcexp/func_json_unquote.cpp @@ -42,7 +42,7 @@ std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, b (uchar*)buf, (uchar*)(buf + jsEg.value_len))) >= 0) { buf[strLen] = '\0'; - string ret = buf; + std::string ret = buf; return strLen == 0 ? "" : ret; } diff --git a/utils/funcexp/func_json_value.cpp b/utils/funcexp/func_json_value.cpp index 7bc2ee4dc..95849bcf2 100644 --- a/utils/funcexp/func_json_value.cpp +++ b/utils/funcexp/func_json_value.cpp @@ -14,7 +14,7 @@ using namespace funcexp::helpers; namespace funcexp { -bool JSONEgWrapper::checkAndGetScalar(string& ret, int* error) +bool JSONEgWrapper::checkAndGetScalar(std::string& ret, int* error) { CHARSET_INFO* cs; 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); } }; -string Func_json_value::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, - execplan::CalpontSystemCatalog::ColType& /*type*/) +std::string Func_json_value::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, + execplan::CalpontSystemCatalog::ColType& /*type*/) { - string ret; + std::string ret; JSONPathWrapperValue pw; isNull = pw.extract(ret, row, fp[0], fp[1]); return isNull ? "" : ret; diff --git a/utils/funcexp/funcexp.h b/utils/funcexp/funcexp.h index 7cd08006b..a1530dace 100644 --- a/utils/funcexp/funcexp.h +++ b/utils/funcexp/funcexp.h @@ -26,7 +26,8 @@ #include #include -#include +#include + #include #include "rowgroup.h" diff --git a/utils/funcexp/funchelpers.h b/utils/funcexp/funchelpers.h index c0ef30cbd..c7f721ecf 100644 --- a/utils/funcexp/funchelpers.h +++ b/utils/funcexp/funchelpers.h @@ -202,7 +202,8 @@ inline void get_date_from_mysql_daynr(long daynr, dataconvert::DateTime& dateTim // else: // 0 = Monday, 1 = Tuesday, ..., 6 = Sunday // 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)) { @@ -642,21 +643,21 @@ inline int dayOfWeek(std::string day) // Sunday = 0 return -1; } -inline string intToString(int64_t i) +inline std::string intToString(int64_t i) { char buf[32]; snprintf(buf, sizeof(buf), "%" PRId64 "", i); return buf; } -inline string uintToString(uint64_t i) +inline std::string uintToString(uint64_t i) { char buf[32]; snprintf(buf, sizeof(buf), "%" PRIu64 "", i); return buf; } -inline string doubleToString(double d) +inline std::string doubleToString(double d) { // double's can be *really* long to print out. Max mysql // is e308 so allow for 308 + 36 decimal places minimum. @@ -665,7 +666,7 @@ inline string doubleToString(double d) 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 // is e308 so allow for 308 + 36 decimal places minimum. diff --git a/utils/funcexp/jsonhelpers.h b/utils/funcexp/jsonhelpers.h index 8f5fde560..4f77c05a1 100644 --- a/utils/funcexp/jsonhelpers.h +++ b/utils/funcexp/jsonhelpers.h @@ -30,19 +30,19 @@ static const int NO_WILDCARD_ALLOWED = 1; Checks if the path has '.*' '[*]' or '**' constructions 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 -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); -bool appendJSKeyName(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 appendJSKeyName(std::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 char tab_arr[TAB_SIZE_LIMIT + 1] = " "; // 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 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); -inline void initJSPaths(vector& paths, FunctionParm& fp, const int start, const int step) +inline void initJSPaths(std::vector& paths, FunctionParm& fp, const int start, const int step) { if (paths.empty()) for (size_t i = start; i < fp.size(); i += step) paths.emplace_back(); } -bool matchJSPath(const vector& paths, const json_path_t* p, json_value_types valType, +bool matchJSPath(const std::vector& paths, const json_path_t* p, json_value_types valType, const int* arrayCounter = nullptr, bool exact = true); } // namespace funcexp::helpers diff --git a/utils/joiner/joiner.h b/utils/joiner/joiner.h index 58661489b..bf19d607f 100644 --- a/utils/joiner/joiner.h +++ b/utils/joiner/joiner.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include "../common/simpleallocator.h" #include "../joblist/elementtype.h" diff --git a/utils/joiner/tuplejoiner.h b/utils/joiner/tuplejoiner.h index 821b57deb..bcd08ed1d 100644 --- a/utils/joiner/tuplejoiner.h +++ b/utils/joiner/tuplejoiner.h @@ -124,7 +124,7 @@ class TypelessDataDecoder void checkAvailableData(uint32_t nbytes) const { if (mPtr + nbytes > mEnd) - throw runtime_error("TypelessData is too short"); + throw std::runtime_error("TypelessData is too short"); } public: @@ -172,7 +172,7 @@ class TypelessDataDecoder class LongDoubleEq { public: - LongDoubleEq(){}; + LongDoubleEq() {}; inline bool operator()(const long double& pos1, const long double& pos2) const { return pos1 == pos2; @@ -204,7 +204,6 @@ class TypelessDataStructure } }; - using RowPointersVec = std::vector>; using RowPointersVecUP = std::unique_ptr; @@ -279,7 +278,8 @@ class TupleJoiner /* ctor to use for string & compound join */ TupleJoiner(const rowgroup::RowGroup& smallInput, const rowgroup::RowGroup& largeInput, const std::vector& smallJoinColumns, const std::vector& 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(); @@ -454,7 +454,7 @@ class TupleJoiner // Wide-DECIMAL JOIN bool joinHasSkewedKeyColumn(); - inline const vector& getSmallSideColumnsWidths() const + inline const std::vector& getSmallSideColumnsWidths() const { return smallRG.getColWidths(); } @@ -473,10 +473,11 @@ class TupleJoiner void initHashMaps(uint32_t& smallJoinColumn); void clearHashMaps(); + private: - template - using HashMapTemplate = std::unordered_multimap, - utils::STLPoolAllocator>>; + template + using HashMapTemplate = + std::unordered_multimap, utils::STLPoolAllocator>>; using hash_t = HashMapTemplate; using sthash_t = HashMapTemplate; using typelesshash_t = HashMapTemplate; diff --git a/utils/regr/corr.cpp b/utils/regr/corr.cpp index 71fb41d1a..c63813c65 100644 --- a/utils/regr/corr.cpp +++ b/utils/regr/corr.cpp @@ -15,12 +15,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include #include -#include #include "corr.h" -#include "bytestream.h" -#include "objectreader.h" using namespace mcsv1sdk; @@ -197,8 +194,8 @@ mcsv1_UDAF::ReturnCode corr::evaluate(mcsv1Context* context, static_any::any& va // When var_popy is 0, NULL is the result return mcsv1_UDAF::SUCCESS; } - long double std_popx = sqrt(var_popx); - long double std_popy = sqrt(var_popy); + long double std_popx = std::sqrt(var_popx); + long double std_popy = std::sqrt(var_popy); long double corr = cxy / (std_popy * std_popx * N); valOut = static_cast(corr); } diff --git a/utils/regr/corr.h b/utils/regr/corr.h index 7900c5444..74cca6e42 100644 --- a/utils/regr/corr.h +++ b/utils/regr/corr.h @@ -33,11 +33,9 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" -#include "calpontsystemcatalog.h" -#include "windowfunctioncolumn.h" #define EXPORT @@ -49,7 +47,7 @@ class corr : public mcsv1_UDAF { public: // Defaults OK - corr() : mcsv1_UDAF(){}; + corr() : mcsv1_UDAF() {}; ~corr() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/covar_pop.h b/utils/regr/covar_pop.h index b8d5a0a50..1515c88ec 100644 --- a/utils/regr/covar_pop.h +++ b/utils/regr/covar_pop.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class covar_pop : public mcsv1_UDAF { public: // Defaults OK - covar_pop() : mcsv1_UDAF(){}; + covar_pop() : mcsv1_UDAF() {}; ~covar_pop() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/covar_samp.h b/utils/regr/covar_samp.h index d78d662c0..1c6dd5fd6 100644 --- a/utils/regr/covar_samp.h +++ b/utils/regr/covar_samp.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class covar_samp : public mcsv1_UDAF { public: // Defaults OK - covar_samp() : mcsv1_UDAF(){}; + covar_samp() : mcsv1_UDAF() {}; ~covar_samp() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/moda.cpp b/utils/regr/moda.cpp index d239371ec..40afb8988 100644 --- a/utils/regr/moda.cpp +++ b/utils/regr/moda.cpp @@ -24,6 +24,7 @@ #include "columnwidth.h" using namespace mcsv1sdk; +using namespace std; // This is the standard way to get a UDAF function into the system's // 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::VARCHAR: - case execplan::CalpontSystemCatalog::CHAR: - data->modaImpl = &moda_impl_string; - break; + case execplan::CalpontSystemCatalog::CHAR: data->modaImpl = &moda_impl_string; break; default: data->modaImpl = NULL; } @@ -368,8 +367,7 @@ void ModaData::serialize(messageqcpp::ByteStream& bs) const case execplan::CalpontSystemCatalog::DOUBLE: serializeMap(bs); break; case execplan::CalpontSystemCatalog::LONGDOUBLE: serializeMap(bs); break; case execplan::CalpontSystemCatalog::CHAR: - case execplan::CalpontSystemCatalog::VARCHAR: - serializeMap(bs); break; + case execplan::CalpontSystemCatalog::VARCHAR: serializeMap(bs); 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(bs); break; case execplan::CalpontSystemCatalog::LONGDOUBLE: unserializeMap(bs); break; case execplan::CalpontSystemCatalog::CHAR: - case execplan::CalpontSystemCatalog::VARCHAR: - unserializeMap(bs); break; + case execplan::CalpontSystemCatalog::VARCHAR: unserializeMap(bs); break; default: throw std::runtime_error("ModaData::unserialize with bad data type"); break; } } @@ -503,7 +500,7 @@ void ModaData::cleanup() /************************************************************************************************ * String Specialization -************************************************************************************************/ + ************************************************************************************************/ mcsv1_UDAF::ReturnCode Moda_impl_T::init(mcsv1Context* context, ColumnDatum* /*colTypes*/) { @@ -524,7 +521,7 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::reset(mcsv1Context* context) mcsv1_UDAF::ReturnCode Moda_impl_T::nextValue(mcsv1Context* context, ColumnDatum* valsIn) { static_any::any& valIn = valsIn[0].columnData; - ModaData* data = static_cast(context->getUserData()); + ModaData* data = static_cast(context->getUserData()); std::unordered_map, comparator >* map = data->getMap(); if (valIn.empty()) @@ -554,9 +551,10 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::subEvaluate(mcsv1Context* context, c } ModaData* outData = static_cast(context->getUserData()); - const ModaData* inData = static_cast(userDataIn); - std::unordered_map, comparator >* outMap = outData->getMap(); - std::unordered_map, comparator >* inMap = inData->getMap(); + const ModaData* inData = static_cast(userDataIn); + std::unordered_map, comparator >* outMap = + outData->getMap(); + std::unordered_map, comparator >* inMap = inData->getMap(); typename std::unordered_map, comparator >::const_iterator iter; for (iter = inMap->begin(); iter != inMap->end(); ++iter) @@ -615,7 +613,7 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::dropValue(mcsv1Context* context, Col { static_any::any& valDropped = valsDropped[0].columnData; ModaData* data = static_cast(context->getUserData()); - std::unordered_map, comparator >* map = data->getMap(); + std::unordered_map, comparator >* map = data->getMap(); if (valDropped.empty()) { @@ -630,5 +628,3 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::dropValue(mcsv1Context* context, Col return mcsv1_UDAF::SUCCESS; } - - diff --git a/utils/regr/moda.h b/utils/regr/moda.h index 5d3bb244e..e709d264e 100644 --- a/utils/regr/moda.h +++ b/utils/regr/moda.h @@ -91,12 +91,12 @@ struct hasher // A collation aware hasher for strings template <> -struct hasher +struct hasher { 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()); } @@ -273,7 +273,7 @@ class Moda_impl_T : public mcsv1_UDAF }; template <> // string specialization -class Moda_impl_T : public mcsv1_UDAF +class Moda_impl_T : public mcsv1_UDAF { public: // Defaults OK @@ -357,7 +357,7 @@ class moda : public mcsv1_UDAF Moda_impl_T moda_impl_float; Moda_impl_T moda_impl_double; Moda_impl_T moda_impl_longdouble; - Moda_impl_T moda_impl_string; + Moda_impl_T moda_impl_string; }; }; // namespace mcsv1sdk diff --git a/utils/regr/regr_avgx.h b/utils/regr/regr_avgx.h index b6b4e1190..4c5f4760a 100644 --- a/utils/regr/regr_avgx.h +++ b/utils/regr/regr_avgx.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -59,7 +59,7 @@ class regr_avgx : public mcsv1_UDAF { public: // Defaults OK - regr_avgx() : mcsv1_UDAF(){}; + regr_avgx() : mcsv1_UDAF() {}; ~regr_avgx() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_avgy.h b/utils/regr/regr_avgy.h index 849c86f35..feb355b39 100644 --- a/utils/regr/regr_avgy.h +++ b/utils/regr/regr_avgy.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_avgy : public mcsv1_UDAF { public: // Defaults OK - regr_avgy() : mcsv1_UDAF(){}; + regr_avgy() : mcsv1_UDAF() {}; ~regr_avgy() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_count.h b/utils/regr/regr_count.h index feccfd2b9..8188fff34 100644 --- a/utils/regr/regr_count.h +++ b/utils/regr/regr_count.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_count : public mcsv1_UDAF { public: // Defaults OK - regr_count() : mcsv1_UDAF(){}; + regr_count() : mcsv1_UDAF() {}; ~regr_count() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_intercept.h b/utils/regr/regr_intercept.h index 2a8f1d3ac..6bc29a4ce 100644 --- a/utils/regr/regr_intercept.h +++ b/utils/regr/regr_intercept.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_intercept : public mcsv1_UDAF { public: // Defaults OK - regr_intercept() : mcsv1_UDAF(){}; + regr_intercept() : mcsv1_UDAF() {}; ~regr_intercept() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_r2.cpp b/utils/regr/regr_r2.cpp index 313c43d38..a1b0e86ca 100644 --- a/utils/regr/regr_r2.cpp +++ b/utils/regr/regr_r2.cpp @@ -15,13 +15,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include #include -#include #include "regr_r2.h" -#include "bytestream.h" -#include "objectreader.h" - +#include using namespace mcsv1sdk; class Add_regr_r2_ToUDAFMap @@ -197,8 +193,8 @@ mcsv1_UDAF::ReturnCode regr_r2::evaluate(mcsv1Context* context, static_any::any& valOut = 1.0; return mcsv1_UDAF::SUCCESS; } - long double std_popx = sqrt(var_popx); - long double std_popy = sqrt(var_popy); + long double std_popx = std::sqrt(var_popx); + long double std_popy = std::sqrt(var_popy); long double corr = cxy / (std_popy * std_popx * N); valOut = static_cast(corr * corr); } diff --git a/utils/regr/regr_r2.h b/utils/regr/regr_r2.h index 4d7fb4d74..00d04a2d0 100644 --- a/utils/regr/regr_r2.h +++ b/utils/regr/regr_r2.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_r2 : public mcsv1_UDAF { public: // Defaults OK - regr_r2() : mcsv1_UDAF(){}; + regr_r2() : mcsv1_UDAF() {}; ~regr_r2() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_slope.h b/utils/regr/regr_slope.h index 541571a75..fe2c84b1e 100644 --- a/utils/regr/regr_slope.h +++ b/utils/regr/regr_slope.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_slope : public mcsv1_UDAF { public: // Defaults OK - regr_slope() : mcsv1_UDAF(){}; + regr_slope() : mcsv1_UDAF() {}; ~regr_slope() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_sxx.h b/utils/regr/regr_sxx.h index 883e57d3e..92dede514 100644 --- a/utils/regr/regr_sxx.h +++ b/utils/regr/regr_sxx.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_sxx : public mcsv1_UDAF { public: // Defaults OK - regr_sxx() : mcsv1_UDAF(){}; + regr_sxx() : mcsv1_UDAF() {}; ~regr_sxx() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_sxy.h b/utils/regr/regr_sxy.h index da1262c55..be0053c00 100644 --- a/utils/regr/regr_sxy.h +++ b/utils/regr/regr_sxy.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_sxy : public mcsv1_UDAF { public: // Defaults OK - regr_sxy() : mcsv1_UDAF(){}; + regr_sxy() : mcsv1_UDAF() {}; ~regr_sxy() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regr_syy.h b/utils/regr/regr_syy.h index 2b8e0c035..8ac00a906 100644 --- a/utils/regr/regr_syy.h +++ b/utils/regr/regr_syy.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -49,7 +49,7 @@ class regr_syy : public mcsv1_UDAF { public: // Defaults OK - regr_syy() : mcsv1_UDAF(){}; + regr_syy() : mcsv1_UDAF() {}; ~regr_syy() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/regr/regrmysql.cpp b/utils/regr/regrmysql.cpp index 39fed3146..9020e81fa 100644 --- a/utils/regr/regrmysql.cpp +++ b/utils/regr/regrmysql.cpp @@ -1,12 +1,11 @@ #include #include -#include -#include #include -using namespace std; #include "idb_mysql.h" +using namespace std; + namespace { inline bool isNumeric(int type, const char* attr) @@ -596,8 +595,8 @@ extern "C" // When var_popy is 0, 1 is the result return 1; } - long double std_popx = sqrt(var_popx); - long double std_popy = sqrt(var_popy); + long double std_popx = std::sqrt(var_popx); + long double std_popy = std::sqrt(var_popy); long double covar_pop = (sumxy - ((sumx * sumy) / N)) / N; long double corr = covar_pop / (std_popy * std_popx); valOut = static_cast(corr * corr); @@ -716,8 +715,8 @@ extern "C" // When var_popy is 0, 1 is the result return 1; } - long double std_popx = sqrt(var_popx); - long double std_popy = sqrt(var_popy); + long double std_popx = std::sqrt(var_popx); + long double std_popy = std::sqrt(var_popy); long double covar_pop = (sumxy - ((sumx * sumy) / N)) / N; long double corr = covar_pop / (std_popy * std_popx); return static_cast(corr); diff --git a/utils/rowgroup/rowaggregation.h b/utils/rowgroup/rowaggregation.h index cb5ffbdd0..374e69033 100644 --- a/utils/rowgroup/rowaggregation.h +++ b/utils/rowgroup/rowaggregation.h @@ -32,8 +32,8 @@ #include #include #include -#include -#include +#include + #include #include diff --git a/utils/rwlock/rwlock.cpp b/utils/rwlock/rwlock.cpp index fde95640c..86e8f50f3 100644 --- a/utils/rwlock/rwlock.cpp +++ b/utils/rwlock/rwlock.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #ifndef NDEBUG #define NDEBUG @@ -239,16 +239,12 @@ again: } catch (std::exception& ex) { - cerr << - __PRETTY_FUNCTION__ << - ":" << __LINE__ << ": caught an exception: " << ex.what() << endl; + cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception: " << ex.what() << endl; throw; } catch (...) { - cerr << - __PRETTY_FUNCTION__ << - ":" << __LINE__ << ": caught an exception" << endl; + cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception" << endl; throw runtime_error("RWLock::down(): caught an exception"); } } @@ -293,16 +289,12 @@ again: } catch (std::exception& ex) { - cerr << - __PRETTY_FUNCTION__ << - ":" << __LINE__ << ": caught an exception: " << ex.what() << endl; + cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception: " << ex.what() << endl; throw; } catch (...) { - cerr << - __PRETTY_FUNCTION__ << - ":" << __LINE__ << ": caught an exception" << endl; + cerr << __PRETTY_FUNCTION__ << ":" << __LINE__ << ": caught an exception" << endl; throw runtime_error("RWLock::timed_down(): caught an exception"); } diff --git a/utils/statistics_manager/statistics.cpp b/utils/statistics_manager/statistics.cpp index ff68eb381..b32007855 100644 --- a/utils/statistics_manager/statistics.cpp +++ b/utils/statistics_manager/statistics.cpp @@ -28,7 +28,7 @@ using namespace idbdatafile; using namespace logging; - +using namespace std; namespace statistics { StatisticsManager* StatisticsManager::instance() diff --git a/utils/udfsdk/allnull.h b/utils/udfsdk/allnull.h index 31cbff06d..fd9408b74 100644 --- a/utils/udfsdk/allnull.h +++ b/utils/udfsdk/allnull.h @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -70,7 +70,7 @@ class allnull : public mcsv1_UDAF { public: // Defaults OK - allnull() : mcsv1_UDAF(){}; + allnull() : mcsv1_UDAF() {}; ~allnull() override = default; /** diff --git a/utils/udfsdk/avg_mode.h b/utils/udfsdk/avg_mode.h index ca858f39e..995044e33 100644 --- a/utils/udfsdk/avg_mode.h +++ b/utils/udfsdk/avg_mode.h @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -101,7 +101,7 @@ class avg_mode : public mcsv1_UDAF { public: // Defaults OK - avg_mode() : mcsv1_UDAF(){}; + avg_mode() : mcsv1_UDAF() {}; ~avg_mode() override = default; /** diff --git a/utils/udfsdk/avgx.h b/utils/udfsdk/avgx.h index 6ef970787..137bff242 100644 --- a/utils/udfsdk/avgx.h +++ b/utils/udfsdk/avgx.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -60,7 +60,7 @@ class avgx : public mcsv1_UDAF { public: // Defaults OK - avgx() : mcsv1_UDAF(){}; + avgx() : mcsv1_UDAF() {}; ~avgx() override = default; ReturnCode init(mcsv1Context* context, ColumnDatum* colTypes) override; diff --git a/utils/udfsdk/mcsv1_udaf.h b/utils/udfsdk/mcsv1_udaf.h index a82a8d402..8a0c1783c 100644 --- a/utils/udfsdk/mcsv1_udaf.h +++ b/utils/udfsdk/mcsv1_udaf.h @@ -67,7 +67,8 @@ #include #include #include -#include +#include + #include "any.hpp" #include "calpontsystemcatalog.h" #include "wf_frame.h" diff --git a/utils/udfsdk/median.h b/utils/udfsdk/median.h index bb8b544a9..daa597692 100644 --- a/utils/udfsdk/median.h +++ b/utils/udfsdk/median.h @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -101,7 +101,7 @@ class median : public mcsv1_UDAF { public: // Defaults OK - median() : mcsv1_UDAF(){}; + median() : mcsv1_UDAF() {}; ~median() override = default; /** diff --git a/utils/udfsdk/ssq.h b/utils/udfsdk/ssq.h index 2b20dbc2b..22f09f01e 100644 --- a/utils/udfsdk/ssq.h +++ b/utils/udfsdk/ssq.h @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include "mcsv1_udaf.h" #include "calpontsystemcatalog.h" @@ -80,7 +80,7 @@ class ssq : public mcsv1_UDAF { public: // Defaults OK - ssq() : mcsv1_UDAF(){}; + ssq() : mcsv1_UDAF() {}; ~ssq() override = default; /** diff --git a/utils/udfsdk/udfmysql.cpp b/utils/udfsdk/udfmysql.cpp index add530688..1cabe7340 100644 --- a/utils/udfsdk/udfmysql.cpp +++ b/utils/udfsdk/udfmysql.cpp @@ -2,10 +2,11 @@ #include #include #include -using namespace std; #include "idb_mysql.h" +using namespace std; + namespace { inline double cvtArgToDouble(int t, const char* v) diff --git a/utils/windowfunction/wf_count.h b/utils/windowfunction/wf_count.h index ab65b75dc..8d191af42 100644 --- a/utils/windowfunction/wf_count.h +++ b/utils/windowfunction/wf_count.h @@ -38,7 +38,8 @@ class WF_count : public WindowFunctionType WindowFunctionType* clone() const override; void resetData() override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: uint64_t fCount; diff --git a/utils/windowfunction/wf_lead_lag.h b/utils/windowfunction/wf_lead_lag.h index 7f2219eae..ca0e67412 100644 --- a/utils/windowfunction/wf_lead_lag.h +++ b/utils/windowfunction/wf_lead_lag.h @@ -38,7 +38,8 @@ class WF_lead_lag : public WindowFunctionType void resetData() override; void parseParms(const std::vector&) override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: T fValue; diff --git a/utils/windowfunction/wf_min_max.h b/utils/windowfunction/wf_min_max.h index b0381f7e6..79c783264 100644 --- a/utils/windowfunction/wf_min_max.h +++ b/utils/windowfunction/wf_min_max.h @@ -37,7 +37,8 @@ class WF_min_max : public WindowFunctionType WindowFunctionType* clone() const override; void resetData() override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: T fValue; diff --git a/utils/windowfunction/wf_nth_value.h b/utils/windowfunction/wf_nth_value.h index d12835030..43ab94ba7 100644 --- a/utils/windowfunction/wf_nth_value.h +++ b/utils/windowfunction/wf_nth_value.h @@ -38,7 +38,8 @@ class WF_nth_value : public WindowFunctionType void resetData() override; void parseParms(const std::vector&) override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: T fValue; diff --git a/utils/windowfunction/wf_ntile.h b/utils/windowfunction/wf_ntile.h index e85524e4e..bbbef014b 100644 --- a/utils/windowfunction/wf_ntile.h +++ b/utils/windowfunction/wf_ntile.h @@ -38,7 +38,8 @@ class WF_ntile : public WindowFunctionType void resetData() override; void parseParms(const std::vector&) override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: uint64_t fNtile; diff --git a/utils/windowfunction/wf_percentile.h b/utils/windowfunction/wf_percentile.h index 64b092b9b..d9040d8ac 100644 --- a/utils/windowfunction/wf_percentile.h +++ b/utils/windowfunction/wf_percentile.h @@ -39,7 +39,8 @@ class WF_percentile : public WindowFunctionType void resetData() override; void parseParms(const std::vector&) override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: double fNve; diff --git a/utils/windowfunction/wf_ranking.h b/utils/windowfunction/wf_ranking.h index 063d1795d..5364356ae 100644 --- a/utils/windowfunction/wf_ranking.h +++ b/utils/windowfunction/wf_ranking.h @@ -37,7 +37,8 @@ class WF_ranking : public WindowFunctionType WindowFunctionType* clone() const override; void resetData() override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: uint64_t fRank; diff --git a/utils/windowfunction/wf_row_number.h b/utils/windowfunction/wf_row_number.h index dcd20e718..f1104b1d8 100644 --- a/utils/windowfunction/wf_row_number.h +++ b/utils/windowfunction/wf_row_number.h @@ -37,7 +37,8 @@ class WF_row_number : public WindowFunctionType WindowFunctionType* clone() const override; void resetData() override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: uint64_t fRowNumber; diff --git a/utils/windowfunction/wf_stats.h b/utils/windowfunction/wf_stats.h index 843b0e98a..7634e02ea 100644 --- a/utils/windowfunction/wf_stats.h +++ b/utils/windowfunction/wf_stats.h @@ -37,7 +37,8 @@ class WF_stats : public WindowFunctionType WindowFunctionType* clone() const override; void resetData() override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: long double mean_; diff --git a/utils/windowfunction/wf_sum_avg.h b/utils/windowfunction/wf_sum_avg.h index 130fbec7c..e1a55234b 100644 --- a/utils/windowfunction/wf_sum_avg.h +++ b/utils/windowfunction/wf_sum_avg.h @@ -42,7 +42,8 @@ class WF_sum_avg : public WindowFunctionType WindowFunctionType* clone() const override; void resetData() override; - static boost::shared_ptr makeFunction(int, const string&, int, WindowFunctionColumn*); + static boost::shared_ptr makeFunction(int, const std::string&, int, + WindowFunctionColumn*); protected: T_IN fVal; diff --git a/utils/windowfunction/wf_udaf.h b/utils/windowfunction/wf_udaf.h index 655184f82..033af9cc7 100644 --- a/utils/windowfunction/wf_udaf.h +++ b/utils/windowfunction/wf_udaf.h @@ -19,7 +19,8 @@ #pragma once -#include +#include + #include "windowfunctiontype.h" #include "mcsv1_udaf.h" @@ -101,7 +102,7 @@ class WF_udaf : public WindowFunctionType static_any::any fValOut; // The return value public: - static boost::shared_ptr makeFunction(int id, const string& name, int ct, + static boost::shared_ptr makeFunction(int id, const std::string& name, int ct, mcsv1sdk::mcsv1Context& context, WindowFunctionColumn* wc); }; diff --git a/versioning/BRM/brmtypes.h b/versioning/BRM/brmtypes.h index b82f41e5d..336db709f 100644 --- a/versioning/BRM/brmtypes.h +++ b/versioning/BRM/brmtypes.h @@ -33,7 +33,8 @@ #include "mcs_basic_types.h" #include "logicalpartition.h" -#include +#include + #ifndef _UNORDERED_MAP_FIX_ #define _UNORDERED_MAP_FIX_ #endif //_UNORDERED_MAP_FIX_ diff --git a/versioning/BRM/dbrm.h b/versioning/BRM/dbrm.h index ee1e9764e..6a115d755 100644 --- a/versioning/BRM/dbrm.h +++ b/versioning/BRM/dbrm.h @@ -626,7 +626,7 @@ class DBRM * The updated lbidList is used by invalidateUncommittedExtentLBIDs(). * @param lbidList (in and out) This contains the ranges of LBIDs */ - EXPORT void addToLBIDList(uint32_t sessionID, vector& lbidList); + EXPORT void addToLBIDList(uint32_t sessionID, std::vector& lbidList); /** @brief Atomically prepare to copy data to the version buffer * diff --git a/versioning/BRM/extentmap.cpp b/versioning/BRM/extentmap.cpp index dab00c1cc..11df20fa5 100644 --- a/versioning/BRM/extentmap.cpp +++ b/versioning/BRM/extentmap.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include diff --git a/versioning/BRM/extentmap.h b/versioning/BRM/extentmap.h index 8edc42915..dd70c5897 100644 --- a/versioning/BRM/extentmap.h +++ b/versioning/BRM/extentmap.h @@ -30,8 +30,8 @@ #include #include #include -#include -#include +#include + #include // #define NDEBUG @@ -41,7 +41,6 @@ #include #include - #include #include diff --git a/versioning/BRM/lbidresourcegraph.h b/versioning/BRM/lbidresourcegraph.h index 7d3d2d5cc..637c79cc1 100644 --- a/versioning/BRM/lbidresourcegraph.h +++ b/versioning/BRM/lbidresourcegraph.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include "brmtypes.h" diff --git a/versioning/BRM/oid-client.cpp b/versioning/BRM/oid-client.cpp index 35d93d68c..79bf52957 100644 --- a/versioning/BRM/oid-client.cpp +++ b/versioning/BRM/oid-client.cpp @@ -39,23 +39,24 @@ int main(int argc, char** argv) uint32_t lowerOid; uint32_t upperOid; - desc.add_options()("help", "produce help message") - ("lower-oid,l", po::value(&lowerOid)->required(), "lower oid that can not be lower 3000") - ("upper-oid,u", po::value(&upperOid)->required(), "lower oid that can not be bigger 16 * 1024 ^ 2"); + desc.add_options()("help", "produce help message")( + "lower-oid,l", po::value(&lowerOid)->required(), "lower oid that can not be lower 3000")( + "upper-oid,u", po::value(&upperOid)->required(), + "lower oid that can not be bigger 16 * 1024 ^ 2"); po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); if (argc == 1 || vm.count("help")) { - cout << desc << "\n"; + std::cout << desc << "\n"; return 1; } uint32_t bitMapSize = 8 * 2 * 1024 * 1024; - check_value(vm, "lower-oid", 3000, bitMapSize-1); + check_value(vm, "lower-oid", 3000, bitMapSize - 1); check_value(vm, "upper-oid", lowerOid, bitMapSize); - + po::notify(vm); BRM::DBRM brm; diff --git a/versioning/BRM/vbbm.cpp b/versioning/BRM/vbbm.cpp index b485304e3..6bae00fe5 100644 --- a/versioning/BRM/vbbm.cpp +++ b/versioning/BRM/vbbm.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -540,7 +539,7 @@ int VBBM::lookup(LBID_t lbid, VER_t verID, OID_t& oid, uint32_t& fbo) const { int index, prev, bucket; - //#ifdef BRM_DEBUG + // #ifdef BRM_DEBUG if (lbid < 0) { log("VBBM::lookup(): lbid must be >= 0", logging::LOG_TYPE_DEBUG); @@ -553,7 +552,7 @@ int VBBM::lookup(LBID_t lbid, VER_t verID, OID_t& oid, uint32_t& fbo) const throw invalid_argument("VBBM::lookup(): verID must be > 1)"); } - //#endif + // #endif index = getIndex(lbid, verID, prev, bucket); @@ -1011,8 +1010,8 @@ void VBBM::loadVersion2(IDBDataFile* in) true); } -//#include "boost/date_time/posix_time/posix_time.hpp" -// using namespace boost::posix_time; +// #include "boost/date_time/posix_time/posix_time.hpp" +// using namespace boost::posix_time; void VBBM::load(string filename) { diff --git a/writeengine/bulk/we_colextinf.h b/writeengine/bulk/we_colextinf.h index eed8a4844..693e9c2ce 100644 --- a/writeengine/bulk/we_colextinf.h +++ b/writeengine/bulk/we_colextinf.h @@ -30,7 +30,8 @@ #include #include #include -#include +#include + #include #include "brmtypes.h" @@ -143,13 +144,13 @@ class ColExtInfBase { } - virtual void addOrUpdateEntry(RID /*lastInputRow*/, int64_t /*minVal*/, int64_t /*maxVal*/, ColDataType /*colDataType*/, - int /*width*/) + virtual void addOrUpdateEntry(RID /*lastInputRow*/, int64_t /*minVal*/, int64_t /*maxVal*/, + ColDataType /*colDataType*/, int /*width*/) { } - virtual void addOrUpdateEntry(RID /*lastInputRow*/, int128_t /*minVal*/, int128_t /*maxVal*/, ColDataType /*colDataType*/, - int /*width*/) + virtual void addOrUpdateEntry(RID /*lastInputRow*/, int128_t /*minVal*/, int128_t /*maxVal*/, + ColDataType /*colDataType*/, int /*width*/) { } diff --git a/writeengine/bulk/we_extentstripealloc.h b/writeengine/bulk/we_extentstripealloc.h index acdee123e..7395e004b 100644 --- a/writeengine/bulk/we_extentstripealloc.h +++ b/writeengine/bulk/we_extentstripealloc.h @@ -29,7 +29,8 @@ #include #include -#include +#include + #include #include "we_type.h" @@ -64,17 +65,17 @@ class AllocExtEntry { } - OID fOid = 0; // column OID - int fColWidth = 0; // colum width (in bytes) - uint16_t fDbRoot = 0; // DBRoot of allocated extent - uint32_t fPartNum = 0; // Partition number of allocated extent - uint16_t fSegNum = 0; // Segment number of allocated extent - BRM::LBID_t fStartLbid = 0; // Starting LBID of allocated extent - int fAllocSize = 0; // Number of allocated LBIDS - HWM fHwm = 0; // Starting fbo or hwm of allocated extent - int fStatus = NO_ERROR; // Status of extent allocation - std::shared_ptr fStatusMsg{new std::string()}; // Status msg of extent allocation - unsigned int fStripeKey = 0; // "Stripe" identifier for this extent + OID fOid = 0; // column OID + int fColWidth = 0; // colum width (in bytes) + uint16_t fDbRoot = 0; // DBRoot of allocated extent + uint32_t fPartNum = 0; // Partition number of allocated extent + uint16_t fSegNum = 0; // Segment number of allocated extent + BRM::LBID_t fStartLbid = 0; // Starting LBID of allocated extent + int fAllocSize = 0; // Number of allocated LBIDS + HWM fHwm = 0; // Starting fbo or hwm of allocated extent + int fStatus = NO_ERROR; // Status of extent allocation + std::shared_ptr fStatusMsg{new std::string()}; // Status msg of extent allocation + unsigned int fStripeKey = 0; // "Stripe" identifier for this extent }; //------------------------------------------------------------------------------ diff --git a/writeengine/wrapper/writeengine.h b/writeengine/wrapper/writeengine.h index 21b93948d..2884ceb32 100644 --- a/writeengine/wrapper/writeengine.h +++ b/writeengine/wrapper/writeengine.h @@ -29,7 +29,7 @@ #include // end #include -#include +#include #include "we_brm.h" #include "we_colop.h" @@ -125,8 +125,8 @@ class WriteEngineWrapper : public WEObj * purpose and not for generic use */ int buildIndex(const OID& /*colOid*/, const OID& /*treeOid*/, const OID& /*listOid*/, - execplan::CalpontSystemCatalog::ColDataType /*colDataType*/, int /*width*/, int /*hwm*/, bool /*resetFile*/, - uint64_t& /*totalRows*/, int /*maxRow*/ = IDX_DEFAULT_READ_ROW) + execplan::CalpontSystemCatalog::ColDataType /*colDataType*/, int /*width*/, int /*hwm*/, + bool /*resetFile*/, uint64_t& /*totalRows*/, int /*maxRow*/ = IDX_DEFAULT_READ_ROW) { return -1; } @@ -135,9 +135,9 @@ class WriteEngineWrapper : public WEObj * @brief Build a index from a file */ int buildIndex(const std::string& /*sourceFileName*/, const OID& /*treeOid*/, const OID& /*listOid*/, - execplan::CalpontSystemCatalog::ColDataType /*colDataType*/, int /*width*/, int /*hwm*/, bool /*resetFile*/, - uint64_t& /*totalRows*/, const std::string& /*indexName*/, Log* /*pLogger*/, - int /*maxRow*/ = IDX_DEFAULT_READ_ROW) + execplan::CalpontSystemCatalog::ColDataType /*colDataType*/, int /*width*/, int /*hwm*/, + bool /*resetFile*/, uint64_t& /*totalRows*/, const std::string& /*indexName*/, + Log* /*pLogger*/, int /*maxRow*/ = IDX_DEFAULT_READ_ROW) { return -1; }