You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Merge branch 'develop' into MCOL-4841
# Conflicts: # exemgr/main.cpp # oam/etc/Columnstore.xml.singleserver # primitives/primproc/primproc.cpp
This commit is contained in:
141
.drone.jsonnet
141
.drone.jsonnet
@ -1,27 +1,24 @@
|
||||
local events = ['pull_request', 'cron'];
|
||||
|
||||
local platforms = {
|
||||
develop: ['opensuse/leap:15', 'centos:7', 'centos:8', 'debian:10', 'ubuntu:18.04', 'ubuntu:20.04'],
|
||||
'develop-7': ['opensuse/leap:15', 'centos:7', 'centos:8', 'debian:10', 'ubuntu:18.04', 'ubuntu:20.04'],
|
||||
'develop-6': ['opensuse/leap:15', 'centos:7', 'centos:8', 'debian:10', 'ubuntu:18.04', 'ubuntu:20.04'],
|
||||
'develop-5': ['opensuse/leap:15', 'centos:7', 'centos:8', 'debian:10', 'ubuntu:18.04', 'ubuntu:20.04'],
|
||||
develop: ['centos:7', 'rockylinux:8', 'debian:10', 'ubuntu:20.04'],
|
||||
'develop-6': ['centos:7', 'rockylinux:8', 'debian:10', 'ubuntu:20.04'],
|
||||
'develop-5': ['centos:7', 'rockylinux:8', 'debian:10', 'ubuntu:20.04'],
|
||||
};
|
||||
|
||||
local platforms_arm = {
|
||||
develop: ['centos:8'],
|
||||
'develop-7': ['centos:8'],
|
||||
'develop-6': ['centos:8'],
|
||||
develop: ['rockylinux:8'],
|
||||
'develop-6': ['rockylinux:8'],
|
||||
};
|
||||
|
||||
local any_branch = '**';
|
||||
local platforms_custom = ['opensuse/leap:15', 'centos:7', 'centos:8', 'debian:10', 'ubuntu:18.04', 'ubuntu:20.04'];
|
||||
local platforms_arm_custom = ['centos:8'];
|
||||
local platforms_custom = ['centos:7', 'rockylinux:8', 'debian:10', 'ubuntu:20.04'];
|
||||
local platforms_arm_custom = ['rockylinux:8'];
|
||||
|
||||
local platforms_mtr = ['centos:7', 'centos:8', 'ubuntu:20.04'];
|
||||
local platforms_mtr = ['centos:7', 'rockylinux:8', 'ubuntu:20.04'];
|
||||
|
||||
local server_ref_map = {
|
||||
develop: '10.8',
|
||||
'develop-7': '10.7',
|
||||
'develop-6': '10.6-enterprise',
|
||||
'develop-5': '10.5',
|
||||
'**': '10.8',
|
||||
@ -32,31 +29,31 @@ local builddir = 'verylongdirnameforverystrangecpackbehavior';
|
||||
local cmakeflags = '-DCMAKE_BUILD_TYPE=RelWithDebInfo -DPLUGIN_COLUMNSTORE=YES -DPLUGIN_XPAND=NO -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO ' +
|
||||
'-DPLUGIN_TOKUDB=NO -DPLUGIN_CONNECT=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_SPHINX=NO ' +
|
||||
'-DWITH_EMBEDDED_SERVER=OFF -DWITH_WSREP=OFF ' +
|
||||
'-DBUILD_CONFIG=mysql_release -DWITH_UNITTESTS=YES';
|
||||
'-DBUILD_CONFIG=mysql_release -DWITH_UNITTESTS=YES -DCMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE=PRE_TEST';
|
||||
|
||||
|
||||
local gcc_update_alternatives = 'update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 ';
|
||||
local clang12_update_alternatives = 'update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-12 ';
|
||||
local clang12_update_alternatives = 'update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-12 && update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 ';
|
||||
|
||||
|
||||
local yum_vault_mirror = "sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*; sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*; ";
|
||||
local rpm_build_deps = 'install -y lz4 systemd-devel git make libaio-devel openssl-devel boost-devel bison snappy-devel flex libcurl-devel libxml2-devel ncurses-devel automake libtool policycoreutils-devel rpm-build lsof iproute pam-devel perl-DBI cracklib-devel expect createrepo ';
|
||||
local centos7_build_deps = 'yum install -y epel-release centos-release-scl && yum install -y pcre2-devel devtoolset-10 devtoolset-10-gcc cmake3 lz4-devel && ln -s /usr/bin/cmake3 /usr/bin/cmake && . /opt/rh/devtoolset-10/enable ';
|
||||
local centos8_build_deps = yum_vault_mirror + ' yum install -y gcc-toolset-10 libarchive dnf-plugins-core cmake lz4-devel && . /opt/rh/gcc-toolset-10/enable && yum config-manager --set-enabled powertools ';
|
||||
local centos8_build_deps = 'dnf install -y gcc-toolset-10 libarchive cmake lz4-devel && . /opt/rh/gcc-toolset-10/enable ';
|
||||
local rockylinux8_powertools = "dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled powertools ";
|
||||
local ubuntu18_04_deps = 'apt update && apt install -y gnupg wget && echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main" >> /etc/apt/sources.list && wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && apt update && apt install -y clang-12 &&' + clang12_update_alternatives;
|
||||
local debian10_deps = 'apt update && apt install -y gnupg wget && echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-12 main" >> /etc/apt/sources.list && wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && apt update && apt install -y clang-12 &&' + clang12_update_alternatives;
|
||||
local opensuse_build_deps = 'zypper install -y liblz4-devel cmake libboost_system-devel pcre2-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel libboost_atomic-devel gcc-fortran gcc10 gcc10-c++ && ' + gcc_update_alternatives;
|
||||
local deb_build_deps = 'apt update --yes && apt install --yes --no-install-recommends build-essential devscripts ccache equivs eatmydata dh-systemd && mk-build-deps debian/control -t "apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends" -r -i ';
|
||||
local ubuntu20_04_deps = 'apt update --yes && apt install -y g++-10 && ' + gcc_update_alternatives;
|
||||
local opensuse_build_deps = 'zypper install -y clang12 liblz4-devel cmake libboost_system-devel pcre2-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel libboost_atomic-devel gcc-fortran gcc10 gcc10-c++ && ' + clang12_update_alternatives;
|
||||
local deb_build_deps = 'apt update --yes && apt install --yes --no-install-recommends build-essential devscripts git ccache equivs eatmydata dh-systemd && mk-build-deps debian/control -t "apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends" -r -i ';
|
||||
local ubuntu20_04_deps = 'apt update --yes && apt install -y g++-10 git && ' + gcc_update_alternatives;
|
||||
|
||||
|
||||
local platformMap(platform) =
|
||||
local platformMap(platform, arch) =
|
||||
local clang_force = if (arch == 'arm64') then ' && export CXX=/usr/bin/clang++ && export CC=/usr/bin/clang ' else '';
|
||||
local platform_map = {
|
||||
'opensuse/leap:15': opensuse_build_deps + ' && zypper ' + rpm_build_deps + ' && cmake ' + cmakeflags + ' -DRPM=sles15 && make -j$(nproc) package',
|
||||
'opensuse/leap:15': opensuse_build_deps + ' && zypper ' + rpm_build_deps + clang_force + ' && cmake ' + cmakeflags + ' -DRPM=sles15 && make -j$(nproc) package',
|
||||
'centos:7': centos7_build_deps + ' && yum ' + rpm_build_deps + ' && cmake ' + cmakeflags + ' -DRPM=centos7 && make -j$(nproc) package',
|
||||
'centos:8': centos8_build_deps + ' && yum ' + rpm_build_deps + ' && cmake ' + cmakeflags + ' -DRPM=centos8 && make -j$(nproc) package',
|
||||
'centos:8': centos8_build_deps + ' && dnf ' + rpm_build_deps + ' && cmake ' + cmakeflags + ' -DRPM=centos8 && make -j$(nproc) package',
|
||||
'rockylinux:8': rockylinux8_powertools + ' && ' + centos8_build_deps + ' && dnf ' + rpm_build_deps + ' && cmake ' + cmakeflags + ' -DRPM=rockylinux8 && make -j$(nproc) package',
|
||||
'debian:10': deb_build_deps + " && CMAKEFLAGS='" + cmakeflags + " -DDEB=buster' debian/autobake-deb.sh",
|
||||
'ubuntu:18.04': ubuntu18_04_deps + ' && ' + deb_build_deps + " && CMAKEFLAGS='" + cmakeflags + " -DDEB=bionic' debian/autobake-deb.sh",
|
||||
'ubuntu:20.04': ubuntu20_04_deps + ' && ' + deb_build_deps + " && CMAKEFLAGS='" + cmakeflags + " -DDEB=focal' debian/autobake-deb.sh",
|
||||
};
|
||||
platform_map[platform];
|
||||
@ -67,8 +64,8 @@ local testRun(platform) =
|
||||
'opensuse/leap:15': 'ctest -R columnstore: -j $(nproc) --output-on-failure',
|
||||
'centos:7': 'ctest3 -R columnstore: -j $(nproc) --output-on-failure',
|
||||
'centos:8': 'ctest3 -R columnstore: -j $(nproc) --output-on-failure',
|
||||
'rockylinux:8': 'ctest3 -R columnstore: -j $(nproc) --output-on-failure',
|
||||
'debian:10': 'cd builddir; ctest -R columnstore: -j $(nproc) --output-on-failure',
|
||||
'ubuntu:18.04': 'cd builddir; ctest -R columnstore: -j $(nproc) --output-on-failure',
|
||||
'ubuntu:20.04': 'cd builddir; ctest -R columnstore: -j $(nproc) --output-on-failure',
|
||||
};
|
||||
platform_map[platform];
|
||||
@ -76,26 +73,30 @@ local testRun(platform) =
|
||||
|
||||
local testPreparation(platform) =
|
||||
local platform_map = {
|
||||
'opensuse/leap:15': 'zypper install -y gtest boost-devel libboost_system-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel libboost_atomic-devel cppunit-devel snappy-devel cmake',
|
||||
'centos:7': 'yum -y install epel-release && yum install -y gtest-devel cppunit-devel cmake3 boost-devel snappy-devel',
|
||||
'centos:8': yum_vault_mirror + ' yum install -y dnf-plugins-core libarchive && yum config-manager --set-enabled powertools && yum install -y lz4 gtest-devel cppunit-devel cmake3 boost-devel snappy-devel',
|
||||
'debian:10': 'apt update && apt install --yes libboost-all-dev libgtest-dev libcppunit-dev libsnappy-dev googletest cmake',
|
||||
'ubuntu:18.04': 'apt update && apt install --yes libboost-all-dev libgtest-dev libcppunit-dev googletest libsnappy-dev cmake g++ && cd /usr/src/googletest; cmake . && cmake --build . --target install; cd -',
|
||||
'ubuntu:20.04': 'apt update && apt install --yes libboost-all-dev libgtest-dev libcppunit-dev googletest libsnappy-dev cmake',
|
||||
'opensuse/leap:15': 'zypper install -y git boost-devel libboost_system-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel libboost_atomic-devel cppunit-devel snappy-devel cmake',
|
||||
'centos:7': 'yum -y install epel-release && yum install -y git cppunit-devel cmake3 boost-devel snappy-devel',
|
||||
'centos:8': 'dnf install -y git lz4 cppunit-devel cmake3 boost-devel snappy-devel',
|
||||
'rockylinux:8': rockylinux8_powertools + ' && dnf install -y git lz4 cppunit-devel cmake3 boost-devel snappy-devel',
|
||||
'debian:10': 'apt update && apt install --yes git libboost-all-dev libcppunit-dev libsnappy-dev cmake',
|
||||
'ubuntu:18.04': 'apt update && apt install --yes git libboost-all-dev libcppunit-dev libsnappy-dev cmake g++',
|
||||
'ubuntu:20.04': 'apt update && apt install --yes git libboost-all-dev libcppunit-dev libsnappy-dev cmake',
|
||||
};
|
||||
platform_map[platform];
|
||||
|
||||
|
||||
local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
local pkg_format = if (std.split(platform, ':')[0] == 'centos' || std.split(platform, ':')[0] == 'opensuse/leap') then 'rpm' else 'deb',
|
||||
local pkg_format = if (std.split(platform, ':')[0] == 'centos' || std.split(platform, ':')[0] == 'opensuse/leap' || std.split(platform, ':')[0] == 'rockylinux') then 'rpm' else 'deb',
|
||||
local init = if (pkg_format == 'rpm') then '/usr/lib/systemd/systemd' else 'systemd',
|
||||
local mtr_path = if (pkg_format == 'rpm') then '/usr/share/mysql-test' else '/usr/share/mysql/mysql-test',
|
||||
local socket_path = if (pkg_format == 'rpm') then '/var/lib/mysql/mysql.sock' else '/run/mysqld/mysqld.sock',
|
||||
local config_path_prefix = if (pkg_format == 'rpm') then '/etc/my.cnf.d/' else '/etc/mysql/mariadb.conf.d/50-',
|
||||
local img = if (std.split(platform, ':')[0] == 'centos') then platform else 'romcheck/' + std.strReplace(platform, '/', '-'),
|
||||
local img = if (platform == 'centos:7' || std.split(platform, ':')[0] == 'rockylinux') then platform else 'romcheck/' + std.strReplace(platform, '/', '-'),
|
||||
local regression_ref = if (std.split(branch, '-')[0] == 'develop') then branch else 'develop-6',
|
||||
local branchp = if (branch == '**') then '' else branch,
|
||||
|
||||
local container_tags = if (event == 'cron') then [branch, branch + '-' + std.strReplace(event, '_', '-') + '-${DRONE_BUILD_NUMBER}'] else [branch + '-' + std.strReplace(event, '_', '-') + '-${DRONE_BUILD_NUMBER}'],
|
||||
local container_version = branch + '/' + event + '/${DRONE_BUILD_NUMBER}/' + arch,
|
||||
|
||||
local server_remote = if (std.split(branch, '-')[0] == 'columnstore' || branch == 'develop-6') then 'https://github.com/mariadb-corporation/MariaDBEnterprise' else 'https://github.com/MariaDB/server',
|
||||
|
||||
local pipeline = self,
|
||||
@ -119,6 +120,7 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
delete: 'true',
|
||||
},
|
||||
},
|
||||
|
||||
_volumes:: {
|
||||
mdb: {
|
||||
name: 'mdb',
|
||||
@ -136,9 +138,7 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
commands: [
|
||||
'docker run --volume /sys/fs/cgroup:/sys/fs/cgroup:ro --env DEBIAN_FRONTEND=noninteractive --env MCS_USE_S3_STORAGE=0 --name smoke$${DRONE_BUILD_NUMBER} --privileged --detach ' + img + ' ' + init + ' --unit=basic.target',
|
||||
'docker cp result smoke$${DRONE_BUILD_NUMBER}:/',
|
||||
if (platform == 'centos:8') then 'docker exec -t smoke$${DRONE_BUILD_NUMBER} bash -c "' + yum_vault_mirror + '"' else '',
|
||||
if (std.split(platform, ':')[0] == 'centos') then 'docker exec -t smoke$${DRONE_BUILD_NUMBER} bash -c "yum install -y epel-release which rsyslog hostname && yum install -y /result/*.' + pkg_format + '"' else '',
|
||||
if (platform == 'centos:8') then 'docker exec -t smoke$${DRONE_BUILD_NUMBER} bash -c "sed -i s/enabled=0/enabled=1/ /etc/yum.repos.d/*PowerTools.repo && yum install -y gtest"' else '',
|
||||
if (std.split(platform, ':')[0] == 'centos' || std.split(platform, ':')[0] == 'rockylinux') then 'docker exec -t smoke$${DRONE_BUILD_NUMBER} bash -c "yum install -y epel-release which rsyslog hostname procps-ng && yum install -y /result/*.' + pkg_format + '"' else '',
|
||||
if (pkg_format == 'deb') then 'docker exec -t smoke$${DRONE_BUILD_NUMBER} sed -i "s/exit 101/exit 0/g" /usr/sbin/policy-rc.d',
|
||||
if (pkg_format == 'deb') then 'docker exec -t smoke$${DRONE_BUILD_NUMBER} bash -c "apt update --yes && apt install -y rsyslog hostname && apt install -y -f /result/*.' + pkg_format + '"' else '',
|
||||
if (std.split(platform, '/')[0] == 'opensuse') then 'docker exec -t smoke$${DRONE_BUILD_NUMBER} bash -c "zypper install -y which hostname rsyslog && zypper install -y --allow-unsigned-rpm /result/*.' + pkg_format + '"' else '',
|
||||
@ -161,9 +161,8 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
commands: [
|
||||
'docker run --volume /sys/fs/cgroup:/sys/fs/cgroup:ro --env MYSQL_TEST_DIR=' + mtr_path + ' --env DEBIAN_FRONTEND=noninteractive --env MCS_USE_S3_STORAGE=0 --name mtr$${DRONE_BUILD_NUMBER} --privileged --detach ' + img + ' ' + init + ' --unit=basic.target',
|
||||
'docker cp result mtr$${DRONE_BUILD_NUMBER}:/',
|
||||
if (platform == 'centos:8') then 'docker exec -t mtr$${DRONE_BUILD_NUMBER} bash -c "' + yum_vault_mirror + '"' else '',
|
||||
if (std.split(platform, '/')[0] == 'opensuse') then 'docker exec -t mtr$${DRONE_BUILD_NUMBER} bash -c "zypper install -y which hostname rsyslog patch perl-Data-Dumper-Concise perl-Memoize-ExpireLRU && zypper install -y --allow-unsigned-rpm /result/*.' + pkg_format + '"' else '',
|
||||
if (std.split(platform, ':')[0] == 'centos') then 'docker exec -t mtr$${DRONE_BUILD_NUMBER} bash -c "yum install -y epel-release diffutils which rsyslog hostname patch perl-Data-Dumper perl-Getopt-Long perl-Memoize perl-Time-HiRes cracklib-dicts && yum install -y /result/*.' + pkg_format + '"' else '',
|
||||
if (std.split(platform, ':')[0] == 'centos' || std.split(platform, ':')[0] == 'rockylinux') then 'docker exec -t mtr$${DRONE_BUILD_NUMBER} bash -c "yum install -y epel-release diffutils which rsyslog hostname patch perl-Data-Dumper perl-Getopt-Long perl-Memoize perl-Time-HiRes cracklib-dicts procps-ng && yum install -y /result/*.' + pkg_format + '"' else '',
|
||||
if (pkg_format == 'deb') then 'docker exec -t mtr$${DRONE_BUILD_NUMBER} sed -i "s/exit 101/exit 0/g" /usr/sbin/policy-rc.d',
|
||||
if (pkg_format == 'deb') then 'docker exec -t mtr$${DRONE_BUILD_NUMBER} bash -c "apt update --yes && apt install -y rsyslog hostname patch && apt install -y -f /result/*.' + pkg_format + '"' else '',
|
||||
'docker cp mysql-test/columnstore mtr$${DRONE_BUILD_NUMBER}:' + mtr_path + '/suite/',
|
||||
@ -224,8 +223,7 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
'docker cp /mdb/' + builddir + '/storage/columnstore/columnstore/storage-manager regression$${DRONE_BUILD_NUMBER}:/',
|
||||
// check storage-manager unit test binary file
|
||||
'docker exec -t regression$${DRONE_BUILD_NUMBER} ls -l /storage-manager',
|
||||
if (platform == 'centos:8') then 'docker exec -t regression$${DRONE_BUILD_NUMBER} bash -c "' + yum_vault_mirror + '"' else '',
|
||||
if (std.split(platform, ':')[0] == 'centos') then 'docker exec -t regression$${DRONE_BUILD_NUMBER} bash -c "yum install -y epel-release diffutils tar lz4 wget which rsyslog hostname && yum install -y /result/*.' + pkg_format + '"' else '',
|
||||
if (std.split(platform, ':')[0] == 'centos' || std.split(platform, ':')[0] == 'rockylinux') then 'docker exec -t regression$${DRONE_BUILD_NUMBER} bash -c "yum install -y epel-release diffutils tar lz4 wget which rsyslog hostname procps-ng && yum install -y /result/*.' + pkg_format + '"' else '',
|
||||
if (pkg_format == 'deb') then 'docker exec -t regression$${DRONE_BUILD_NUMBER} sed -i "s/exit 101/exit 0/g" /usr/sbin/policy-rc.d',
|
||||
if (pkg_format == 'deb') then 'docker exec -t regression$${DRONE_BUILD_NUMBER} bash -c "apt update --yes && apt install -y tar liblz4-tool wget rsyslog hostname && apt install -y -f /result/*.' + pkg_format + '"' else '',
|
||||
if (std.split(platform, '/')[0] == 'opensuse') then 'docker exec -t regression$${DRONE_BUILD_NUMBER} bash -c "zypper install -y gzip tar lz4 wget which hostname rsyslog && zypper install -y --allow-unsigned-rpm /result/*.' + pkg_format + '"' else '',
|
||||
@ -282,46 +280,34 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
},
|
||||
dockerfile:: {
|
||||
name: 'dockerfile',
|
||||
image: 'docker:git',
|
||||
volumes: [pipeline._volumes.docker],
|
||||
image: 'alpine/git',
|
||||
commands: [
|
||||
'git clone --depth 1 https://github.com/mariadb-corporation/mariadb-community-columnstore-docker.git',
|
||||
'cd mariadb-community-columnstore-docker',
|
||||
'apk add --no-cache patch',
|
||||
'patch Dockerfile ../Dockerfile.patch',
|
||||
'cp ../result/MariaDB-common-10* ../result/MariaDB-client-10* ../result/MariaDB-server-10* ../result/MariaDB-shared-10* ../result/MariaDB-columnstore-engine-10* ./',
|
||||
'git clone --depth 1 https://github.com/mariadb-corporation/mariadb-skysql-columnstore-docker docker',
|
||||
"sed -i 's|dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup|cspkg.s3.amazonaws.com/cs_repo|' docker/Dockerfile",
|
||||
],
|
||||
},
|
||||
ecr:: {
|
||||
name: 'ecr',
|
||||
image: 'plugins/ecr',
|
||||
settings: {
|
||||
registry: '866067714787.dkr.ecr.us-east-1.amazonaws.com',
|
||||
repo: 'columnstore/engine',
|
||||
context: 'mariadb-community-columnstore-docker',
|
||||
dockerfile: 'mariadb-community-columnstore-docker/Dockerfile',
|
||||
access_key: {
|
||||
from_secret: 'aws_access_key_id',
|
||||
},
|
||||
secret_key: {
|
||||
from_secret: 'aws_secret_access_key',
|
||||
},
|
||||
},
|
||||
},
|
||||
docker:: {
|
||||
name: 'docker',
|
||||
dockerhub:: {
|
||||
name: 'dockerhub',
|
||||
image: 'plugins/docker',
|
||||
environment: {
|
||||
VERSION: container_version,
|
||||
},
|
||||
settings: {
|
||||
repo: 'romcheck/columnstore',
|
||||
context: '/drone/src/mariadb-community-columnstore-docker',
|
||||
dockerfile: 'mariadb-community-columnstore-docker/Dockerfile',
|
||||
username: 'romcheck',
|
||||
repo: 'mariadb/enterprise-columnstore-dev',
|
||||
context: 'docker',
|
||||
dockerfile: 'docker/Dockerfile',
|
||||
build_args_from_env: ['VERSION'],
|
||||
tags: container_tags,
|
||||
username: {
|
||||
from_secret: 'dockerhub_user',
|
||||
},
|
||||
password: {
|
||||
from_secret: 'dockerhub_token',
|
||||
from_secret: 'dockerhub_password',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
kind: 'pipeline',
|
||||
type: 'docker',
|
||||
name: std.join(' ', [branch, platform, event, arch]),
|
||||
@ -362,7 +348,7 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
},
|
||||
{
|
||||
name: 'build',
|
||||
image: platform,
|
||||
image: img,
|
||||
volumes: [pipeline._volumes.mdb],
|
||||
environment: {
|
||||
DEBIAN_FRONTEND: 'noninteractive',
|
||||
@ -370,7 +356,6 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
},
|
||||
commands: [
|
||||
'cd /mdb/' + builddir,
|
||||
if (platform == 'centos:8') then yum_vault_mirror else '',
|
||||
// Remove Debian build flags that could prevent ColumnStore from building
|
||||
"sed '/-DPLUGIN_COLUMNSTORE=NO/d' -i debian/rules",
|
||||
// Tweak debian packaging stuff
|
||||
@ -392,22 +377,18 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
// Leave test package for mtr
|
||||
"sed -i '/(mariadb|mysql)-test/d;/-test/d' debian/autobake-deb.sh",
|
||||
"sed -i '/test-embedded/d' debian/mariadb-test.install",
|
||||
// From Debian Bullseye/Ubuntu Groovy, liburing replaces libaio
|
||||
"apt-cache madison liburing-dev | grep 'liburing-dev' || sed 's/liburing-dev/libaio-dev/g' -i debian/control && sed '/-DIGNORE_AIO_CHECK=YES/d' -i debian/rules && sed '/-DWITH_URING=yes/d' -i debian/rules",
|
||||
// From Debian Buster/Ubuntu Focal onwards libpmem-dev is available
|
||||
"apt-cache madison libpmem-dev | grep 'libpmem-dev' || sed '/libpmem-dev/d' -i debian/control && sed '/-DWITH_PMEM/d' -i debian/rules",
|
||||
// Deb dependencies from server scripts
|
||||
if (pkg_format == 'deb') then "apt-cache madison liburing-dev | grep liburing-dev || sed 's/liburing-dev/libaio-dev/g' -i debian/control && sed '/-DIGNORE_AIO_CHECK=YES/d' -i debian/rules && sed '/-DWITH_URING=yes/d' -i debian/rules && apt-cache madison libpmem-dev | grep 'libpmem-dev' || sed '/libpmem-dev/d' -i debian/control && sed '/-DWITH_PMEM/d' -i debian/rules && sed '/libfmt-dev/d' -i debian/control" else '',
|
||||
// Change plugin_maturity level
|
||||
// "sed -i 's/BETA/GAMMA/' storage/columnstore/CMakeLists.txt",
|
||||
// Workaround till upstream removes 4535 workaround (workaround for workaround!)
|
||||
"sed -i '/MCOL-4535/,/^$/d' debian/autobake-deb.sh",
|
||||
testPreparation(platform),
|
||||
platformMap(platform),
|
||||
platformMap(platform, arch),
|
||||
if (pkg_format == 'rpm') then 'createrepo .' else 'dpkg-scanpackages ../ | gzip > ../Packages.gz',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'unittests',
|
||||
image: platform,
|
||||
image: img,
|
||||
volumes: [pipeline._volumes.mdb],
|
||||
environment: {
|
||||
DEBIAN_FRONTEND: 'noninteractive',
|
||||
@ -437,7 +418,7 @@ local Pipeline(branch, platform, event, arch='amd64') = {
|
||||
] +
|
||||
[pipeline.publish()] +
|
||||
(if (event == 'cron') || (event == 'push') then [pipeline.publish('pkg latest', 'latest')] else []) +
|
||||
// (if (platform == 'centos:8' && event == 'cron') then [pipeline.dockerfile] + [pipeline.docker] + [pipeline.ecr] else []) +
|
||||
(if (event != 'custom') && (platform == 'rockylinux:8') && (arch == 'amd64') && (branch != 'develop-5') then [pipeline.dockerfile] + [pipeline.dockerhub] else []) +
|
||||
[pipeline.smoke] +
|
||||
[pipeline.smokelog] +
|
||||
(if (std.member(platforms_mtr, platform)) then [pipeline.mtr] + [pipeline.mtrlog] + [pipeline.publish('mtr')] else []) +
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -14,6 +14,10 @@
|
||||
*.so.*
|
||||
*.vpj
|
||||
.libs/
|
||||
.cache/
|
||||
compile_commands.json
|
||||
*.code-workspace
|
||||
settings.json
|
||||
config.log
|
||||
*~
|
||||
*kdev*
|
||||
@ -172,3 +176,4 @@ mariadb-columnstore-regression-test/
|
||||
build/Testing/
|
||||
tests/*\[1\]_tests.cmake
|
||||
tests/*\[1\]_include.cmake
|
||||
.boost
|
||||
|
@ -28,7 +28,7 @@ endif()
|
||||
INCLUDE(ExternalProject)
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 17)
|
||||
SET(CMAKE_CXX_STANDARD 20)
|
||||
SET(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
SET(CMAKE_CXX_EXTENSIONS FALSE)
|
||||
SET(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||
@ -95,12 +95,7 @@ SET (ENGINE_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
INCLUDE(columnstore_version)
|
||||
INCLUDE(misc)
|
||||
|
||||
FIND_PACKAGE(Boost 1.53.0 COMPONENTS system filesystem thread regex date_time chrono atomic)
|
||||
IF (NOT Boost_FOUND)
|
||||
MESSAGE_ONCE(CS_NO_BOOST "Required Boost libraries not found!")
|
||||
return()
|
||||
ENDIF()
|
||||
INCLUDE(boost)
|
||||
|
||||
FIND_PACKAGE(BISON)
|
||||
IF (NOT BISON_FOUND)
|
||||
@ -149,14 +144,6 @@ if (NOT CURL_FOUND)
|
||||
return()
|
||||
endif()
|
||||
|
||||
IF (WITH_UNITTESTS OR WITH_GTEST)
|
||||
INCLUDE (FindGTest)
|
||||
IF (NOT GTEST_FOUND)
|
||||
MESSAGE(FATAL_ERROR "GSuite libs not found but are requested. Please install them or build.")
|
||||
ENDIF()
|
||||
SET (GTEST_LIBRARIES ${GTEST_LIBRARY} ${GTESTMAIN_LIBRARY} ${PTHREAD_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
FIND_PROGRAM(AWK_EXECUTABLE awk DOC "path to the awk executable")
|
||||
if(NOT AWK_EXECUTABLE)
|
||||
MESSAGE_ONCE(CS_NO_AWK "awk not found!")
|
||||
@ -222,8 +209,13 @@ IF (MASK_LONGDOUBLE)
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-DMASK_LONGDOUBLE")
|
||||
ENDIF()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-enum-enum-conversion -Wno-register")
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-register")
|
||||
endif()
|
||||
|
||||
SET (CMAKE_REQUIRED_FLAGS "-Werror -Wall")
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-Werror -Wall")
|
||||
SET (ENGINE_LDFLAGS "-Wl,--no-as-needed -Wl,--add-needed")
|
||||
SET (ENGINE_DT_LIB datatypes)
|
||||
SET (ENGINE_COMMON_LIBS messageqcpp loggingcpp configcpp idbboot ${Boost_LIBRARIES} xml2 pthread rt libmysql_client ${ENGINE_DT_LIB})
|
||||
@ -346,7 +338,6 @@ ADD_SUBDIRECTORY(dbcon/ddlpackage)
|
||||
ADD_SUBDIRECTORY(dbcon/ddlpackageproc)
|
||||
ADD_SUBDIRECTORY(dbcon/dmlpackage)
|
||||
ADD_SUBDIRECTORY(dbcon/dmlpackageproc)
|
||||
ADD_SUBDIRECTORY(exemgr)
|
||||
ADD_SUBDIRECTORY(ddlproc)
|
||||
ADD_SUBDIRECTORY(dmlproc)
|
||||
ADD_SUBDIRECTORY(oamapps)
|
||||
|
@ -4,13 +4,15 @@ This is MariaDB Columnstore
|
||||
To build MCS from source you will need:
|
||||
|
||||
* modern linux distribution. e.g. Ubuntu 20
|
||||
* modern C++ compiler: clang version greater than 12 or gcc version greater than 11
|
||||
|
||||
Clone or download this repository.
|
||||
|
||||
git clone https://github.com/MariaDB/server
|
||||
|
||||
Edit a bootstrap script to fix paths to MariaDB repo cloned.
|
||||
vim /some/path/server/storage/columnstore/columnstore/build/bootstrap_mcs.sh
|
||||
Update Sumbodules
|
||||
git submodule update --init --recursive
|
||||
|
||||
Run the bootstrap
|
||||
/some/path/server/storage/columnstore/columnstore/build/bootstrap_mcs.sh
|
||||
bootstrap_mcs.sh could be run with --help for list of flags
|
||||
|
@ -1,179 +1,304 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# This script compiles/installs MCS from scratch and it makes some assumptions:
|
||||
# - the server's source code is two directories above the MCS engine source.
|
||||
# - the script is to be run under root.
|
||||
# - it is run MDB_MDB_SOURCE_PATH/storage/columnstore/columnstore, e.g. ./build/bootstrap_mcs.sh
|
||||
|
||||
DISTRO=$1
|
||||
MDB_BUILD_TYPE=$2
|
||||
MDB_SOURCE_PATH=`pwd`/../../../
|
||||
MCS_CONFIG_DIR=/etc/columnstore
|
||||
# Needs systemd to be installed obviously.
|
||||
# Feel free to ask in MariaDB Zulip how to bootstrap MCS in containers or other systemd-free environments.
|
||||
systemctl stop mariadb-columnstore
|
||||
MDB_GIT_URL=https://github.com/MariaDB/server.git
|
||||
MDB_GIT_TAG=10.8
|
||||
|
||||
if [ -z "$DISTRO" ]; then
|
||||
echo "Choose a distro"
|
||||
|
||||
SCRIPT_LOCATION=$(dirname "$0")
|
||||
MDB_SOURCE_PATH=$(realpath $SCRIPT_LOCATION/../../../..)
|
||||
|
||||
source $SCRIPT_LOCATION/utils.sh
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then error "Please run script as root to install MariaDb to system paths"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $DISTRO = 'bionic' ]; then
|
||||
sudo apt-get -y update
|
||||
apt-get -y install build-essential automake libboost-all-dev bison cmake \
|
||||
libncurses5-dev libaio-dev libsystemd-dev libpcre2-dev \
|
||||
libperl-dev libssl-dev libxml2-dev libkrb5-dev flex libpam-dev git \
|
||||
libsnappy-dev libcurl4-openssl-dev
|
||||
elif [ $DISTRO = 'focal' ]; then
|
||||
sudo apt-get -y update
|
||||
apt-get -y install build-essential automake libboost-all-dev bison cmake \
|
||||
libncurses5-dev libaio-dev libsystemd-dev libpcre2-dev \
|
||||
libperl-dev libssl-dev libxml2-dev libkrb5-dev flex libpam-dev git \
|
||||
libsnappy-dev libcurl4-openssl-dev
|
||||
elif [ $DISTRO = 'centos' ]; then
|
||||
yum -y install epel-release \
|
||||
&& yum -y groupinstall "Development Tools" \
|
||||
&& yum -y install bison ncurses-devel readline-devel perl-devel openssl-devel cmake libxml2-devel gperf libaio-devel libevent-devel python-devel ruby-devel tree wget pam-devel snappy-devel libicu \
|
||||
&& yum -y install vim wget strace ltrace gdb rsyslog net-tools openssh-server expect boost perl-DBI libicu boost-devel initscripts jemalloc-devel libcurl-devel
|
||||
elif [ $DISTRO = 'leap' ]; then
|
||||
zypper install -y bison ncurses-devel readline-devel libopenssl-devel cmake libxml2-devel gperf libaio-devel libevent-devel python-devel ruby-devel tree wget pam-devel snappy-devel libicu-devel \
|
||||
&& zypper install -y libboost_system-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel \
|
||||
&& zypper install -y vim wget strace ltrace gdb rsyslog net-tools expect perl-DBI libicu boost-devel jemalloc-devel libcurl-devel \
|
||||
&& zypper install -y gcc gcc-c++ git automake libtool
|
||||
message "Building Mariadb Server from $color_yellow$MDB_SOURCE_PATH$color_normal"
|
||||
|
||||
BUILD_TYPE_OPTIONS=("Debug" "RelWithDebInfo")
|
||||
DISTRO_OPTIONS=("Ubuntu" "CentOS" "Debian" "openSUSE" "Rocky")
|
||||
BRANCHES=($(git branch --list --no-color| grep "[^* ]+" -Eo))
|
||||
|
||||
optparse.define short=t long=build-type desc="Build Type: ${BUILD_TYPE_OPTIONS[*]}" variable=MCS_BUILD_TYPE
|
||||
optparse.define short=d long=distro desc="Choouse your OS: ${DISTRO_OPTIONS[*]}" variable=OS
|
||||
optparse.define short=s long=skip-deps desc="Skip install dependences" variable=SKIP_DEPS default=false value=true
|
||||
optparse.define short=C long=force-cmake-reconfig desc="Force cmake reconfigure" variable=FORCE_CMAKE_CONFIG 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=b long=branch desc="Choouse git branch ('none' for menu)" variable=BRANCH
|
||||
|
||||
source $( optparse.build )
|
||||
|
||||
if [[ ! " ${BUILD_TYPE_OPTIONS[*]} " =~ " ${MCS_BUILD_TYPE} " ]]; then
|
||||
getChoice -q "Select your Build Type" -o BUILD_TYPE_OPTIONS
|
||||
MCS_BUILD_TYPE=$selectedChoice
|
||||
fi
|
||||
|
||||
if [ ! -d $MDB_SOURCE_PATH ]; then
|
||||
git clone $MDB_GIT_URL $MDB_SOURCE_PATH -b $MDB_GIT_TAG
|
||||
if [[ ! " ${DISTRO_OPTIONS[*]} " =~ " ${OS} " || $OS = "CentOS" ]]; then
|
||||
detect_distro
|
||||
fi
|
||||
|
||||
if [ ! -d $MCS_CONFIG_DIR ]; then
|
||||
mkdir $MCS_CONFIG_DIR
|
||||
fi
|
||||
INSTALL_PREFIX="/usr/"
|
||||
DATA_DIR="/var/lib/mysql/data"
|
||||
CMAKE_BIN_NAME=cmake
|
||||
|
||||
if [ -z "$(grep mysql /etc/passwd)" ]; then
|
||||
echo "Adding user mysql into /etc/passwd"
|
||||
useradd -r -U mysql -d /var/lib/mysql
|
||||
exit 1
|
||||
fi
|
||||
select_branch()
|
||||
{
|
||||
if [[ ! " ${BRANCHES[*]} " =~ " ${BRANCH} " ]]; then
|
||||
if [[ $BRANCH = 'none' ]]; then
|
||||
getChoice -q "Select your branch" -o BRANCHES
|
||||
BRANCH=$selectedChoice
|
||||
fi
|
||||
cd $SCRIPT_LOCATION
|
||||
message "Selecting $BRANCH branch for Columnstore"
|
||||
git checkout $BRANCH
|
||||
cd -
|
||||
|
||||
if [ -z "$(grep mysql /etc/group)" ]; then
|
||||
echo "You need to manually add mysql group into /etc/group, e.g. mysql:x:999"
|
||||
exit 1
|
||||
fi
|
||||
message "Turning off Columnstore submodule auto update via gitconfig"
|
||||
cd $MDB_SOURCE_PATH
|
||||
git config submodule.storage/columnstore/columnstore.update none
|
||||
cd -
|
||||
fi
|
||||
|
||||
MCS_INSTALL_PREFIX=/var/lib/
|
||||
rm -rf /var/lib/columnstore/data1/*
|
||||
rm -rf /var/lib/columnstore/data/
|
||||
rm -rf /var/lib/columnstore/local/
|
||||
rm -f /var/lib/columnstore/storagemanager/storagemanager-lock
|
||||
rm -f /var/lib/columnstore/storagemanager/cs-initialized
|
||||
cd $SCRIPT_LOCATION
|
||||
CURRENT_BRANCH=$(git branch --show-current)
|
||||
cd -
|
||||
message "Columnstore will be built from $color_yellow$CURRENT_BRANCH$color_normal branch"
|
||||
}
|
||||
|
||||
MCS_TMP_DIR=/tmp/columnstore_tmp_files
|
||||
TMP_PATH=/tmp
|
||||
CPUS=$(getconf _NPROCESSORS_ONLN)
|
||||
install_deps()
|
||||
{
|
||||
message "Installing deps"
|
||||
if [[ $OS = 'Ubuntu' || $OS = 'Debian' ]]; then
|
||||
sudo apt-get -y update
|
||||
apt-get -y install build-essential automake libboost-all-dev bison cmake \
|
||||
libncurses5-dev libaio-dev libsystemd-dev libpcre2-dev \
|
||||
libperl-dev libssl-dev libxml2-dev libkrb5-dev flex libpam-dev git \
|
||||
libsnappy-dev libcurl4-openssl-dev libgtest-dev libcppunit-dev googletest libsnappy-dev libjemalloc-dev
|
||||
elif [[ $OS = 'CentOS' || $OS = 'Rocky' ]]; then
|
||||
yum -y install epel-release \
|
||||
&& yum -y groupinstall "Development Tools" \
|
||||
&& yum config-manager --set-enabled powertools \
|
||||
&& yum -y install bison ncurses-devel readline-devel perl-devel openssl-devel libxml2-devel gperf libaio-devel libevent-devel tree wget pam-devel snappy-devel libicu \
|
||||
&& yum -y install vim wget strace ltrace gdb rsyslog net-tools openssh-server expect boost perl-DBI libicu boost-devel initscripts jemalloc-devel libcurl-devel gtest-devel cppunit-devel systemd-devel
|
||||
if [[ "$OS_VERSION" == "7" ]]; then
|
||||
yum -y install cmake3
|
||||
CMAKE_BIN_NAME=cmake3
|
||||
else
|
||||
yum -y install cmake
|
||||
fi
|
||||
if [ $OS = 'Rocky' ]; then
|
||||
yum install -y checkpolicy
|
||||
fi
|
||||
elif [ $OS = 'openSUSE' ]; then
|
||||
zypper install -y bison ncurses-devel readline-devel libopenssl-devel cmake libxml2-devel gperf libaio-devel libevent-devel python-devel ruby-devel tree wget pam-devel snappy-devel libicu-devel \
|
||||
&& zypper install -y libboost_system-devel libboost_filesystem-devel libboost_thread-devel libboost_regex-devel libboost_date_time-devel libboost_chrono-devel libboost_atomic-devel \
|
||||
&& zypper install -y vim wget strace ltrace gdb rsyslog net-tools expect perl-DBI libicu boost-devel jemalloc-devel libcurl-devel liblz4-devel lz4 \
|
||||
&& zypper install -y gcc gcc-c++ git automake libtool gtest cppunit-devel pcre2-devel systemd-devel libaio-devel snappy-devel cracklib-devel policycoreutils-devel ncurses-devel \
|
||||
&& zypper install -y make flex libcurl-devel automake libtool rpm-build lsof iproute pam-devel perl-DBI expect createrepo
|
||||
fi
|
||||
}
|
||||
|
||||
# script
|
||||
rm -rf $MCS_TMP_DIR/*
|
||||
rm -rf /var/lib/mysql
|
||||
stop_service()
|
||||
{
|
||||
message "Stopping MariaDB services"
|
||||
systemctl stop mariadb
|
||||
systemctl stop mariadb-columnstore
|
||||
}
|
||||
|
||||
cd $MDB_SOURCE_PATH
|
||||
if [[ "$DISTRO" = 'bionic' || "$DISTRO" = 'focal' ]]; then
|
||||
#MDB_CMAKE_FLAGS='-DWITH_SYSTEMD=yes -DPLUGIN_TOKUDB=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_GSSAPI=NO -DWITH_MARIABACKUP=NO -DDEB=bionic -DPLUGIN_COLUMNSTORE=YES'
|
||||
MDB_CMAKE_FLAGS='-DWITH_SYSTEMD=yes -DPLUGIN_COLUMNSTORE=YES -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_TOKUDB=NO -DPLUGIN_CONNECT=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_SPHINX=NO -DBUILD_CONFIG=mysql_release -DWITH_WSREP=OFF -DWITH_SSL=system -DDEB=bionic'
|
||||
# Some development flags
|
||||
#MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DWITH_GTEST=1 -DWITH_ROWGROUP_UT=1 -DWITH_DATACONVERT_UT=1 -DWITH_ARITHMETICOPERATOR_UT=1 -DWITH_ORDERBY_UT=1 -DWITH_CSDECIMAL_UT=1 -DWITH_SORTING_COMPARATORS_UT=1"
|
||||
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DWITH_MICROBENCHMARKS=YES -DWITH_BRM_UT=YES" #-DWITH_GTEST=1 -DWITH_UNITTESTS=YES
|
||||
cmake . -DCMAKE_BUILD_TYPE=$MDB_BUILD_TYPE ${MDB_CMAKE_FLAGS} && \
|
||||
check_service()
|
||||
{
|
||||
if systemctl is-active --quiet $1; then
|
||||
message "$1 service started$color_green OK $color_normal"
|
||||
else
|
||||
error "$1 service failed"
|
||||
service $1 status
|
||||
fi
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
message "Starting MariaDB services"
|
||||
systemctl start mariadb-columnstore
|
||||
systemctl start mariadb
|
||||
|
||||
check_service mariadb-columnstore
|
||||
check_service mariadb
|
||||
}
|
||||
|
||||
clean_old_installation()
|
||||
{
|
||||
message "Cleaning old installation"
|
||||
rm -rf /var/lib/columnstore/data1/*
|
||||
rm -rf /var/lib/columnstore/data/
|
||||
rm -rf /var/lib/columnstore/local/
|
||||
rm -f /var/lib/columnstore/storagemanager/storagemanager-lock
|
||||
rm -f /var/lib/columnstore/storagemanager/cs-initialized
|
||||
rm -rf /tmp/*
|
||||
rm -rf /var/lib/mysql
|
||||
rm -rf /var/run/mysqld
|
||||
rm -rf $DATA_DIR
|
||||
rm -rf /etc/mysql
|
||||
}
|
||||
|
||||
build()
|
||||
{
|
||||
message "Building sources in $color_yellow$MCS_BUILD_TYPE$color_normal mode"
|
||||
|
||||
local MDB_CMAKE_FLAGS="-DWITH_SYSTEMD=yes
|
||||
-DPLUGIN_COLUMNSTORE=YES
|
||||
-DPLUGIN_MROONGA=NO
|
||||
-DPLUGIN_ROCKSDB=NO
|
||||
-DPLUGIN_TOKUDB=NO
|
||||
-DPLUGIN_CONNECT=NO
|
||||
-DPLUGIN_SPIDER=NO
|
||||
-DPLUGIN_OQGRAPH=NO
|
||||
-DPLUGIN_SPHINX=NO
|
||||
-DWITH_EMBEDDED_SERVER=OFF
|
||||
-DBUILD_CONFIG=mysql_release
|
||||
-DWITH_WSREP=OFF
|
||||
-DWITH_SSL=system
|
||||
-DWITH_UNITTESTS=YES
|
||||
-DWITH_BRM_UT=YES
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX"
|
||||
|
||||
cd $MDB_SOURCE_PATH
|
||||
|
||||
if [[ $SKIP_SUBMODULES = true ]] ; then
|
||||
warn "Skipping initialization of columnstore submodules"
|
||||
else
|
||||
message "Initialization of columnstore submodules"
|
||||
cd storage/columnstore/columnstore
|
||||
git submodule update --init
|
||||
cd -
|
||||
fi
|
||||
|
||||
if [[ $FORCE_CMAKE_CONFIG = true ]] ; then
|
||||
warn "Erasing cmake cache"
|
||||
rm -f "$MDB_SOURCE_PATH/CMakeCache.txt"
|
||||
rm -rf "$MDB_SOURCE_PATH/CMakeFiles"
|
||||
fi
|
||||
|
||||
if [[ "$OS" = 'Ubuntu' || "$OS" = 'Debian' ]]; then
|
||||
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DDEB=bionic"
|
||||
elif [ $OS = 'CentOS' ]; then
|
||||
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DRPM=CentOS7"
|
||||
elif [ $OS = 'Rocky' ]; then
|
||||
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DRPM=CentOS7"
|
||||
elif [ $OS = 'openSUSE' ]; then
|
||||
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DRPM=sles15"
|
||||
fi
|
||||
|
||||
message "building with flags $MDB_CMAKE_FLAGS"
|
||||
|
||||
local CPUS=$(getconf _NPROCESSORS_ONLN)
|
||||
${CMAKE_BIN_NAME} . -DCMAKE_BUILD_TYPE=$MCS_BUILD_TYPE $MDB_CMAKE_FLAGS && \
|
||||
make -j $CPUS install
|
||||
elif [ $DISTRO = 'centos' ]; then
|
||||
MDB_CMAKE_FLAGS='-DWITH_SYSTEMD=yes -DPLUGIN_AUTH_GSSAPI=NO -DPLUGIN_COLUMNSTORE=YES -DPLUGIN_MROONGA=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_TOKUDB=NO -DPLUGIN_CONNECT=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_SPHINX=NO -DBUILD_CONFIG=mysql_release -DWITH_WSREP=OFF -DWITH_SSL=system -DRPM=CentOS7'
|
||||
cmake . -DCMAKE_BUILD_TYPE=$MDB_BUILD_TYPE $MDB_CMAKE_FLAGS && \
|
||||
make -j $CPUS install
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# These two lines are to handle file layout difference b/w RPM- and DEB-based distributions.
|
||||
# One of the lines always fails.
|
||||
mv /usr/lib/mysql/plugin/ha_columnstore.so /tmp/ha_columnstore_1.so
|
||||
mv /usr/lib64/mysql/plugin/ha_columnstore.so /tmp/ha_columnstore_2.so
|
||||
if [ $? -ne 0 ]; then
|
||||
error "!!!! BUILD FAILED"
|
||||
exit 1
|
||||
fi
|
||||
cd -
|
||||
}
|
||||
|
||||
|
||||
/usr/bin/mysql_install_db --rpm --user=mysql
|
||||
check_user_and_group()
|
||||
{
|
||||
if [ -z "$(grep mysql /etc/passwd)" ]; then
|
||||
message "Adding user mysql into /etc/passwd"
|
||||
useradd -r -U mysql -d /var/lib/mysql
|
||||
fi
|
||||
|
||||
mv /tmp/ha_columnstore_1.so /usr/lib/mysql/plugin/ha_columnstore.so
|
||||
mv /tmp/ha_columnstore_2.so /usr/lib64/mysql/plugin/ha_columnstore.so
|
||||
if [ -z "$(grep mysql /etc/group)" ]; then
|
||||
GroupID = `awk -F: '{uid[$3]=1}END{for(x=100; x<=999; x++) {if(uid[x] != ""){}else{print x; exit;}}}' /etc/group`
|
||||
message "Adding group mysql with id $GroupID"
|
||||
groupadd -g GroupID mysql
|
||||
fi
|
||||
}
|
||||
|
||||
cp -r /etc/mysql/conf.d /etc/my.cnf.d/
|
||||
cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/oam/etc/Columnstore.xml /etc/columnstore/Columnstore.xml
|
||||
cp $MDB_SOURCE_PATH/storage/columnstore/oam/etc/Columnstore.xml /etc/columnstore/Columnstore.xml
|
||||
cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/storage-manager/storagemanager.cnf /etc/columnstore/storagemanager.cnf
|
||||
cp $MDB_SOURCE_PATH/storage/columnstore/storage-manager/storagemanager.cnf /etc/columnstore/storagemanager.cnf
|
||||
install()
|
||||
{
|
||||
message "Installing MariaDB"
|
||||
|
||||
check_user_and_group
|
||||
|
||||
mkdir -p /etc/my.cnf.d
|
||||
|
||||
bash -c 'echo "[client-server]
|
||||
socket=/run/mysqld/mysqld.sock" > /etc/my.cnf.d/socket.cnf'
|
||||
|
||||
mv $INSTALL_PREFIX/lib/mysql/plugin/ha_columnstore.so /tmp/ha_columnstore_1.so || mv $INSTALL_PREFIX/lib64/mysql/plugin/ha_columnstore.so /tmp/ha_columnstore_2.so
|
||||
message "Running mysql_install_db"
|
||||
mysql_install_db --rpm --user=mysql
|
||||
mv /tmp/ha_columnstore_1.so $INSTALL_PREFIX/lib/mysql/plugin/ha_columnstore.so || mv /tmp/ha_columnstore_2.so $INSTALL_PREFIX/lib64/mysql/plugin/ha_columnstore.so
|
||||
|
||||
mkdir -p /etc/columnstore
|
||||
|
||||
cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/oam/etc/Columnstore.xml /etc/columnstore/Columnstore.xml
|
||||
cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/storage-manager/storagemanager.cnf /etc/columnstore/storagemanager.cnf
|
||||
|
||||
cp $MDB_SOURCE_PATH/support-files/*.service /lib/systemd/system/
|
||||
cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/oam/install_scripts/*.service /lib/systemd/system/
|
||||
|
||||
if [[ "$OS" = 'Ubuntu' || "$OS" = 'Debian' ]]; then
|
||||
mkdir -p /usr/share/mysql
|
||||
mkdir -p /etc/mysql/
|
||||
cp $MDB_SOURCE_PATH/debian/additions/debian-start.inc.sh /usr/share/mysql/debian-start.inc.sh
|
||||
cp $MDB_SOURCE_PATH/debian/additions/debian-start /etc/mysql/debian-start
|
||||
> /etc/mysql/debian.cnf
|
||||
fi
|
||||
|
||||
if [[ "$DISTRO" = 'bionic' || "$DISTRO" = 'focal' ]]; then
|
||||
cp ./support-files/*.service /lib/systemd/system/
|
||||
cp ./storage/columnstore/columnstore/oam/install_scripts/*.service /lib/systemd/system/
|
||||
cp ./storage/columnstore/oam/install_scripts/*.service /lib/systemd/system/
|
||||
cp ./debian/additions/debian-start.inc.sh /usr/share/mysql/debian-start.inc.sh
|
||||
cp ./debian/additions/debian-start /etc/mysql/debian-start
|
||||
systemctl daemon-reload
|
||||
rm -f /etc/mysql/my.cnf
|
||||
cp -r /etc/mysql/conf.d/ /etc/my.cnf.d
|
||||
cp -rp /etc/mysql/mariadb.conf.d/ /etc/my.cnf.d
|
||||
mkdir /var/lib/columnstore/data1
|
||||
mkdir /var/lib/columnstore/data1/systemFiles
|
||||
mkdir /var/lib/columnstore/data1/systemFiles/dbrm
|
||||
chown -R mysql:mysql /var/lib/mysql
|
||||
chown -R mysql:mysql /var/lib/mysql
|
||||
chown -R mysql.mysql /var/run/mysqld
|
||||
chown -R mysql:mysql /data/columnstore/*
|
||||
chmod +x /usr/bin/mariadb*
|
||||
cp /etc/my.cnf.d/mariadb.conf.d/columnstore.cnf /etc/my.cnf.d/
|
||||
|
||||
ldconfig
|
||||
columnstore-post-install
|
||||
chown -R mysql:mysql /data/columnstore/*
|
||||
if [ -d "/etc/mysql/mariadb.conf.d/" ]; then
|
||||
message "Copying configs from /etc/mysql/mariadb.conf.d/ to /etc/my.cnf.d"
|
||||
cp -rp /etc/mysql/mariadb.conf.d/* /etc/my.cnf.d
|
||||
fi
|
||||
|
||||
/usr/sbin/install_mcs_mysql.sh
|
||||
if [ -d "/etc/mysql/conf.d/" ]; then
|
||||
message "Copying configs from /etc/mysql/conf.d/ to /etc/my.cnf.d"
|
||||
cp -rp /etc/mysql/conf.d/* /etc/my.cnf.d
|
||||
fi
|
||||
|
||||
chown -R syslog.syslog /var/log/mariadb/
|
||||
chmod 777 /var/log/mariadb/
|
||||
chmod 777 /var/log/mariadb/columnstore
|
||||
mkdir -p /var/lib/columnstore/data1
|
||||
mkdir -p /var/lib/columnstore/data1/systemFiles
|
||||
mkdir -p /var/lib/columnstore/data1/systemFiles/dbrm
|
||||
mkdir -p /run/mysqld/
|
||||
|
||||
elif [ $DISTRO = 'centos' ]; then
|
||||
cp ./support-files/*.service /lib/systemd/system/
|
||||
cp ./storage/columnstore/columnstore/oam/install_scripts/*.service /lib/systemd/system/
|
||||
cp ./storage/columnstore/oam/install_scripts/*.service /lib/systemd/system/
|
||||
systemctl daemon-reload
|
||||
rm -f /etc/mysql/my.cnf
|
||||
cp -r /etc/mysql/conf.d/ /etc/my.cnf.d
|
||||
mkdir /var/lib/columnstore/data1
|
||||
mkdir /var/lib/columnstore/data1/systemFiles
|
||||
mkdir /var/lib/columnstore/data1/systemFiles/dbrm
|
||||
chown -R mysql:mysql /var/lib/mysql
|
||||
chown -R mysql:mysql /data/columnstore/*
|
||||
chown -R mysql.mysql /var/run/mysqld
|
||||
chmod +x /usr/bin/mariadb*
|
||||
mkdir -p $DATA_DIR
|
||||
chown -R mysql:mysql $DATA_DIR
|
||||
chown -R mysql:mysql /var/lib/columnstore/
|
||||
chown -R mysql:mysql /run/mysqld/
|
||||
|
||||
ldconfig
|
||||
columnstore-post-install
|
||||
chown -R mysql:mysql /data/columnstore/*
|
||||
chmod +x $INSTALL_PREFIX/bin/mariadb*
|
||||
|
||||
/usr/sbin/install_mcs_mysql.sh
|
||||
ldconfig
|
||||
|
||||
/usr/sbin/install_mcs_mysql.sh
|
||||
mkdir /var/lib/columnstore/data1
|
||||
mkdir /var/lib/columnstore/data1/systemFiles
|
||||
mkdir /var/lib/columnstore/data1/systemFiles/dbrm
|
||||
message "Running columnstore-post-install"
|
||||
mkdir -p /var/lib/columnstore/local
|
||||
columnstore-post-install --rpmmode=install
|
||||
message "Running install_mcs_mysql"
|
||||
install_mcs_mysql.sh
|
||||
|
||||
chown -R mysql:mysql /var/log/mariadb/
|
||||
chmod 777 /var/log/mariadb/
|
||||
chmod 777 /var/log/mariadb/columnstore
|
||||
chown -R syslog:syslog /var/log/mariadb/
|
||||
chmod 777 /var/log/mariadb/
|
||||
chmod 777 /var/log/mariadb/columnstore
|
||||
}
|
||||
|
||||
|
||||
select_branch
|
||||
|
||||
if [[ $SKIP_DEPS = false ]] ; then
|
||||
install_deps
|
||||
fi
|
||||
|
||||
|
||||
exit 0
|
||||
stop_service
|
||||
clean_old_installation
|
||||
build
|
||||
install
|
||||
start_service
|
||||
message "$color_green FINISHED $color_normal"
|
||||
|
10
build/my.cnf.in
Normal file
10
build/my.cnf.in
Normal file
@ -0,0 +1,10 @@
|
||||
[client-server]
|
||||
|
||||
#
|
||||
# include *.cnf from the config directory
|
||||
#
|
||||
!includedir /etc/my.cnf.d
|
||||
|
||||
[mysqld]
|
||||
datadir=%DATADIR%
|
||||
plugin-load-add=ha_columnstore.so
|
377
build/utils.sh
Normal file
377
build/utils.sh
Normal file
@ -0,0 +1,377 @@
|
||||
color_normal=$(tput sgr0)
|
||||
color_bold=$(tput bold)
|
||||
color_red="$color_bold$(tput setaf 1)"
|
||||
color_green=$(tput setaf 2)
|
||||
color_fawn=$(tput setaf 3); color_beige="$color_fawn"
|
||||
color_yellow="$color_bold$color_fawn"
|
||||
color_darkblue=$(tput setaf 4)
|
||||
color_blue="$color_bold$color_darkblue"
|
||||
color_purple=$(tput setaf 5); color_magenta="$color_purple"
|
||||
color_pink="$color_bold$color_purple"
|
||||
color_darkcyan=$(tput setaf 6)
|
||||
color_cyan="$color_bold$color_darkcyan"
|
||||
color_gray=$(tput setaf 7)
|
||||
color_darkgray="$color_bold"$(tput setaf 0)
|
||||
color_white="$color_bold$color_gray"
|
||||
|
||||
message()
|
||||
{
|
||||
echo $color_cyan -- $@$color_normal
|
||||
}
|
||||
|
||||
warn()
|
||||
{
|
||||
echo $color_yellow -- $@$color_normal
|
||||
}
|
||||
|
||||
error()
|
||||
{
|
||||
echo $color_red -- $@$color_normal
|
||||
}
|
||||
|
||||
detect_distro()
|
||||
{
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
export OS=$NAME
|
||||
export OS_VERSION=$VERSION_ID
|
||||
elif type lsb_release >/dev/null 2>&1; then
|
||||
# linuxbase.org
|
||||
export OS=$(lsb_release -si)
|
||||
export OS_VERSION=$(lsb_release -sr)
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
# For some versions of Debian/Ubuntu without lsb_release command
|
||||
. /etc/lsb-release
|
||||
export OS=$DISTRIB_ID
|
||||
OS_VERSION=$DISTRIB_RELEASE
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
# Older Debian/Ubuntu/etc.
|
||||
OS=Debian
|
||||
OS_VERSION=$(cat /etc/debian_version)
|
||||
else
|
||||
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
|
||||
OS=$(uname -s)
|
||||
OS_VERSION=$(uname -r)
|
||||
fi
|
||||
OS=$(echo $OS | cut -f 1 -d " ")
|
||||
message "Detected $color_yellow$OS $OS_VERSION$color_normal"
|
||||
}
|
||||
|
||||
menuStr=""
|
||||
|
||||
function hideCursor(){
|
||||
printf "\033[?25l"
|
||||
|
||||
# capture CTRL+C so cursor can be reset
|
||||
trap "showCursor && exit 0" 2
|
||||
}
|
||||
|
||||
function showCursor(){
|
||||
printf "\033[?25h"
|
||||
}
|
||||
|
||||
function clearLastMenu(){
|
||||
local msgLineCount=$(printf "$menuStr" | wc -l)
|
||||
# moves the curser up N lines so the output overwrites it
|
||||
echo -en "\033[${msgLineCount}A"
|
||||
|
||||
# clear to end of screen to ensure there's no text left behind from previous input
|
||||
[ $1 ] && tput ed
|
||||
}
|
||||
|
||||
function renderMenu(){
|
||||
local start=0
|
||||
local selector=""
|
||||
local instruction="$1"
|
||||
local selectedIndex=$2
|
||||
local listLength=$itemsLength
|
||||
local longest=0
|
||||
local spaces=""
|
||||
menuStr="\n $instruction\n"
|
||||
|
||||
# Get the longest item from the list so that we know how many spaces to add
|
||||
# to ensure there's no overlap from longer items when a list is scrolling up or down.
|
||||
for (( i=0; i<$itemsLength; i++ )); do
|
||||
if (( ${#menuItems[i]} > longest )); then
|
||||
longest=${#menuItems[i]}
|
||||
fi
|
||||
done
|
||||
spaces=$(printf ' %.0s' $(eval "echo {1.."$(($longest))"}"))
|
||||
|
||||
if [ $3 -ne 0 ]; then
|
||||
listLength=$3
|
||||
|
||||
if [ $selectedIndex -ge $listLength ]; then
|
||||
start=$(($selectedIndex+1-$listLength))
|
||||
listLength=$(($selectedIndex+1))
|
||||
fi
|
||||
fi
|
||||
|
||||
for (( i=$start; i<$listLength; i++ )); do
|
||||
local currItem="${menuItems[i]}"
|
||||
currItemLength=${#currItem}
|
||||
|
||||
if [[ $i = $selectedIndex ]]; then
|
||||
selectedChoice="${currItem}"
|
||||
selector="${color_green}ᐅ${color_normal}"
|
||||
currItem="${color_green}${currItem}${color_normal}"
|
||||
else
|
||||
selector=" "
|
||||
fi
|
||||
|
||||
currItem="${spaces:0:0}${currItem}${spaces:currItemLength}"
|
||||
|
||||
menuStr="${menuStr}\n ${selector} ${currItem}"
|
||||
done
|
||||
|
||||
menuStr="${menuStr}\n"
|
||||
|
||||
# whether or not to overwrite the previous menu output
|
||||
[ $4 ] && clearLastMenu
|
||||
|
||||
printf "${menuStr}"
|
||||
}
|
||||
|
||||
function getChoice(){
|
||||
local KEY__ARROW_UP=$(echo -e "\033[A")
|
||||
local KEY__ARROW_DOWN=$(echo -e "\033[B")
|
||||
local KEY__ENTER=$(echo -e "\n")
|
||||
local captureInput=true
|
||||
local displayHelp=false
|
||||
local maxViewable=0
|
||||
local instruction="Select an item from the list:"
|
||||
local selectedIndex=0
|
||||
|
||||
remainingArgs=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-h|--help)
|
||||
displayHelp=true
|
||||
shift
|
||||
;;
|
||||
-i|--index)
|
||||
selectedIndex=$2
|
||||
shift 2
|
||||
;;
|
||||
-m|--max)
|
||||
maxViewable=$2
|
||||
shift 2
|
||||
;;
|
||||
-o|--options)
|
||||
menuItems=$2[@]
|
||||
menuItems=("${!menuItems}")
|
||||
shift 2
|
||||
;;
|
||||
-q|--query)
|
||||
instruction="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
remainingArgs+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# just display help
|
||||
if $displayHelp; then
|
||||
echo;
|
||||
echo "Usage: getChoice [OPTION]..."
|
||||
echo "Renders a keyboard navigable menu with a visual indicator of what's selected."
|
||||
echo;
|
||||
echo " -h, --help Displays this message"
|
||||
echo " -i, --index The initially selected index for the options"
|
||||
echo " -m, --max Limit how many options are displayed"
|
||||
echo " -o, --options An Array of options for a User to choose from"
|
||||
echo " -q, --query Question or statement presented to the User"
|
||||
echo;
|
||||
echo "Example:"
|
||||
echo " foodOptions=(\"pizza\" \"burgers\" \"chinese\" \"sushi\" \"thai\" \"italian\" \"shit\")"
|
||||
echo;
|
||||
echo " getChoice -q \"What do you feel like eating?\" -o foodOptions -i \$((\${#foodOptions[@]}-1)) -m 4"
|
||||
echo " printf \"\\n First choice is '\${selectedChoice}'\\n\""
|
||||
echo;
|
||||
echo " getChoice -q \"Select another option in case the first isn't available\" -o foodOptions"
|
||||
echo " printf \"\\n Second choice is '\${selectedChoice}'\\n\""
|
||||
echo;
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
set -- "${remainingArgs[@]}"
|
||||
local itemsLength=${#menuItems[@]}
|
||||
|
||||
# no menu items, at least 1 required
|
||||
if [[ $itemsLength -lt 1 ]]; then
|
||||
printf "\n [ERROR] No menu items provided\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
renderMenu "$instruction" $selectedIndex $maxViewable
|
||||
hideCursor
|
||||
|
||||
while $captureInput; do
|
||||
read -rsn3 key # `3` captures the escape (\033'), bracket ([), & type (A) characters.
|
||||
|
||||
case "$key" in
|
||||
"$KEY__ARROW_UP")
|
||||
selectedIndex=$((selectedIndex-1))
|
||||
(( $selectedIndex < 0 )) && selectedIndex=$((itemsLength-1))
|
||||
|
||||
renderMenu "$instruction" $selectedIndex $maxViewable true
|
||||
;;
|
||||
|
||||
"$KEY__ARROW_DOWN")
|
||||
selectedIndex=$((selectedIndex+1))
|
||||
(( $selectedIndex == $itemsLength )) && selectedIndex=0
|
||||
|
||||
renderMenu "$instruction" $selectedIndex $maxViewable true
|
||||
;;
|
||||
|
||||
"$KEY__ENTER")
|
||||
clearLastMenu true
|
||||
showCursor
|
||||
captureInput=false
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function optparse.throw_error(){
|
||||
local message="$1"
|
||||
error "OPTPARSE: ERROR: $message"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------------------
|
||||
function optparse.define(){
|
||||
if [ $# -lt 3 ]; then
|
||||
optparse.throw_error "optparse.define <short> <long> <variable> [<desc>] [<default>] [<value>]"
|
||||
fi
|
||||
for option_id in $( seq 1 $# ) ; do
|
||||
local option="$( eval "echo \$$option_id")"
|
||||
local key="$( echo $option | awk -F "=" '{print $1}' )";
|
||||
local value="$( echo $option | awk -F "=" '{print $2}' )";
|
||||
|
||||
#essentials: shortname, longname, description
|
||||
if [ "$key" = "short" ]; then
|
||||
local shortname="$value"
|
||||
if [ ${#shortname} -ne 1 ]; then
|
||||
optparse.throw_error "short name expected to be one character long"
|
||||
fi
|
||||
local short="-${shortname}"
|
||||
elif [ "$key" = "long" ]; then
|
||||
local longname="$value"
|
||||
if [ ${#longname} -lt 2 ]; then
|
||||
optparse.throw_error "long name expected to be atleast one character long"
|
||||
fi
|
||||
local long="--${longname}"
|
||||
elif [ "$key" = "desc" ]; then
|
||||
local desc="$value"
|
||||
elif [ "$key" = "default" ]; then
|
||||
local default="$value"
|
||||
elif [ "$key" = "variable" ]; then
|
||||
local variable="$value"
|
||||
elif [ "$key" = "value" ]; then
|
||||
local val="$value"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$variable" = "" ]; then
|
||||
optparse.throw_error "You must give a variable for option: ($short/$long)"
|
||||
fi
|
||||
|
||||
if [ "$val" = "" ]; then
|
||||
val="\$OPTARG"
|
||||
fi
|
||||
|
||||
# build OPTIONS and help
|
||||
optparse_usage="${optparse_usage}#NL#TB${short} $(printf "%-25s %s" "${long}:" "${desc}")"
|
||||
if [ "$default" != "" ]; then
|
||||
optparse_usage="${optparse_usage} [default:$default]"
|
||||
fi
|
||||
optparse_contractions="${optparse_contractions}#NL#TB#TB${long})#NL#TB#TB#TBparams=\"\$params ${short}\";;"
|
||||
if [ "$default" != "" ]; then
|
||||
optparse_defaults="${optparse_defaults}#NL${variable}=${default}"
|
||||
fi
|
||||
optparse_arguments_string="${optparse_arguments_string}${shortname}"
|
||||
if [ "$val" = "\$OPTARG" ]; then
|
||||
optparse_arguments_string="${optparse_arguments_string}:"
|
||||
fi
|
||||
optparse_process="${optparse_process}#NL#TB#TB${shortname})#NL#TB#TB#TB${variable}=\"$val\";;"
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------------------
|
||||
function optparse.build(){
|
||||
local build_file="$(mktemp -t "optparse-XXXXXX.tmp")"
|
||||
|
||||
# Building getopts header here
|
||||
|
||||
# Function usage
|
||||
cat << EOF > $build_file
|
||||
function usage(){
|
||||
cat << XXX
|
||||
usage: \$0 [OPTIONS]
|
||||
OPTIONS:
|
||||
$optparse_usage
|
||||
-? --help : usage
|
||||
XXX
|
||||
}
|
||||
# Contract long options into short options
|
||||
params=""
|
||||
while [ \$# -ne 0 ]; do
|
||||
param="\$1"
|
||||
shift
|
||||
case "\$param" in
|
||||
$optparse_contractions
|
||||
"-?"|--help)
|
||||
usage
|
||||
exit 0;;
|
||||
*)
|
||||
if [[ "\$param" == --* ]]; then
|
||||
echo -e "Unrecognized long option: \$param"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
params="\$params \"\$param\"";;
|
||||
esac
|
||||
done
|
||||
eval set -- "\$params"
|
||||
# Set default variable values
|
||||
$optparse_defaults
|
||||
# Process using getopts
|
||||
while getopts "$optparse_arguments_string" option; do
|
||||
case \$option in
|
||||
# Substitute actions for different variables
|
||||
$optparse_process
|
||||
:)
|
||||
echo "Option - \$OPTARG requires an argument"
|
||||
exit 1;;
|
||||
*)
|
||||
usage
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
# Clean up after self
|
||||
rm $build_file
|
||||
EOF
|
||||
|
||||
local -A o=( ['#NL']='\n' ['#TB']='\t' )
|
||||
|
||||
for i in "${!o[@]}"; do
|
||||
sed -i "s/${i}/${o[$i]}/g" $build_file
|
||||
done
|
||||
|
||||
# Unset global variables
|
||||
unset optparse_usage
|
||||
unset optparse_process
|
||||
unset optparse_arguments_string
|
||||
unset optparse_defaults
|
||||
unset optparse_contractions
|
||||
|
||||
# Return file name to parent
|
||||
echo "$build_file"
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
find_path(GTEST_ROOT_DIR
|
||||
NAMES include/gtest/gtest.h
|
||||
)
|
||||
|
||||
find_library(GTEST_LIBRARY
|
||||
NAMES gtest
|
||||
HINTS ${GTEST_ROOT_DIR}/lib
|
||||
)
|
||||
|
||||
find_library(GTESTMAIN_LIBRARY
|
||||
NAMES gtest_main
|
||||
HINTS ${GTEST_ROOT_DIR}/lib
|
||||
)
|
||||
|
||||
find_library(PTHREAD_LIBRARY
|
||||
NAMES pthread
|
||||
HINTS ${GTEST_ROOT_DIR}/lib
|
||||
)
|
||||
|
||||
find_path(GTEST_INCLUDE_DIR
|
||||
NAMES gtest.h
|
||||
HINTS ${GTEST_ROOT_DIR}/include/gtest
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GTest DEFAULT_MSG
|
||||
GTEST_LIBRARY
|
||||
GTESTMAIN_LIBRARY
|
||||
PTHREAD_LIBRARY
|
||||
GTEST_INCLUDE_DIR
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
GTEST_ROOT_DIR
|
||||
GTEST_LIBRARIES
|
||||
GTEST_INCLUDE_DIR
|
||||
)
|
@ -1,33 +1,32 @@
|
||||
cmake_minimum_required(VERSION @CMAKE_VERSION@)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set(_toolset "gcc")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
set(_toolset "clang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
set(_toolset "intel-linux")
|
||||
endif()
|
||||
|
||||
set(_b2args link=shared;threading=multi;variant=release;toolset=${_toolset};--with-system;--with-filesystem;--with-thread;--with-regex;--with-date_time)
|
||||
|
||||
ExternalProject_Add(boost
|
||||
PREFIX build
|
||||
URL https://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.zip
|
||||
URL_HASH SHA256=ae85620e810b87a03e1acf8bbf0d4ad87c0cf7040cf6a4e1d8958488ebe42e7e
|
||||
DOWNLOAD_NO_PROGRESS TRUE
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/bootstrap.sh
|
||||
--with-toolset=${_toolset}
|
||||
--prefix=${CMAKE_CURRENT_SOURCE_DIR}/../boost
|
||||
--with-libraries=system,filesystem,thread,regex,date_time
|
||||
BUILD_COMMAND <SOURCE_DIR>/b2 -q ${_b2args}
|
||||
LOG_BUILD TRUE
|
||||
BUILD_IN_SOURCE TRUE
|
||||
INSTALL_COMMAND <SOURCE_DIR>/b2 -q install ${_b2args}
|
||||
LOG_INSTALL TRUE
|
||||
)
|
||||
|
||||
unset(_b2args)
|
||||
unset(_toolset)
|
||||
cmake_minimum_required(VERSION @CMAKE_VERSION@)
|
||||
project (BoostExternal)
|
||||
include(ExternalProject)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set(_toolset "gcc")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
set(_toolset "clang")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||
set(_toolset "intel-linux")
|
||||
endif()
|
||||
|
||||
set(INSTALL_LOCATION ${CMAKE_BINARY_DIR}/boost-lib)
|
||||
|
||||
set(_cxxargs "-fPIC -DBOOST_NO_AUTO_PTR -fvisibility=default")
|
||||
set(_b2args cxxflags=${_cxxargs};cflags=-fPIC;threading=multi; toolset=${_toolset} --without-python;--prefix=${INSTALL_LOCATION})
|
||||
|
||||
ExternalProject_Add(external_boost
|
||||
PREFIX boost
|
||||
URL https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2
|
||||
URL_HASH SHA256=475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39
|
||||
CONFIGURE_COMMAND ./bootstrap.sh
|
||||
UPDATE_COMMAND ""
|
||||
BUILD_COMMAND ./b2 -q ${_b2args}
|
||||
LOG_BUILD TRUE
|
||||
BUILD_IN_SOURCE TRUE
|
||||
INSTALL_COMMAND ./b2 -q install ${_b2args}
|
||||
LOG_INSTALL TRUE
|
||||
)
|
||||
|
||||
unset(_b2args)
|
||||
unset(_toolset)
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/boost.CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/.boost/CMakeLists.txt @ONLY)
|
||||
SET(BOOST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/.boost/boost-lib)
|
||||
|
||||
message ("-- External: Configuring Boost")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} .
|
||||
COMMAND ${CMAKE_COMMAND} .
|
||||
-G "${CMAKE_GENERATOR}"
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
@ -17,6 +19,7 @@ if(${_exec_ret})
|
||||
message(FATAL_ERROR "Error ${_exec_ret} configuring boost dependency.")
|
||||
endif()
|
||||
|
||||
message ("-- External: Building Boost")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} --build .
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.boost
|
||||
@ -29,6 +32,13 @@ endif()
|
||||
|
||||
unset(_exec_ret)
|
||||
|
||||
set(BOOST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/boost)
|
||||
|
||||
find_package(Boost 1.55.0 REQUIRED COMPONENTS system filesystem thread regex date_time)
|
||||
message("Boost installed localy at ${BOOST_ROOT}")
|
||||
|
||||
|
||||
SET(Boost_USE_STATIC_LIBS ON)
|
||||
FIND_PACKAGE(Boost 1.78.0 COMPONENTS system filesystem thread regex date_time chrono atomic)
|
||||
IF (NOT Boost_FOUND)
|
||||
MESSAGE_ONCE(CS_NO_BOOST "Required Boost libraries not found!")
|
||||
return()
|
||||
ENDIF()
|
||||
|
@ -592,7 +592,7 @@ string TypeHandlerDatetime::format(const SimpleValue& v, const SystemCatalog::Ty
|
||||
|
||||
string TypeHandlerTimestamp::format(const SimpleValue& v, const SystemCatalog::TypeAttributesStd& attr) const
|
||||
{
|
||||
return DataConvert::timestampToString(v.toSInt64(), v.tzname());
|
||||
return DataConvert::timestampToString(v.toSInt64(), v.timeZone());
|
||||
}
|
||||
|
||||
string TypeHandlerTime::format(const SimpleValue& v, const SystemCatalog::TypeAttributesStd& attr) const
|
||||
@ -893,8 +893,8 @@ class SimpleConverter : public boost::any
|
||||
public:
|
||||
SimpleConverter(const SessionParam& sp, const TypeHandler* h, const SystemCatalog::TypeAttributesStd& attr,
|
||||
const char* str)
|
||||
: boost::any(
|
||||
h->convertFromString(attr, ConvertFromStringParam(sp.tzname(), true, false), str, initPushWarning()))
|
||||
: boost::any(h->convertFromString(attr, ConvertFromStringParam(sp.timeZone(), true, false), str,
|
||||
initPushWarning()))
|
||||
{
|
||||
}
|
||||
round_style_t roundStyle() const
|
||||
@ -1059,7 +1059,7 @@ SimpleValue TypeHandlerTimestamp::toSimpleValue(const SessionParam& sp,
|
||||
{
|
||||
idbassert(attr.colWidth <= SystemCatalog::EIGHT_BYTE);
|
||||
SimpleConverter anyVal(sp, this, attr, str);
|
||||
return SimpleValueTimestamp(anyVal.to_uint64(), sp.tzname());
|
||||
return SimpleValueTimestamp(anyVal.to_uint64(), sp.timeZone());
|
||||
}
|
||||
|
||||
SimpleValue TypeHandlerTime::toSimpleValue(const SessionParam& sp,
|
||||
@ -1915,4 +1915,3 @@ const uint8_t* TypeHandlerUDecimal128::getEmptyValueForType(
|
||||
|
||||
} // end of namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -482,7 +482,11 @@ inline bool isUnsigned(const datatypes::SystemCatalog::ColDataType type)
|
||||
case datatypes::SystemCatalog::USMALLINT:
|
||||
case datatypes::SystemCatalog::UMEDINT:
|
||||
case datatypes::SystemCatalog::UINT:
|
||||
case datatypes::SystemCatalog::UBIGINT: return true;
|
||||
case datatypes::SystemCatalog::UBIGINT:
|
||||
case datatypes::SystemCatalog::CHAR:
|
||||
case datatypes::SystemCatalog::VARCHAR:
|
||||
case datatypes::SystemCatalog::TEXT:
|
||||
case datatypes::SystemCatalog::VARBINARY: return true;
|
||||
|
||||
default: return false;
|
||||
}
|
||||
@ -561,30 +565,30 @@ enum class round_style_t : uint8_t
|
||||
|
||||
class SessionParam
|
||||
{
|
||||
const char* m_tzname;
|
||||
long m_timeZone;
|
||||
|
||||
public:
|
||||
SessionParam(const char* tzname) : m_tzname(tzname)
|
||||
SessionParam(long timeZone) : m_timeZone(timeZone)
|
||||
{
|
||||
}
|
||||
const char* tzname() const
|
||||
long timeZone() const
|
||||
{
|
||||
return m_tzname;
|
||||
return m_timeZone;
|
||||
}
|
||||
};
|
||||
|
||||
class ConvertFromStringParam
|
||||
{
|
||||
const std::string& m_timeZone;
|
||||
const long m_timeZone;
|
||||
const bool m_noRoundup;
|
||||
const bool m_isUpdate;
|
||||
|
||||
public:
|
||||
ConvertFromStringParam(const std::string& timeZone, bool noRoundup, bool isUpdate)
|
||||
ConvertFromStringParam(long timeZone, bool noRoundup, bool isUpdate)
|
||||
: m_timeZone(timeZone), m_noRoundup(noRoundup), m_isUpdate(isUpdate)
|
||||
{
|
||||
}
|
||||
const std::string& timeZone() const
|
||||
long timeZone() const
|
||||
{
|
||||
return m_timeZone;
|
||||
}
|
||||
@ -602,14 +606,14 @@ class SimpleValue
|
||||
{
|
||||
int64_t m_sint64;
|
||||
int128_t m_sint128;
|
||||
const char* m_tzname;
|
||||
long m_timeZone;
|
||||
|
||||
public:
|
||||
SimpleValue(const int64_t sint64, const int128_t& sint128, const char* tzname)
|
||||
: m_sint64(sint64), m_sint128(sint128), m_tzname(tzname)
|
||||
SimpleValue(const int64_t sint64, const int128_t& sint128, long timeZone)
|
||||
: m_sint64(sint64), m_sint128(sint128), m_timeZone(timeZone)
|
||||
{
|
||||
}
|
||||
SimpleValue() : m_sint64(0), m_sint128(0), m_tzname(0)
|
||||
SimpleValue() : m_sint64(0), m_sint128(0), m_timeZone(0)
|
||||
{
|
||||
}
|
||||
int64_t toSInt64() const
|
||||
@ -624,16 +628,16 @@ class SimpleValue
|
||||
{
|
||||
return m_sint128;
|
||||
}
|
||||
const char* tzname() const
|
||||
long timeZone() const
|
||||
{
|
||||
return m_tzname;
|
||||
return m_timeZone;
|
||||
}
|
||||
};
|
||||
|
||||
class SimpleValueSInt64 : public SimpleValue
|
||||
{
|
||||
public:
|
||||
SimpleValueSInt64(int64_t value) : SimpleValue(value, 0, NULL)
|
||||
SimpleValueSInt64(int64_t value) : SimpleValue(value, 0, 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -641,7 +645,7 @@ class SimpleValueSInt64 : public SimpleValue
|
||||
class SimpleValueUInt64 : public SimpleValue
|
||||
{
|
||||
public:
|
||||
SimpleValueUInt64(uint64_t value) : SimpleValue(static_cast<int64_t>(value), 0, NULL)
|
||||
SimpleValueUInt64(uint64_t value) : SimpleValue(static_cast<int64_t>(value), 0, 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -649,7 +653,7 @@ class SimpleValueUInt64 : public SimpleValue
|
||||
class SimpleValueSInt128 : public SimpleValue
|
||||
{
|
||||
public:
|
||||
SimpleValueSInt128(int128_t value) : SimpleValue(0, value, NULL)
|
||||
SimpleValueSInt128(int128_t value) : SimpleValue(0, value, 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -657,8 +661,7 @@ class SimpleValueSInt128 : public SimpleValue
|
||||
class SimpleValueTimestamp : public SimpleValue
|
||||
{
|
||||
public:
|
||||
SimpleValueTimestamp(uint64_t value, const char* tzname)
|
||||
: SimpleValue(static_cast<int64_t>(value), 0, tzname)
|
||||
SimpleValueTimestamp(uint64_t value, long timeZone) : SimpleValue(static_cast<int64_t>(value), 0, timeZone)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -2521,5 +2524,3 @@ class TypeHandlerTimestamp : public TypeHandlerTemporal
|
||||
};
|
||||
|
||||
} // end of namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -78,4 +78,3 @@ uint64_t xFloatToMCSUInt64Round(SRC value)
|
||||
|
||||
} // end of namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -318,12 +318,12 @@ class TDecimal128 : public TSInt128
|
||||
static constexpr int128_t minInt128 = TFloat128::minInt128;
|
||||
static constexpr int128_t maxInt128 = TFloat128::maxInt128;
|
||||
|
||||
static inline bool isWideDecimalNullValue(const int128_t& val)
|
||||
static inline bool isWideDecimalNullValue(const int128_t val)
|
||||
{
|
||||
return (val == TSInt128::NullValue);
|
||||
}
|
||||
|
||||
static inline bool isWideDecimalEmptyValue(const int128_t& val)
|
||||
static inline bool isWideDecimalEmptyValue(const int128_t val)
|
||||
{
|
||||
return (val == TSInt128::EmptyValue);
|
||||
}
|
||||
@ -342,10 +342,10 @@ class TDecimal128 : public TSInt128
|
||||
TDecimal128()
|
||||
{
|
||||
}
|
||||
explicit TDecimal128(const int128_t& val) : TSInt128(val)
|
||||
explicit TDecimal128(const int128_t val) : TSInt128(val)
|
||||
{
|
||||
}
|
||||
explicit TDecimal128(const TSInt128& val) : TSInt128(val)
|
||||
explicit TDecimal128(const TSInt128 val) : TSInt128(val)
|
||||
{
|
||||
}
|
||||
explicit TDecimal128(const int128_t* valPtr) : TSInt128(valPtr)
|
||||
|
@ -54,4 +54,3 @@ class TDouble
|
||||
|
||||
} // end of namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -724,4 +724,3 @@ class TFloat128
|
||||
|
||||
} // namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -113,4 +113,3 @@ std::ostream& operator<<(std::ostream& os, const TSInt128& x)
|
||||
}
|
||||
|
||||
} // end of namespace datatypes
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -322,4 +322,3 @@ class TSInt128
|
||||
|
||||
} // end of namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -179,4 +179,3 @@ class TSInt64Null : public TSInt64, public TNullFlag
|
||||
|
||||
} // end of namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -54,4 +54,3 @@ class TLongDouble
|
||||
|
||||
} // end of namespace datatypes
|
||||
|
||||
// vim:ts=2 sw=2:
|
||||
|
@ -336,6 +336,7 @@ class SignedInteger : public Parser::DD2OM<Sign, UnsignedInteger>
|
||||
{
|
||||
public:
|
||||
using DD2OM::DD2OM;
|
||||
|
||||
bool isNull() const
|
||||
{
|
||||
return UnsignedInteger::isNull();
|
||||
|
@ -9,7 +9,7 @@ FIND_PACKAGE(FLEX REQUIRED)
|
||||
FLEX_TARGET(ddl_scan ddl.l ${CMAKE_CURRENT_BINARY_DIR}/ddl-scan.cpp COMPILE_FLAGS "-i -L -Pddl")
|
||||
ADD_FLEX_BISON_DEPENDENCY(ddl_scan ddl_gram)
|
||||
|
||||
set_source_files_properties(ddl-scan.cpp PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -DYY_NO_INPUT")
|
||||
set_source_files_properties(ddl-scan.cpp PROPERTIES COMPILE_FLAGS "-Wno-register -Wno-deprecated-register -Wno-sign-compare -DYY_NO_INPUT")
|
||||
|
||||
########### next target ###############
|
||||
|
||||
|
@ -95,7 +95,7 @@ void fix_column_length(SchemaObject* elem, const CHARSET_INFO* def_cs) {
|
||||
%}
|
||||
|
||||
%expect 17
|
||||
%pure-parser
|
||||
%define api.pure
|
||||
%lex-param {void * scanner}
|
||||
%parse-param {struct ddlpackage::pass_to_bison * x}
|
||||
|
||||
|
@ -1308,9 +1308,20 @@ struct AlterTableStatement : public SqlStatement
|
||||
return fTableName->fSchema;
|
||||
}
|
||||
|
||||
long getTimeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
void setTimeZone(long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
|
||||
QualifiedName* fTableName;
|
||||
AlterTableActionList fActions;
|
||||
std::string fTimeZone;
|
||||
private:
|
||||
long fTimeZone;
|
||||
public:
|
||||
};
|
||||
|
||||
/** @brief This is used during parsing when constraint attributes
|
||||
|
@ -118,7 +118,9 @@ int AlterTableStatement::unserialize(ByteStream& bytestream)
|
||||
// read table name
|
||||
fTableName->unserialize(bytestream);
|
||||
|
||||
bytestream >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
bytestream >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
|
||||
// read alter action list
|
||||
quadbyte action_count;
|
||||
@ -225,7 +227,8 @@ int AlterTableStatement::serialize(ByteStream& bytestream)
|
||||
// write table name
|
||||
fTableName->serialize(bytestream);
|
||||
|
||||
bytestream << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
bytestream << timeZone;
|
||||
|
||||
write_vec<AlterTableAction>(fActions, bytestream);
|
||||
|
||||
|
@ -22,12 +22,12 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <typeinfo>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
|
||||
#include "altertableprocessor.h"
|
||||
@ -1023,7 +1023,8 @@ void AlterTableProcessor::addColumn(uint32_t sessionID, execplan::CalpontSystemC
|
||||
bs << (ByteStream::byte)column_iterator->colType.colDataType;
|
||||
bs << (uint32_t)column_iterator->colType.colWidth;
|
||||
bs << (ByteStream::byte)column_iterator->colType.compressionType;
|
||||
bs << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
bs << timeZone;
|
||||
// cout << "sending command fillcolumn " << endl;
|
||||
uint32_t msgRecived = 0;
|
||||
fWEClient->write_to_all(bs);
|
||||
@ -2082,14 +2083,14 @@ void AlterTableProcessor::tableComment(uint32_t sessionID, execplan::CalpontSyst
|
||||
CalpontSystemCatalog::makeCalpontSystemCatalog(sessionID);
|
||||
|
||||
boost::algorithm::to_upper(ataTableComment.fTableComment);
|
||||
boost::regex compat("[[:space:]]*AUTOINCREMENT[[:space:]]*=[[:space:]]*", boost::regex_constants::extended);
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
std::regex compat("[[:space:]]*AUTOINCREMENT[[:space:]]*=[[:space:]]*", std::regex_constants::extended);
|
||||
std::match_results<std::string::const_iterator> what;
|
||||
std::string::const_iterator start, end;
|
||||
start = ataTableComment.fTableComment.begin();
|
||||
end = ataTableComment.fTableComment.end();
|
||||
boost::match_flag_type flags = boost::match_default;
|
||||
std::regex_constants::match_flag_type flags = std::regex_constants::match_default;
|
||||
|
||||
if (boost::regex_search(start, end, what, compat, flags) && what[0].matched)
|
||||
if (std::regex_search(start, end, what, compat, flags) && what[0].matched)
|
||||
{
|
||||
std::string params(&(*(what[0].second)));
|
||||
char* ep = NULL;
|
||||
@ -2538,7 +2539,6 @@ void AlterTableProcessor::renameColumn(uint32_t sessionID, execplan::CalpontSyst
|
||||
}
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
// vim:ts=4 sw=4:
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
|
@ -148,7 +148,7 @@ class AlterTableProcessor : public DDLPackageProcessor
|
||||
ddlpackage::AtaTableComment& ataTableComment,
|
||||
ddlpackage::QualifiedName& fTableName, const uint64_t uniqueId);
|
||||
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
|
||||
protected:
|
||||
void rollBackAlter(const std::string& error, BRM::TxnID txnID, int sessionId, DDLResult& result,
|
||||
|
@ -830,4 +830,3 @@ void CreateTableProcessor::rollBackCreateTable(const string& error, BRM::TxnID t
|
||||
}
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -1491,4 +1491,3 @@ int DDLPackageProcessor::commitTransaction(uint64_t uniqueId, BRM::TxnID txnID)
|
||||
}
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -890,4 +890,3 @@ bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)
|
||||
|
||||
#undef EXPORT
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -1367,4 +1367,3 @@ TruncTableProcessor::DDLResult TruncTableProcessor::processPackage(
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -10,7 +10,7 @@ FIND_PACKAGE(FLEX REQUIRED)
|
||||
FLEX_TARGET(dml_scan dml.l ${CMAKE_CURRENT_BINARY_DIR}/dml-scan.cpp COMPILE_FLAGS "-i -L -Pdml")
|
||||
ADD_FLEX_BISON_DEPENDENCY(dml_scan dml_gram)
|
||||
|
||||
set_source_files_properties(dml-scan.cpp PROPERTIES COMPILE_FLAGS "-Wno-sign-compare -DYY_NO_INPUT")
|
||||
set_source_files_properties(dml-scan.cpp PROPERTIES COMPILE_FLAGS "-Wno-register -Wno-deprecated-register -Wno-sign-compare -DYY_NO_INPUT")
|
||||
|
||||
########### next target ###############
|
||||
|
||||
|
@ -222,14 +222,14 @@ class CalpontDMLPackage
|
||||
*
|
||||
* @param the timezone to set
|
||||
*/
|
||||
void set_TimeZone(const std::string& timeZone)
|
||||
void set_TimeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
|
||||
/** @brief get the timezone
|
||||
*/
|
||||
const std::string get_TimeZone() const
|
||||
long get_TimeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
@ -367,7 +367,7 @@ class CalpontDMLPackage
|
||||
void initializeTable();
|
||||
|
||||
std::string fSchemaName;
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
std::string fTableName;
|
||||
std::string fDMLStatement;
|
||||
std::string fSQLStatement;
|
||||
|
@ -60,7 +60,8 @@ int CommandDMLPackage::write(messageqcpp::ByteStream& bytestream)
|
||||
bytestream << fSQLStatement; // for cleartablelock, this is table lockID
|
||||
bytestream << (uint8_t)fLogging;
|
||||
bytestream << fSchemaName;
|
||||
bytestream << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
bytestream << timeZone;
|
||||
bytestream << fTableName;
|
||||
bytestream << fTableOid;
|
||||
bytestream << static_cast<messageqcpp::ByteStream::byte>(fIsAutocommitOn);
|
||||
@ -83,7 +84,9 @@ int CommandDMLPackage::read(messageqcpp::ByteStream& bytestream)
|
||||
bytestream >> logging;
|
||||
fLogging = (logging != 0);
|
||||
bytestream >> fSchemaName;
|
||||
bytestream >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
bytestream >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
bytestream >> fTableName;
|
||||
bytestream >> fTableOid;
|
||||
bytestream >> reinterpret_cast<messageqcpp::ByteStream::byte&>(fIsAutocommitOn);
|
||||
|
@ -69,7 +69,8 @@ int DeleteDMLPackage::write(messageqcpp::ByteStream& bytestream)
|
||||
bytestream << fDMLStatement;
|
||||
bytestream << fSQLStatement;
|
||||
bytestream << fSchemaName;
|
||||
bytestream << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
bytestream << timeZone;
|
||||
|
||||
if (fTable != 0)
|
||||
{
|
||||
@ -105,7 +106,9 @@ int DeleteDMLPackage::read(messageqcpp::ByteStream& bytestream)
|
||||
bytestream >> fDMLStatement;
|
||||
bytestream >> fSQLStatement;
|
||||
bytestream >> fSchemaName;
|
||||
bytestream >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
bytestream >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
|
||||
fTable = new DMLTable();
|
||||
retval = fTable->read(bytestream);
|
||||
|
@ -90,7 +90,7 @@ char* copy_string(const char *str);
|
||||
}
|
||||
|
||||
%}
|
||||
%pure-parser
|
||||
%define api.pure
|
||||
%lex-param {void * scanner}
|
||||
%parse-param {void * scanner}
|
||||
%debug
|
||||
|
@ -64,7 +64,8 @@ int InsertDMLPackage::write(messageqcpp::ByteStream& bytestream)
|
||||
bytestream << fDMLStatement;
|
||||
bytestream << fDMLStatement;
|
||||
bytestream << fSchemaName;
|
||||
bytestream << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
bytestream << timeZone;
|
||||
bytestream << (uint8_t)fLogging;
|
||||
bytestream << (uint8_t)fLogending;
|
||||
|
||||
@ -95,7 +96,9 @@ int InsertDMLPackage::read(messageqcpp::ByteStream& bytestream)
|
||||
bytestream >> fDMLStatement;
|
||||
bytestream >> fSQLStatement;
|
||||
bytestream >> fSchemaName;
|
||||
bytestream >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
bytestream >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
uint8_t logging;
|
||||
bytestream >> logging;
|
||||
fLogging = (logging != 0);
|
||||
@ -125,7 +128,9 @@ void InsertDMLPackage::readMetaData(messageqcpp::ByteStream& bytestream)
|
||||
bytestream >> fDMLStatement;
|
||||
bytestream >> fSQLStatement;
|
||||
bytestream >> fSchemaName;
|
||||
bytestream >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
bytestream >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
uint8_t logging;
|
||||
bytestream >> logging;
|
||||
fLogging = (logging != 0);
|
||||
|
@ -68,7 +68,8 @@ int UpdateDMLPackage::write(messageqcpp::ByteStream& bytestream)
|
||||
bytestream << fDMLStatement;
|
||||
bytestream << fSQLStatement;
|
||||
bytestream << fSchemaName;
|
||||
bytestream << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
bytestream << timeZone;
|
||||
bytestream << (uint8_t)fIsFromCol;
|
||||
|
||||
if (fTable != 0)
|
||||
@ -105,7 +106,9 @@ int UpdateDMLPackage::read(messageqcpp::ByteStream& bytestream)
|
||||
bytestream >> fDMLStatement;
|
||||
bytestream >> fSQLStatement;
|
||||
bytestream >> fSchemaName;
|
||||
bytestream >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
bytestream >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
uint8_t isFromCol;
|
||||
bytestream >> isFromCol;
|
||||
fIsFromCol = (isFromCol != 0);
|
||||
|
@ -97,4 +97,3 @@ AutoincrementData::OIDNextValue& AutoincrementData::getOidNextValueMap()
|
||||
|
||||
return fOidNextValueMap;
|
||||
}
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -49,4 +49,3 @@ class AutoincrementData
|
||||
boost::mutex fOIDnextvalLock;
|
||||
};
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -913,4 +913,3 @@ int DMLPackageProcessor::endTransaction(uint64_t uniqueId, BRM::TxnID txnID, boo
|
||||
return rc;
|
||||
}
|
||||
} // namespace dmlpackageprocessor
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -432,4 +432,3 @@ DMLPackageProcessor::DMLResult InsertPackageProcessor::processPackage(dmlpackage
|
||||
|
||||
} // namespace dmlpackageprocessor
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -101,4 +101,3 @@ TablelockData::OIDTablelock& TablelockData::getOidTablelockMap()
|
||||
}
|
||||
|
||||
} // namespace dmlpackageprocessor
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -61,4 +61,3 @@ class TablelockData
|
||||
|
||||
#undef EXPORT
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -183,7 +183,8 @@ void AggregateColumn::serialize(messageqcpp::ByteStream& b) const
|
||||
(*rcit)->serialize(b);
|
||||
|
||||
b << fData;
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
// b << fAlias;
|
||||
b << fTableAlias;
|
||||
b << static_cast<ByteStream::doublebyte>(fAsc);
|
||||
@ -236,7 +237,9 @@ void AggregateColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
}
|
||||
|
||||
b >> fData;
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
// b >> fAlias;
|
||||
b >> fTableAlias;
|
||||
b >> reinterpret_cast<ByteStream::doublebyte&>(fAsc);
|
||||
@ -421,6 +424,8 @@ void AggregateColumn::evaluate(Row& row, bool& isNull)
|
||||
else
|
||||
fResult.intVal = atoll((char*)&fResult.origIntVal);
|
||||
|
||||
fResult.uintVal = fResult.intVal;
|
||||
|
||||
break;
|
||||
|
||||
case CalpontSystemCatalog::BIGINT:
|
||||
|
@ -313,12 +313,12 @@ class AggregateColumn : public ReturnedColumn
|
||||
return false;
|
||||
}
|
||||
|
||||
inline const std::string timeZone() const
|
||||
inline long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
|
||||
inline void timeZone(const std::string& timeZone)
|
||||
inline void timeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
@ -346,7 +346,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
ColumnList fGroupByColList;
|
||||
ColumnList fProjectColList;
|
||||
SRCP fConstCol;
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
|
||||
public:
|
||||
/***********************************************************
|
||||
|
@ -283,7 +283,7 @@ const string ArithmeticColumn::nextToken(string::size_type& pos, char end) const
|
||||
msg.append(1, end);
|
||||
msg.append(" found in " + fData);
|
||||
throw invalid_argument(msg);
|
||||
return 0;
|
||||
return {};
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& output, const ArithmeticColumn& rhs)
|
||||
|
@ -72,7 +72,8 @@ ostream& operator<<(ostream& output, const ArithmeticOperator& rhs)
|
||||
void ArithmeticOperator::serialize(messageqcpp::ByteStream& b) const
|
||||
{
|
||||
b << (ObjectReader::id_t)ObjectReader::ARITHMETICOPERATOR;
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
const messageqcpp::ByteStream::byte tmp = fDecimalOverflowCheck;
|
||||
b << tmp;
|
||||
Operator::serialize(b);
|
||||
@ -81,7 +82,9 @@ void ArithmeticOperator::serialize(messageqcpp::ByteStream& b) const
|
||||
void ArithmeticOperator::unserialize(messageqcpp::ByteStream& b)
|
||||
{
|
||||
ObjectReader::checkType(b, ObjectReader::ARITHMETICOPERATOR);
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
messageqcpp::ByteStream::byte tmp;
|
||||
b >> tmp;
|
||||
fDecimalOverflowCheck = tmp;
|
||||
|
@ -59,11 +59,11 @@ class ArithmeticOperator : public Operator
|
||||
return new ArithmeticOperator(*this);
|
||||
}
|
||||
|
||||
inline const std::string& timeZone() const
|
||||
inline long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
inline void timeZone(const std::string& timeZone)
|
||||
inline void timeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
@ -207,7 +207,7 @@ class ArithmeticOperator : public Operator
|
||||
template <typename result_t>
|
||||
inline result_t execute(result_t op1, result_t op2, bool& isNull);
|
||||
inline void execute(IDB_Decimal& result, IDB_Decimal op1, IDB_Decimal op2, bool& isNull);
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
bool fDecimalOverflowCheck;
|
||||
};
|
||||
|
||||
|
@ -500,7 +500,8 @@ void CalpontSelectExecutionPlan::serialize(messageqcpp::ByteStream& b) const
|
||||
b << fDJSPartitionSize;
|
||||
b << fUMMemLimit;
|
||||
b << (uint8_t)fIsDML;
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
}
|
||||
|
||||
void CalpontSelectExecutionPlan::unserialize(messageqcpp::ByteStream& b)
|
||||
@ -695,7 +696,9 @@ void CalpontSelectExecutionPlan::unserialize(messageqcpp::ByteStream& b)
|
||||
b >> fUMMemLimit;
|
||||
b >> tmp8;
|
||||
fIsDML = tmp8;
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
|
||||
bool CalpontSelectExecutionPlan::operator==(const CalpontSelectExecutionPlan& t) const
|
||||
|
@ -706,11 +706,11 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
return fIsDML;
|
||||
}
|
||||
|
||||
void timeZone(const std::string& timezone)
|
||||
void timeZone(const long timezone)
|
||||
{
|
||||
fTimeZone = timezone;
|
||||
}
|
||||
const std::string timeZone() const
|
||||
long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
@ -923,7 +923,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
int64_t fUMMemLimit;
|
||||
bool fIsDML;
|
||||
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
|
||||
std::vector<execplan::ParseTree*> fDynamicParseTreeVec;
|
||||
};
|
||||
@ -939,4 +939,3 @@ inline std::ostream& operator<<(std::ostream& os, const CalpontSelectExecutionPl
|
||||
}
|
||||
|
||||
} // namespace execplan
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -6105,8 +6105,8 @@ const string CalpontSystemCatalog::ColType::toString() const
|
||||
}
|
||||
|
||||
boost::any CalpontSystemCatalog::ColType::convertColumnData(const std::string& data, bool& pushWarning,
|
||||
const std::string& timeZone, bool nulFlag,
|
||||
bool noRoundup, bool isUpdate) const
|
||||
long timeZone, bool nulFlag, bool noRoundup,
|
||||
bool isUpdate) const
|
||||
{
|
||||
pushWarning = false;
|
||||
const datatypes::TypeHandler* h = typeHandler();
|
||||
|
@ -205,7 +205,6 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
|
||||
*/
|
||||
struct ColType : public datatypes::SystemCatalog::TypeHolderStd
|
||||
{
|
||||
ColType();
|
||||
ConstraintType constraintType;
|
||||
DictOID ddn;
|
||||
std::string defaultValue;
|
||||
@ -216,11 +215,25 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
|
||||
uint64_t nextvalue; // next autoincrement value
|
||||
uint32_t charsetNumber;
|
||||
const CHARSET_INFO* cs;
|
||||
private:
|
||||
long timeZone;
|
||||
|
||||
public:
|
||||
ColType();
|
||||
ColType(const ColType& rhs);
|
||||
ColType& operator=(const ColType& rhs);
|
||||
|
||||
CHARSET_INFO* getCharset();
|
||||
|
||||
long getTimeZone() const
|
||||
{
|
||||
return timeZone;
|
||||
}
|
||||
void setTimeZone(long timeZone_)
|
||||
{
|
||||
timeZone = timeZone_;
|
||||
}
|
||||
|
||||
// for F&E use. only serialize necessary info for now
|
||||
void serialize(messageqcpp::ByteStream& b) const
|
||||
{
|
||||
@ -254,7 +267,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
|
||||
* @param nRoundtrip
|
||||
* @param isUpdate
|
||||
*/
|
||||
boost::any convertColumnData(const std::string& data, bool& bSaturate, const std::string& timeZone,
|
||||
boost::any convertColumnData(const std::string& data, bool& bSaturate, long timeZone,
|
||||
bool nulFlag = false, bool noRoundup = false, bool isUpdate = false) const;
|
||||
|
||||
const std::string toString() const;
|
||||
@ -932,17 +945,18 @@ inline bool isNull(int64_t val, const execplan::CalpontSystemCatalog::ColType& c
|
||||
break;
|
||||
}
|
||||
|
||||
case execplan::CalpontSystemCatalog::VARCHAR:
|
||||
case execplan::CalpontSystemCatalog::CHAR:
|
||||
{
|
||||
int colWidth = ct.colWidth;
|
||||
|
||||
if (colWidth <= 8)
|
||||
{
|
||||
if ((colWidth == 1) && ((int8_t)joblist::CHAR1NULL == val))
|
||||
if ((colWidth == 1) && ((uint8_t)joblist::CHAR1NULL == (uint8_t)val))
|
||||
ret = true;
|
||||
else if ((colWidth == 2) && ((int16_t)joblist::CHAR2NULL == val))
|
||||
else if ((colWidth == 2) && ((uint16_t)joblist::CHAR2NULL == (uint16_t)val))
|
||||
ret = true;
|
||||
else if ((colWidth < 5) && ((int32_t)joblist::CHAR4NULL == val))
|
||||
else if ((colWidth < 5) && ((uint32_t)joblist::CHAR4NULL == (uint32_t)val))
|
||||
ret = true;
|
||||
else if ((int64_t)joblist::CHAR8NULL == val)
|
||||
ret = true;
|
||||
@ -951,7 +965,6 @@ inline bool isNull(int64_t val, const execplan::CalpontSystemCatalog::ColType& c
|
||||
{
|
||||
throw std::logic_error("Not a int column.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1062,27 +1075,6 @@ inline bool isNull(int64_t val, const execplan::CalpontSystemCatalog::ColType& c
|
||||
break;
|
||||
}
|
||||
|
||||
case execplan::CalpontSystemCatalog::VARCHAR:
|
||||
{
|
||||
int colWidth = ct.colWidth;
|
||||
|
||||
if (colWidth <= 8)
|
||||
{
|
||||
if ((colWidth < 3) && ((int16_t)joblist::CHAR2NULL == val))
|
||||
ret = true;
|
||||
else if ((colWidth < 5) && ((int32_t)joblist::CHAR4NULL == val))
|
||||
ret = true;
|
||||
else if ((int64_t)joblist::CHAR8NULL == val)
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::logic_error("Not a int column.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case execplan::CalpontSystemCatalog::UTINYINT:
|
||||
{
|
||||
if (joblist::UTINYINTNULL == (uint8_t)val)
|
||||
@ -1265,5 +1257,3 @@ const std::string colDataTypeToString(CalpontSystemCatalog::ColDataType cdt);
|
||||
bool ctListSort(const CalpontSystemCatalog::ColType& a, const CalpontSystemCatalog::ColType& b);
|
||||
|
||||
} // namespace execplan
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -399,4 +399,3 @@ void ClientRotator::writeToLog(int line, const string& msg, bool critical) const
|
||||
}
|
||||
|
||||
} // namespace execplan
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -166,4 +166,3 @@ class ClientRotator
|
||||
};
|
||||
|
||||
} // namespace execplan
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -48,18 +48,8 @@ ConstantColumn::ConstantColumn(const string& sql, TYPE type)
|
||||
{
|
||||
fResult.strVal = sql;
|
||||
|
||||
if (type == LITERAL && sql.length() < 9)
|
||||
{
|
||||
memcpy(tmp, sql.c_str(), sql.length());
|
||||
memset(tmp + sql.length(), 0, 8);
|
||||
fResult.uintVal = uint64ToStr(*((uint64_t*)tmp));
|
||||
fResult.intVal = (int64_t)fResult.uintVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
fResult.intVal = atoll(sql.c_str());
|
||||
fResult.uintVal = strtoull(sql.c_str(), NULL, 0);
|
||||
}
|
||||
fResult.intVal = atoll(sql.c_str());
|
||||
fResult.uintVal = strtoull(sql.c_str(), NULL, 0);
|
||||
|
||||
fResult.floatVal = atof(sql.c_str());
|
||||
fResult.doubleVal = atof(sql.c_str());
|
||||
@ -254,7 +244,8 @@ void ConstantColumn::serialize(messageqcpp::ByteStream& b) const
|
||||
b << (uint32_t)fType;
|
||||
// b << fAlias;
|
||||
b << fData;
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
b << static_cast<ByteStream::doublebyte>(fReturnAll);
|
||||
b << (uint64_t)fResult.intVal;
|
||||
b << fResult.uintVal;
|
||||
@ -278,7 +269,9 @@ void ConstantColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
b >> fConstval;
|
||||
b >> (uint32_t&)fType;
|
||||
b >> fData;
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
b >> reinterpret_cast<ByteStream::doublebyte&>(fReturnAll);
|
||||
b >> (uint64_t&)fResult.intVal;
|
||||
b >> fResult.uintVal;
|
||||
@ -344,4 +337,3 @@ bool ConstantColumn::operator!=(const TreeNode* t) const
|
||||
}
|
||||
|
||||
} // namespace execplan
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -113,14 +113,14 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* accessor
|
||||
*/
|
||||
inline const std::string& timeZone() const
|
||||
inline long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
/**
|
||||
* mutator
|
||||
*/
|
||||
inline void timeZone(const std::string& timeZone)
|
||||
inline void timeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
@ -204,7 +204,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
std::string fConstval;
|
||||
int fType;
|
||||
std::string fData;
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
|
||||
/***********************************************************
|
||||
* F&E framework *
|
||||
|
@ -308,4 +308,3 @@ void ConstantFilter::setSimpleColumnList()
|
||||
}
|
||||
|
||||
} // namespace execplan
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -272,7 +272,8 @@ void FunctionColumn::serialize(messageqcpp::ByteStream& b) const
|
||||
|
||||
b << fTableAlias;
|
||||
b << fData;
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
}
|
||||
|
||||
void FunctionColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
@ -303,10 +304,11 @@ void FunctionColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
|
||||
b >> fTableAlias;
|
||||
b >> fData;
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
FuncExp* funcExp = FuncExp::instance();
|
||||
fFunctor = funcExp->getFunctor(fFunctionName);
|
||||
fFunctor->timeZone(fTimeZone);
|
||||
fFunctor->fix(*this);
|
||||
|
||||
// @bug 3506. Special treatment for rand() function. reset the seed
|
||||
|
@ -121,12 +121,12 @@ class FunctionColumn : public ReturnedColumn
|
||||
fTableAlias = tableAlias;
|
||||
}
|
||||
|
||||
inline const std::string timeZone() const
|
||||
inline long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
|
||||
inline void timeZone(const std::string& timeZone)
|
||||
inline void timeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
@ -181,7 +181,7 @@ class FunctionColumn : public ReturnedColumn
|
||||
std::string fFunctionName; /// function name
|
||||
std::string fTableAlias; /// table alias which has the column
|
||||
std::string fData; /// SQL representation
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@ -217,31 +217,38 @@ class FunctionColumn : public ReturnedColumn
|
||||
public:
|
||||
virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
fResult.strVal = fFunctor->getStrVal(row, fFunctionParms, isNull, fOperationType);
|
||||
return fResult.strVal;
|
||||
}
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getUintVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getFloatVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getDoubleVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getLongDoubleVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
IDB_Decimal decimal = fFunctor->getDecimalVal(row, fFunctionParms, isNull, fOperationType);
|
||||
|
||||
if (UNLIKELY(fResultType.colWidth == utils::MAXLEGACYWIDTH && fResultType.scale == decimal.scale))
|
||||
@ -276,10 +283,9 @@ class FunctionColumn : public ReturnedColumn
|
||||
if (fResultType.scale > decimal.scale)
|
||||
decimal.value *= IDB_pow[fResultType.scale - decimal.scale];
|
||||
else
|
||||
decimal.value =
|
||||
(int64_t)(decimal.value > 0
|
||||
? (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] + 0.5
|
||||
: (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] - 0.5);
|
||||
decimal.value = (int64_t)(
|
||||
decimal.value > 0 ? (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] + 0.5
|
||||
: (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] - 0.5);
|
||||
}
|
||||
|
||||
decimal.scale = fResultType.scale;
|
||||
@ -288,22 +294,27 @@ class FunctionColumn : public ReturnedColumn
|
||||
}
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getBoolVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getDateIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getDatetimeIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getTimestampIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getTimeIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,8 @@ void MCSAnalyzeTableExecutionPlan::serialize(messageqcpp::ByteStream& bs) const
|
||||
bs << fSchemaName;
|
||||
bs << fTableName;
|
||||
bs << fLocalQuery;
|
||||
bs << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
bs << timeZone;
|
||||
bs << fTraceFlags;
|
||||
}
|
||||
|
||||
@ -149,7 +150,9 @@ void MCSAnalyzeTableExecutionPlan::unserialize(messageqcpp::ByteStream& bs)
|
||||
bs >> fSchemaName;
|
||||
bs >> fTableName;
|
||||
bs >> fLocalQuery;
|
||||
bs >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
bs >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
bs >> fTraceFlags;
|
||||
}
|
||||
} // namespace execplan
|
||||
|
@ -169,12 +169,12 @@ class MCSAnalyzeTableExecutionPlan : public CalpontExecutionPlan
|
||||
return fUuid;
|
||||
}
|
||||
|
||||
void timeZone(const std::string& timezone)
|
||||
void timeZone(long timezone)
|
||||
{
|
||||
fTimeZone = timezone;
|
||||
}
|
||||
|
||||
const std::string timeZone() const
|
||||
long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
@ -256,7 +256,7 @@ class MCSAnalyzeTableExecutionPlan : public CalpontExecutionPlan
|
||||
std::string fTableName;
|
||||
uint32_t fTraceFlags;
|
||||
boost::uuids::uuid fUuid;
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
uint32_t fStatementID;
|
||||
uint64_t fStringScanThreshold;
|
||||
std::string fData;
|
||||
|
@ -264,20 +264,6 @@ void PredicateOperator::setOpType(Type& l, Type& r)
|
||||
fOperationType.colWidth = 8;
|
||||
}
|
||||
}
|
||||
// If both sides are unsigned, use UBIGINT as result type, otherwise
|
||||
// "promote" to BIGINT.
|
||||
else if (isUnsigned(l.colDataType) && isUnsigned(r.colDataType))
|
||||
{
|
||||
fOperationType.colDataType = execplan::CalpontSystemCatalog::UBIGINT;
|
||||
fOperationType.colWidth = 8;
|
||||
}
|
||||
else if ((isSignedInteger(l.colDataType) && isUnsigned(r.colDataType)) ||
|
||||
(isUnsigned(l.colDataType) && isSignedInteger(r.colDataType)) ||
|
||||
(isSignedInteger(l.colDataType) && isSignedInteger(r.colDataType)))
|
||||
{
|
||||
fOperationType.colDataType = execplan::CalpontSystemCatalog::BIGINT;
|
||||
fOperationType.colWidth = 8;
|
||||
}
|
||||
else if ((l.colDataType == execplan::CalpontSystemCatalog::CHAR ||
|
||||
l.colDataType == execplan::CalpontSystemCatalog::VARCHAR ||
|
||||
l.colDataType == execplan::CalpontSystemCatalog::TEXT) &&
|
||||
@ -321,6 +307,20 @@ void PredicateOperator::setOpType(Type& l, Type& r)
|
||||
fOperationType.colWidth = 255;
|
||||
}
|
||||
}
|
||||
// If both sides are unsigned, use UBIGINT as result type, otherwise
|
||||
// "promote" to BIGINT.
|
||||
else if (isUnsigned(l.colDataType) && isInteger(l.colDataType) && isUnsigned(r.colDataType) && isInteger(r.colDataType))
|
||||
{
|
||||
fOperationType.colDataType = execplan::CalpontSystemCatalog::UBIGINT;
|
||||
fOperationType.colWidth = 8;
|
||||
}
|
||||
else if ((isSignedInteger(l.colDataType) && isUnsigned(r.colDataType) && isInteger(r.colDataType)) ||
|
||||
(isUnsigned(l.colDataType) && isInteger(l.colDataType) && isSignedInteger(r.colDataType)) ||
|
||||
(isSignedInteger(l.colDataType) && isSignedInteger(r.colDataType)))
|
||||
{
|
||||
fOperationType.colDataType = execplan::CalpontSystemCatalog::BIGINT;
|
||||
fOperationType.colWidth = 8;
|
||||
}
|
||||
else if (l.colDataType == execplan::CalpontSystemCatalog::LONGDOUBLE ||
|
||||
r.colDataType == execplan::CalpontSystemCatalog::LONGDOUBLE)
|
||||
{
|
||||
@ -410,7 +410,9 @@ bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedCol
|
||||
if (isNull)
|
||||
return false;
|
||||
|
||||
return numericCompare(val1, rop->getIntVal(row, isNull)) && !isNull;
|
||||
int64_t val2 = rop->getIntVal(row, isNull);
|
||||
|
||||
return numericCompare(val1, val2) && !isNull;
|
||||
}
|
||||
|
||||
case execplan::CalpontSystemCatalog::UBIGINT:
|
||||
|
@ -36,7 +36,6 @@
|
||||
#endif
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include "expressionparser.h"
|
||||
#include "returnedcolumn.h"
|
||||
|
@ -213,4 +213,3 @@ class SessionManager
|
||||
|
||||
} // namespace execplan
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -345,7 +345,8 @@ void SimpleColumn::serialize(messageqcpp::ByteStream& b) const
|
||||
b << fColumnName;
|
||||
b << fIndexName;
|
||||
b << fViewName;
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
b << (uint32_t)fOid;
|
||||
b << fData;
|
||||
b << fTableAlias;
|
||||
@ -362,7 +363,9 @@ void SimpleColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
b >> fColumnName;
|
||||
b >> fIndexName;
|
||||
b >> fViewName;
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
b >> (uint32_t&)fOid;
|
||||
b >> fData;
|
||||
b >> fTableAlias;
|
||||
@ -562,6 +565,16 @@ void SimpleColumn::evaluate(Row& row, bool& isNull)
|
||||
else
|
||||
fResult.intVal = atoll((char*)&fResult.origIntVal);
|
||||
|
||||
// MCOL-4580 - related, probably can be marked with XXX.
|
||||
// This does not fail in any tests, but it is considered wrong.
|
||||
// The reasonin behind that is that we changed signedness if characters to unsigned
|
||||
// and it might be a case with short strings that they were copied as is using
|
||||
// uint64ToStr encoding into int64_t values. So, potentially, unsuspecting code
|
||||
// may use getUintVal instead of getIntVal to process short char column, getting
|
||||
// unitialized value and give floating behavior.
|
||||
// None of our tests failed, though.
|
||||
fResult.uintVal = fResult.intVal;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -151,11 +151,11 @@ class SimpleColumn : public ReturnedColumn
|
||||
if (lower_case_table_names)
|
||||
boost::algorithm::to_lower(fViewName);
|
||||
}
|
||||
inline const std::string& timeZone() const
|
||||
inline long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
inline void timeZone(const std::string& timeZone)
|
||||
inline void timeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
@ -259,7 +259,7 @@ class SimpleColumn : public ReturnedColumn
|
||||
std::string fIndexName;
|
||||
// if belong to view, view name is non-empty
|
||||
std::string fViewName;
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
bool fisColumnStore;
|
||||
|
||||
/** @brief parse SimpleColumn text
|
||||
@ -349,7 +349,7 @@ class SimpleColumn : public ReturnedColumn
|
||||
inline int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getDatetimeIntVal();
|
||||
return TreeNode::getDatetimeIntVal(fTimeZone);
|
||||
}
|
||||
|
||||
inline int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull)
|
||||
|
@ -55,7 +55,7 @@ SimpleFilter::SimpleFilter(const string& sql) : Filter(sql)
|
||||
parse(sql);
|
||||
}
|
||||
|
||||
SimpleFilter::SimpleFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs, const string& timeZone)
|
||||
SimpleFilter::SimpleFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs, const long timeZone)
|
||||
: fOp(op), fLhs(lhs), fRhs(rhs), fIndexFlag(NOINDEX), fJoinFlag(EQUA), fTimeZone(timeZone)
|
||||
{
|
||||
convertConstant();
|
||||
@ -314,7 +314,8 @@ void SimpleFilter::serialize(messageqcpp::ByteStream& b) const
|
||||
|
||||
b << static_cast<uint32_t>(fIndexFlag);
|
||||
b << static_cast<uint32_t>(fJoinFlag);
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
}
|
||||
|
||||
void SimpleFilter::unserialize(messageqcpp::ByteStream& b)
|
||||
@ -330,7 +331,9 @@ void SimpleFilter::unserialize(messageqcpp::ByteStream& b)
|
||||
fRhs = dynamic_cast<ReturnedColumn*>(ObjectReader::createTreeNode(b));
|
||||
b >> reinterpret_cast<uint32_t&>(fIndexFlag);
|
||||
b >> reinterpret_cast<uint32_t&>(fJoinFlag);
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
|
||||
fSimpleColumnList.clear();
|
||||
fAggColumnList.clear();
|
||||
|
@ -67,7 +67,7 @@ class SimpleFilter : public Filter
|
||||
|
||||
SimpleFilter();
|
||||
SimpleFilter(const std::string& sql);
|
||||
SimpleFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs, const std::string& timeZone = "");
|
||||
SimpleFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs, const long timeZone = 0);
|
||||
SimpleFilter(const SimpleFilter& rhs);
|
||||
|
||||
virtual ~SimpleFilter();
|
||||
@ -92,12 +92,12 @@ class SimpleFilter : public Filter
|
||||
return fLhs;
|
||||
}
|
||||
|
||||
inline const std::string& timeZone() const
|
||||
inline long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
|
||||
inline void timeZone(const std::string& timeZone)
|
||||
inline void timeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
@ -220,7 +220,7 @@ class SimpleFilter : public Filter
|
||||
ReturnedColumn* fRhs; /// right operand
|
||||
int fIndexFlag; /// which side col is index
|
||||
int fJoinFlag; /// hash join type
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
|
||||
void parse(std::string);
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "columnwidth.h"
|
||||
#include "mcs_decimal.h"
|
||||
#include "mcs_int64.h"
|
||||
#include "numericliteral.h"
|
||||
|
||||
namespace messageqcpp
|
||||
{
|
||||
@ -62,7 +63,7 @@ typedef datatypes::Decimal IDB_Decimal;
|
||||
#ifdef POSIX_REGEX
|
||||
typedef regex_t IDB_Regex;
|
||||
#else
|
||||
typedef boost::regex IDB_Regex;
|
||||
typedef std::regex IDB_Regex;
|
||||
#endif
|
||||
|
||||
typedef IDB_Regex CNX_Regex;
|
||||
@ -325,7 +326,7 @@ class TreeNode
|
||||
}
|
||||
|
||||
inline bool getBoolVal();
|
||||
inline const std::string& getStrVal(const std::string& timeZone);
|
||||
inline const std::string& getStrVal(const long timeZone);
|
||||
inline int64_t getIntVal();
|
||||
inline uint64_t getUintVal();
|
||||
inline float getFloatVal();
|
||||
@ -333,7 +334,7 @@ class TreeNode
|
||||
inline long double getLongDoubleVal();
|
||||
inline IDB_Decimal getDecimalVal();
|
||||
inline int32_t getDateIntVal();
|
||||
inline int64_t getDatetimeIntVal();
|
||||
inline int64_t getDatetimeIntVal(long timeZone = 0);
|
||||
inline int64_t getTimestampIntVal();
|
||||
inline int64_t getTimeIntVal();
|
||||
|
||||
@ -457,7 +458,7 @@ inline bool TreeNode::getBoolVal()
|
||||
return fResult.boolVal;
|
||||
}
|
||||
|
||||
inline const std::string& TreeNode::getStrVal(const std::string& timeZone)
|
||||
inline const std::string& TreeNode::getStrVal(const long timeZone)
|
||||
{
|
||||
switch (fResultType.colDataType)
|
||||
{
|
||||
@ -664,25 +665,19 @@ inline int64_t TreeNode::getIntVal()
|
||||
switch (fResultType.colDataType)
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
if (fResultType.colWidth <= 8)
|
||||
return fResult.intVal;
|
||||
|
||||
return atoll(fResult.strVal.c_str());
|
||||
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
if (fResultType.colWidth <= 7)
|
||||
return fResult.intVal;
|
||||
|
||||
return atoll(fResult.strVal.c_str());
|
||||
|
||||
// FIXME: ???
|
||||
case CalpontSystemCatalog::VARBINARY:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::TEXT:
|
||||
if (fResultType.colWidth <= 7)
|
||||
return fResult.intVal;
|
||||
|
||||
return atoll(fResult.strVal.c_str());
|
||||
{
|
||||
datatypes::DataCondition cnverr;
|
||||
literal::Converter<literal::SignedInteger> cnv(fResult.strVal, cnverr);
|
||||
if (datatypes::DataCondition::Code(cnverr) != 0)
|
||||
{
|
||||
cerr << "error in int conversion from '" << fResult.strVal << "'";
|
||||
}
|
||||
return cnv.toSInt<int64_t>(cnverr);
|
||||
}
|
||||
|
||||
case CalpontSystemCatalog::BIGINT:
|
||||
case CalpontSystemCatalog::TINYINT:
|
||||
@ -721,6 +716,20 @@ inline uint64_t TreeNode::getUintVal()
|
||||
{
|
||||
switch (fResultType.colDataType)
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
case CalpontSystemCatalog::VARBINARY:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::TEXT:
|
||||
{
|
||||
datatypes::DataCondition cnverr;
|
||||
literal::Converter<literal::UnsignedInteger> cnv(fResult.strVal, cnverr);
|
||||
if (datatypes::DataCondition::Code(cnverr) != 0)
|
||||
{
|
||||
cerr << "error in unsigned int conversion from '" << fResult.strVal << "'";
|
||||
}
|
||||
return cnv.toXIntPositive<uint64_t>(cnverr);
|
||||
}
|
||||
case CalpontSystemCatalog::BIGINT:
|
||||
case CalpontSystemCatalog::TINYINT:
|
||||
case CalpontSystemCatalog::SMALLINT:
|
||||
@ -1052,7 +1061,7 @@ inline IDB_Decimal TreeNode::getDecimalVal()
|
||||
return fResult.decimalVal;
|
||||
}
|
||||
|
||||
inline int64_t TreeNode::getDatetimeIntVal()
|
||||
inline int64_t TreeNode::getDatetimeIntVal(long timeZone)
|
||||
{
|
||||
if (fResultType.colDataType == execplan::CalpontSystemCatalog::DATE)
|
||||
return (fResult.intVal & 0x00000000FFFFFFC0LL) << 32;
|
||||
@ -1083,6 +1092,17 @@ inline int64_t TreeNode::getDatetimeIntVal()
|
||||
else if (fResultType.colDataType == execplan::CalpontSystemCatalog::DATETIME)
|
||||
// return (fResult.intVal & 0xFFFFFFFFFFF00000LL);
|
||||
return (fResult.intVal);
|
||||
else if (fResultType.colDataType == execplan::CalpontSystemCatalog::TIMESTAMP)
|
||||
{
|
||||
dataconvert::TimeStamp timestamp(fResult.intVal);
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone);
|
||||
dataconvert::DateTime dt(m_time.year, m_time.month, m_time.day, m_time.hour, m_time.minute, m_time.second,
|
||||
timestamp.msecond);
|
||||
memcpy(&fResult.intVal, &dt, 8);
|
||||
return fResult.intVal;
|
||||
}
|
||||
else
|
||||
return getIntVal();
|
||||
}
|
||||
|
@ -288,7 +288,8 @@ void WindowFunctionColumn::serialize(messageqcpp::ByteStream& b) const
|
||||
|
||||
fOrderBy.serialize(b);
|
||||
udafContext.serialize(b);
|
||||
b << fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone = fTimeZone;
|
||||
b << timeZone;
|
||||
}
|
||||
|
||||
void WindowFunctionColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
@ -320,7 +321,9 @@ void WindowFunctionColumn::unserialize(messageqcpp::ByteStream& b)
|
||||
|
||||
fOrderBy.unserialize(b);
|
||||
udafContext.unserialize(b);
|
||||
b >> fTimeZone;
|
||||
messageqcpp::ByteStream::octbyte timeZone;
|
||||
b >> timeZone;
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
|
||||
void WindowFunctionColumn::addToPartition(vector<SRCP>& groupByList)
|
||||
|
@ -146,12 +146,12 @@ class WindowFunctionColumn : public ReturnedColumn
|
||||
return udafContext;
|
||||
}
|
||||
|
||||
inline const std::string timeZone() const
|
||||
inline long timeZone() const
|
||||
{
|
||||
return fTimeZone;
|
||||
}
|
||||
|
||||
inline void timeZone(const std::string& timeZone)
|
||||
inline void timeZone(const long timeZone)
|
||||
{
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
@ -180,7 +180,7 @@ class WindowFunctionColumn : public ReturnedColumn
|
||||
// UDAnF support
|
||||
mcsv1sdk::mcsv1Context udafContext;
|
||||
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
/***********************************************************
|
||||
* F&E framework *
|
||||
***********************************************************/
|
||||
|
@ -36,7 +36,6 @@ set(joblist_LIB_SRCS
|
||||
pcolstep.cpp
|
||||
pdictionary.cpp
|
||||
pdictionaryscan.cpp
|
||||
primitivemsg.cpp
|
||||
pseudocc-jl.cpp
|
||||
resourcedistributor.cpp
|
||||
resourcemanager.cpp
|
||||
@ -59,7 +58,7 @@ set(joblist_LIB_SRCS
|
||||
${ENGINE_SRC_DIR}/tools/passwd/secrets.cpp)
|
||||
|
||||
add_library(joblist SHARED ${joblist_LIB_SRCS})
|
||||
|
||||
target_include_directories(joblist BEFORE PUBLIC ${OPENSSL_INCLUDE_DIR})
|
||||
add_dependencies(joblist loggingcpp)
|
||||
|
||||
install(TARGETS joblist DESTINATION ${ENGINE_LIBDIR} COMPONENT columnstore-engine)
|
||||
|
@ -170,4 +170,3 @@ std::ostream& omitOidInDL(std::ostream& strm)
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -50,6 +50,8 @@ using namespace messageqcpp;
|
||||
using namespace rowgroup;
|
||||
using namespace joiner;
|
||||
|
||||
//#define XXX_BATCHPRIMPROC_TOKENS_RANGES_XXX
|
||||
|
||||
namespace joblist
|
||||
{
|
||||
BatchPrimitiveProcessorJL::BatchPrimitiveProcessorJL(const ResourceManager* rm)
|
||||
@ -152,6 +154,21 @@ void BatchPrimitiveProcessorJL::addFilterStep(const pDictionaryStep& step)
|
||||
cc->setBatchPrimitiveProcessor(this);
|
||||
cc->setQueryUuid(step.queryUuid());
|
||||
cc->setStepUuid(uuid);
|
||||
|
||||
#if defined(XXX_BATCHPRIMPROC_TOKENS_RANGES_XXX)
|
||||
if (filterSteps.size() > 0)
|
||||
{
|
||||
size_t stepsIndex = filterSteps.size() - 1;
|
||||
SCommand prevCC = filterSteps[stepsIndex];
|
||||
ColumnCommandJL* pcc = dynamic_cast<ColumnCommandJL*>(prevCC.get());
|
||||
DictStepJL* ccc = dynamic_cast<DictStepJL*>(cc.get());
|
||||
if (pcc && ccc)
|
||||
{
|
||||
filterSteps[stepsIndex].reset(
|
||||
new ColumnCommandJL(*pcc, *ccc)); // column command will use same filters.
|
||||
}
|
||||
}
|
||||
#endif
|
||||
filterSteps.push_back(cc);
|
||||
filterCount++;
|
||||
needStrValues = true;
|
||||
@ -443,6 +460,7 @@ void BatchPrimitiveProcessorJL::getElementTypes(ByteStream& in, vector<ElementTy
|
||||
if (*validCPData)
|
||||
{
|
||||
in >> *lbid;
|
||||
|
||||
in >> tmp64;
|
||||
*min = (int64_t)tmp64;
|
||||
in >> tmp64;
|
||||
@ -712,8 +730,9 @@ bool BatchPrimitiveProcessorJL::countThisMsg(messageqcpp::ByteStream& in) const
|
||||
}
|
||||
|
||||
if (data[offset] != 0)
|
||||
offset += (data[offset + CP_FLAG_AND_LBID] * 2) + CP_FLAG_AND_LBID +
|
||||
1; // skip the CP data with wide min/max values (16/32 bytes each)
|
||||
offset += (data[offset + CP_FLAG_AND_LBID + 1] * 2) + CP_FLAG_AND_LBID + 1 +
|
||||
1; // skip the CP data with wide min/max values (16/32 bytes each). we also skip
|
||||
// cpFromDictScan flag.
|
||||
else
|
||||
offset += CP_FLAG_AND_LBID; // skip only the "valid CP data" & LBID bytes
|
||||
}
|
||||
@ -750,9 +769,10 @@ void BatchPrimitiveProcessorJL::deserializeAggregateResult(ByteStream* in, vecto
|
||||
}
|
||||
|
||||
void BatchPrimitiveProcessorJL::getRowGroupData(ByteStream& in, vector<RGData>* out, bool* validCPData,
|
||||
uint64_t* lbid, int128_t* min, int128_t* max,
|
||||
uint32_t* cachedIO, uint32_t* physIO, uint32_t* touchedBlocks,
|
||||
bool* countThis, uint32_t threadID, bool* hasWideColumn,
|
||||
uint64_t* lbid, bool* fromDictScan, int128_t* min,
|
||||
int128_t* max, uint32_t* cachedIO, uint32_t* physIO,
|
||||
uint32_t* touchedBlocks, bool* countThis, uint32_t threadID,
|
||||
bool* hasWideColumn,
|
||||
const execplan::CalpontSystemCatalog::ColType& colType) const
|
||||
{
|
||||
uint64_t tmp64;
|
||||
@ -789,6 +809,8 @@ void BatchPrimitiveProcessorJL::getRowGroupData(ByteStream& in, vector<RGData>*
|
||||
{
|
||||
in >> *lbid;
|
||||
in >> tmp8;
|
||||
*fromDictScan = tmp8 != 0;
|
||||
in >> tmp8;
|
||||
*hasWideColumn = (tmp8 > utils::MAXLEGACYWIDTH);
|
||||
if (UNLIKELY(*hasWideColumn))
|
||||
{
|
||||
|
@ -167,9 +167,9 @@ class BatchPrimitiveProcessorJL
|
||||
uint32_t* touchedBlocks) const;
|
||||
void deserializeAggregateResults(messageqcpp::ByteStream* in, std::vector<rowgroup::RGData>* out) const;
|
||||
void getRowGroupData(messageqcpp::ByteStream& in, std::vector<rowgroup::RGData>* out, bool* validCPData,
|
||||
uint64_t* lbid, int128_t* min, int128_t* max, uint32_t* cachedIO, uint32_t* physIO,
|
||||
uint32_t* touchedBlocks, bool* countThis, uint32_t threadID, bool* hasBinaryColumn,
|
||||
const execplan::CalpontSystemCatalog::ColType& colType) const;
|
||||
uint64_t* lbid, bool* fromDictScan, int128_t* min, int128_t* max, uint32_t* cachedIO,
|
||||
uint32_t* physIO, uint32_t* touchedBlocks, bool* countThis, uint32_t threadID,
|
||||
bool* hasBinaryColumn, const execplan::CalpontSystemCatalog::ColType& colType) const;
|
||||
void deserializeAggregateResult(messageqcpp::ByteStream* in, std::vector<rowgroup::RGData>* out) const;
|
||||
bool countThisMsg(messageqcpp::ByteStream& in) const;
|
||||
|
||||
@ -365,5 +365,3 @@ class BatchPrimitiveProcessorJL
|
||||
};
|
||||
|
||||
} // namespace joblist
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -28,7 +28,6 @@
|
||||
//
|
||||
//
|
||||
/** @file */
|
||||
// #include "primitivemsg.h"
|
||||
#include "bytestream.h"
|
||||
#include "messagequeue.h"
|
||||
#include "serializeable.h"
|
||||
|
@ -130,6 +130,59 @@ ColumnCommandJL::ColumnCommandJL(const pColStep& step)
|
||||
fFilesPerColumnPartition = cf->uFromText(fpc);
|
||||
}
|
||||
|
||||
ColumnCommandJL::ColumnCommandJL(const ColumnCommandJL& prevCmd, const DictStepJL& dictWithFilters)
|
||||
{
|
||||
BRM::DBRM dbrm;
|
||||
|
||||
/* grab necessary vars from scan */
|
||||
traceFlags = prevCmd.traceFlags;
|
||||
// we should call this constructor only when paired with dictionary
|
||||
// and in that case previous command should not have any filters and
|
||||
// should be "dict" (tokens) column command.
|
||||
idbassert(dictWithFilters.getFilterCount() == 0 || prevCmd.filterCount == 0);
|
||||
idbassert(prevCmd.fIsDict);
|
||||
|
||||
// need to reencode filters.
|
||||
filterString = dictWithFilters.reencodedFilterString();
|
||||
// we have a limitation here.
|
||||
// consider this: textcol IS NULL AND textcol IN ('a', 'b')
|
||||
// XXX: should check.
|
||||
if (filterString.length() > 0 && (BOP = dictWithFilters.getBop() || prevCmd.filterString.length() < 1))
|
||||
{
|
||||
filterCount = dictWithFilters.getFilterCount();
|
||||
BOP = dictWithFilters.getBop();
|
||||
fContainsRanges = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
filterCount = prevCmd.filterCount;
|
||||
filterString = prevCmd.filterString;
|
||||
BOP = prevCmd.BOP;
|
||||
}
|
||||
isScan = prevCmd.isScan;
|
||||
colType = prevCmd.colType;
|
||||
extents = prevCmd.extents;
|
||||
OID = prevCmd.OID;
|
||||
colName = prevCmd.colName;
|
||||
rpbShift = prevCmd.rpbShift;
|
||||
fIsDict = prevCmd.fIsDict;
|
||||
fLastLbid = prevCmd.fLastLbid;
|
||||
lbid = prevCmd.lbid;
|
||||
traceFlags = prevCmd.traceFlags;
|
||||
dbroot = prevCmd.dbroot;
|
||||
numDBRoots = prevCmd.numDBRoots;
|
||||
|
||||
/* I think modmask isn't necessary for scans */
|
||||
divShift = prevCmd.divShift;
|
||||
modMask = (1 << divShift) - 1;
|
||||
|
||||
// @Bug 2889. Drop partition enhancement. Read FilesPerColumnPartition and ExtentsPerSegmentFile for use
|
||||
// in RID calculation.
|
||||
fFilesPerColumnPartition = prevCmd.fFilesPerColumnPartition;
|
||||
// MCOL-4685 remove the option to set more than 2 extents per file (ExtentsPreSegmentFile).
|
||||
fExtentsPerSegmentFile = prevCmd.fExtentsPerSegmentFile;
|
||||
}
|
||||
|
||||
ColumnCommandJL::~ColumnCommandJL()
|
||||
{
|
||||
}
|
||||
@ -141,9 +194,22 @@ void ColumnCommandJL::createCommand(ByteStream& bs) const
|
||||
colType.serialize(bs);
|
||||
bs << (uint8_t)isScan;
|
||||
bs << traceFlags;
|
||||
bs << filterString;
|
||||
bs << BOP;
|
||||
bs << filterCount;
|
||||
if (isDict() && fContainsRanges)
|
||||
{
|
||||
// XXX: we should discern here between IS (NOT) NULL and other filters.
|
||||
ByteStream empty;
|
||||
auto zeroFC = filterCount;
|
||||
bs << empty;
|
||||
bs << BOP;
|
||||
zeroFC = 0;
|
||||
bs << zeroFC;
|
||||
}
|
||||
else
|
||||
{
|
||||
bs << filterString;
|
||||
bs << BOP;
|
||||
bs << filterCount;
|
||||
}
|
||||
serializeInlineVector(bs, fLastLbid);
|
||||
|
||||
CommandJL::createCommand(bs);
|
||||
@ -250,7 +316,7 @@ string ColumnCommandJL::toString()
|
||||
{
|
||||
ostringstream ret;
|
||||
|
||||
ret << "ColumnCommandJL: " << filterCount << " filters colwidth=" << colType.colWidth << " oid=" << OID
|
||||
ret << "ColumnCommandJL: " << filterCount << " filters, BOP=" << ((int)BOP) << ", colwidth=" << colType.colWidth << " oid=" << OID
|
||||
<< " name=" << colName;
|
||||
|
||||
if (isScan)
|
||||
@ -286,4 +352,9 @@ void ColumnCommandJL::reloadExtents()
|
||||
sort(extents.begin(), extents.end(), BRM::ExtentSorter());
|
||||
}
|
||||
|
||||
bool ColumnCommandJL::getIsDict()
|
||||
{
|
||||
return fIsDict;
|
||||
}
|
||||
|
||||
}; // namespace joblist
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "primitivestep.h"
|
||||
#include "command-jl.h"
|
||||
#include "dictstep-jl.h"
|
||||
|
||||
namespace joblist
|
||||
{
|
||||
@ -41,15 +42,16 @@ class ColumnCommandJL : public CommandJL
|
||||
public:
|
||||
ColumnCommandJL(const pColScanStep&, std::vector<BRM::LBID_t> lastLBID);
|
||||
ColumnCommandJL(const pColStep&);
|
||||
ColumnCommandJL(const ColumnCommandJL&, const DictStepJL&);
|
||||
virtual ~ColumnCommandJL();
|
||||
|
||||
virtual void createCommand(messageqcpp::ByteStream& bs) const;
|
||||
virtual void runCommand(messageqcpp::ByteStream& bs) const;
|
||||
void setLBID(uint64_t rid, uint32_t dbroot);
|
||||
uint8_t getTableColumnType();
|
||||
virtual std::string toString();
|
||||
uint16_t getWidth();
|
||||
CommandType getCommandType()
|
||||
virtual void createCommand(messageqcpp::ByteStream& bs) const override;
|
||||
virtual void runCommand(messageqcpp::ByteStream& bs) const override;
|
||||
void setLBID(uint64_t rid, uint32_t dbroot) override;
|
||||
uint8_t getTableColumnType() override;
|
||||
virtual std::string toString() override;
|
||||
uint16_t getWidth() override;
|
||||
CommandType getCommandType() override
|
||||
{
|
||||
return COLUMN_COMMAND;
|
||||
}
|
||||
@ -111,6 +113,7 @@ class ColumnCommandJL : public CommandJL
|
||||
std::vector<BRM::LBID_t> fLastLbid;
|
||||
|
||||
bool fIsDict;
|
||||
bool fContainsRanges = false;
|
||||
|
||||
// @Bug 2889. Added two members below for drop partition enhancement.
|
||||
// RJD: make sure that we keep enough significant digits around for partition math
|
||||
@ -125,8 +128,7 @@ class ColumnCommandJL : public CommandJL
|
||||
public:
|
||||
// MCOL-4685: remove the option to set more than 2 extents per file (ExtentsPreSegmentFile)
|
||||
static const unsigned DEFAULT_EXTENTS_PER_SEGMENT_FILE = 2;
|
||||
bool getIsDict() override;
|
||||
};
|
||||
|
||||
} // namespace joblist
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -96,6 +96,11 @@ class CommandJL
|
||||
|
||||
virtual CommandType getCommandType() = 0;
|
||||
|
||||
virtual bool getIsDict()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
BatchPrimitiveProcessorJL* bpp;
|
||||
uint32_t OID;
|
||||
|
@ -828,4 +828,3 @@ void CrossEngineStep::formatMiniStats()
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -249,4 +249,3 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep
|
||||
|
||||
} // namespace joblist
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -29,6 +29,7 @@
|
||||
//
|
||||
|
||||
#include "bpp-jl.h"
|
||||
#include "string_prefixes.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace messageqcpp;
|
||||
@ -50,7 +51,6 @@ DictStepJL::DictStepJL(const pDictionaryStep& dict)
|
||||
|
||||
if (hasEqFilter)
|
||||
{
|
||||
// cout << "saw eqfilter\n";
|
||||
eqOp = dict.tmpCOP;
|
||||
eqFilter = dict.eqFilter;
|
||||
}
|
||||
@ -120,4 +120,63 @@ void DictStepJL::setWidth(uint16_t w)
|
||||
colWidth = w;
|
||||
}
|
||||
|
||||
messageqcpp::ByteStream DictStepJL::reencodedFilterString() const
|
||||
{
|
||||
messageqcpp::ByteStream bs;
|
||||
|
||||
if (hasEqFilter)
|
||||
{
|
||||
idbassert(filterCount == eqFilter.size());
|
||||
|
||||
for (uint32_t i = 0; i < filterCount; i++)
|
||||
{
|
||||
uint8_t roundFlag = 0;
|
||||
int64_t encodedPrefix = encodeStringPrefix((unsigned char*)eqFilter[i].c_str(), eqFilter[i].size(), charsetNumber);
|
||||
bs << eqOp;
|
||||
bs << roundFlag;
|
||||
bs << encodedPrefix;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
messageqcpp::ByteStream filterStringCopy(
|
||||
filterString); // XXX I am not sure about real semantics of messagecpp::ByteStream. So - copy.
|
||||
// please erfer to pdictionary.cpp in this dicrectory, addFilter function for a proper encoding of string
|
||||
// filters.
|
||||
for (uint32_t i = 0; i < filterCount; i++)
|
||||
{
|
||||
uint8_t cop, roundFlag = 0;
|
||||
uint16_t size;
|
||||
const uint8_t* ptr;
|
||||
int64_t encodedPrefix;
|
||||
filterStringCopy >> cop;
|
||||
// as we are dealing with prefixes, we have to use "... or equal" conditions instead of
|
||||
// strict ones.
|
||||
// Consider this: ... WHERE col > 'customer#001' AND col < 'customer#100'.
|
||||
// "Working with prefixes of 8 bytes" means these conditions reduce to ... WHERE col > 'customer' AND
|
||||
// col < 'customer' and their AND relation is impossible to satisfy. We do not pass this string to
|
||||
// primproc and that means we can reencode operation codes here.
|
||||
switch (cop)
|
||||
{
|
||||
case COMPARE_LT:
|
||||
case COMPARE_NGE: cop = COMPARE_LE; break;
|
||||
|
||||
case COMPARE_GT:
|
||||
case COMPARE_NLE: cop = COMPARE_GE; break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
bs << cop;
|
||||
bs << roundFlag;
|
||||
filterStringCopy >> size;
|
||||
ptr = filterStringCopy.buf();
|
||||
encodedPrefix = encodeStringPrefix(ptr, size, charsetNumber);
|
||||
bs << encodedPrefix;
|
||||
filterStringCopy.advance(size);
|
||||
}
|
||||
}
|
||||
return bs;
|
||||
}
|
||||
|
||||
}; // namespace joblist
|
||||
|
@ -61,6 +61,21 @@ class DictStepJL : public CommandJL
|
||||
void createCommand(messageqcpp::ByteStream&) const;
|
||||
void runCommand(messageqcpp::ByteStream&) const;
|
||||
|
||||
messageqcpp::ByteStream getFilterString() const
|
||||
{
|
||||
return filterString;
|
||||
}
|
||||
uint32_t getFilterCount() const
|
||||
{
|
||||
return filterCount;
|
||||
}
|
||||
messageqcpp::ByteStream reencodedFilterString() const;
|
||||
|
||||
uint8_t getBop() const
|
||||
{
|
||||
return BOP;
|
||||
}
|
||||
|
||||
private:
|
||||
DictStepJL(const DictStepJL&);
|
||||
|
||||
|
@ -163,7 +163,7 @@ void DiskJoinStep::smallReader()
|
||||
RGData rgData;
|
||||
bool more = true;
|
||||
int64_t memUsage = 0, combinedMemUsage = 0;
|
||||
int rowCount = 0;
|
||||
[[maybe_unused]] int rowCount = 0;
|
||||
RowGroup l_smallRG = smallRG;
|
||||
|
||||
try
|
||||
@ -224,7 +224,7 @@ void DiskJoinStep::largeReader()
|
||||
RGData rgData;
|
||||
bool more = true;
|
||||
int64_t largeSize = 0;
|
||||
int rowCount = 0;
|
||||
[[maybe_unused]] int rowCount = 0;
|
||||
RowGroup l_largeRG = largeRG;
|
||||
|
||||
largeIterationCount++;
|
||||
|
@ -199,7 +199,7 @@ void DistributedEngineComm::reset()
|
||||
}
|
||||
|
||||
DistributedEngineComm::DistributedEngineComm(ResourceManager* rm, bool isExeMgr)
|
||||
: fRm(rm), fLBIDShift(fRm->getPsLBID_Shift()), pmCount(0), fIsExeMgr(isExeMgr)
|
||||
: fRm(rm), pmCount(0), fIsExeMgr(isExeMgr)
|
||||
{
|
||||
Setup();
|
||||
}
|
||||
@ -250,10 +250,6 @@ void DistributedEngineComm::Setup()
|
||||
if (newPmCount == 0)
|
||||
writeToLog(__FILE__, __LINE__, "Got a config file with 0 PMs", LOG_TYPE_CRITICAL);
|
||||
|
||||
// This needs to make sense when compared to the extent size
|
||||
// fLBIDShift = static_cast<unsigned>(config::Config::uFromText(fConfig->getConfig(section,
|
||||
// "LBID_Shift")));
|
||||
|
||||
auto* config = fRm->getConfig();
|
||||
std::vector<messageqcpp::AddrAndPortPair> pmsAddressesAndPorts;
|
||||
for (size_t i = 1; i <= newPmCount; ++i)
|
||||
@ -292,7 +288,7 @@ void DistributedEngineComm::Setup()
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
if (i < newPmCount)
|
||||
newPmCount--;
|
||||
newPmCount = newPmCount > 1 ? newPmCount-1 : 1; // We can't afford to reduce newPmCount to 0
|
||||
|
||||
writeToLog(__FILE__, __LINE__,
|
||||
"Could not connect to PMS" + std::to_string(connectionId) + ": " + ex.what(),
|
||||
@ -306,7 +302,7 @@ void DistributedEngineComm::Setup()
|
||||
catch (...)
|
||||
{
|
||||
if (i < newPmCount)
|
||||
newPmCount--;
|
||||
newPmCount = newPmCount > 1 ? newPmCount-1 : 1; // We can't afford to reduce newPmCount to 0
|
||||
|
||||
writeToLog(__FILE__, __LINE__, "Could not connect to PMS" + std::to_string(connectionId),
|
||||
LOG_TYPE_ERROR);
|
||||
@ -1155,4 +1151,3 @@ uint32_t DistributedEngineComm::MQE::getNextConnectionId(const size_t pmIndex,
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -269,7 +269,6 @@ class DistributedEngineComm
|
||||
boost::mutex fMlock; // sessionMessages mutex
|
||||
std::vector<boost::shared_ptr<boost::mutex> > fWlock; // PrimProc socket write mutexes
|
||||
bool fBusy;
|
||||
unsigned fLBIDShift;
|
||||
volatile uint32_t pmCount;
|
||||
boost::mutex fOnErrMutex; // to lock function scope to reset pmconnections under error condition
|
||||
boost::mutex fSetupMutex;
|
||||
|
@ -638,4 +638,3 @@ extern std::ostream& omitOidInDL(std::ostream& strm);
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -52,4 +52,3 @@ typedef boost::shared_ptr<ErrorInfo> SErrorInfo;
|
||||
|
||||
} // namespace joblist
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -790,4 +790,3 @@ const string ExpressionStep::toString() const
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -529,4 +529,3 @@ void FIFO<element_t>::totalFileCounts(uint64_t& numFiles, uint64_t& numBytes) co
|
||||
|
||||
} // namespace joblist
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -373,7 +373,15 @@ void GroupConcatAgUM::applyMapping(const boost::shared_array<int>& mapping, cons
|
||||
}
|
||||
else
|
||||
{
|
||||
fRow.setIntField(row.getIntField(mapping[i]), i);
|
||||
if (fRow.getColTypes()[i] == execplan::CalpontSystemCatalog::CHAR ||
|
||||
fRow.getColTypes()[i] == execplan::CalpontSystemCatalog::VARCHAR)
|
||||
{
|
||||
fRow.setIntField(row.getUintField(mapping[i]), i);
|
||||
}
|
||||
else
|
||||
{
|
||||
fRow.setIntField(row.getIntField(mapping[i]), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1050,4 +1058,3 @@ const string GroupConcatNoOrder::toString() const
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -127,7 +127,7 @@ class GroupConcator
|
||||
int64_t fGroupConcatLen;
|
||||
int64_t fConstantLen;
|
||||
boost::scoped_array<uint8_t> fOutputString;
|
||||
std::string fTimeZone;
|
||||
long fTimeZone;
|
||||
};
|
||||
|
||||
// For GROUP_CONCAT withour distinct or orderby
|
||||
|
@ -822,4 +822,3 @@ bool compatibleColumnTypes(const CalpontSystemCatalog::ColDataType& dt1, uint32_
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -185,14 +185,8 @@ struct JobInfo
|
||||
, maxElems(rm->getHjMaxElems())
|
||||
, flushInterval(rm->getJLFlushInterval())
|
||||
, fifoSize(rm->getJlFifoSize())
|
||||
, fifoSizeLargeSideHj(rm->getHjFifoSizeLargeSide())
|
||||
, scanLbidReqLimit(rm->getJlScanLbidReqLimit())
|
||||
, scanLbidReqThreshold(rm->getJlScanLbidReqThreshold())
|
||||
, tempSaveSize(rm->getScTempSaveSize())
|
||||
, logger(new Logger())
|
||||
, traceFlags(0)
|
||||
, tupleDLMaxSize(rm->getTwMaxSize())
|
||||
, tupleMaxBuckets(rm->getTwMaxBuckets())
|
||||
, projectingTableOID(0)
|
||||
, isExeMgr(false)
|
||||
, trace(false)
|
||||
@ -226,18 +220,8 @@ struct JobInfo
|
||||
JobStepVectorStack stack;
|
||||
uint32_t flushInterval;
|
||||
uint32_t fifoSize;
|
||||
uint32_t fifoSizeLargeSideHj;
|
||||
//...joblist does not use scanLbidReqLimit and SdanLbidReqThreshold.
|
||||
//...They are actually used by pcolscan and pdictionaryscan, but
|
||||
//...we have joblist get and report the values here since they
|
||||
//...are global to the job.
|
||||
uint32_t scanLbidReqLimit;
|
||||
uint32_t scanLbidReqThreshold;
|
||||
uint32_t tempSaveSize;
|
||||
SPJL logger;
|
||||
uint32_t traceFlags;
|
||||
uint64_t tupleDLMaxSize;
|
||||
uint32_t tupleMaxBuckets;
|
||||
SErrorInfo errorInfo;
|
||||
execplan::CalpontSystemCatalog::OID* projectingTableOID; // DeliveryWSDLs get a reference to this
|
||||
bool isExeMgr;
|
||||
@ -372,7 +356,7 @@ struct JobInfo
|
||||
int64_t largeSideLimit;
|
||||
uint64_t partitionSize;
|
||||
bool isDML;
|
||||
std::string timeZone;
|
||||
long timeZone;
|
||||
|
||||
// This is for tracking any dynamically allocated ParseTree objects
|
||||
// in simpleScalarFilterToParseTree() for later deletion in
|
||||
|
@ -132,7 +132,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo);
|
||||
/* This looks like an inefficient way to get NULL values. Much easier ways
|
||||
to do it. */
|
||||
template <typename T>
|
||||
void valueNullNum(const CalpontSystemCatalog::ColType& ct, const string& timeZone, T& val)
|
||||
void valueNullNum(const CalpontSystemCatalog::ColType& ct, const long timeZone, T& val)
|
||||
{
|
||||
T& n = val;
|
||||
bool pushWarning = false;
|
||||
@ -274,7 +274,7 @@ void valueNullNum(const CalpontSystemCatalog::ColType& ct, const string& timeZon
|
||||
|
||||
template <typename T>
|
||||
void convertValueNum(const string& str, const CalpontSystemCatalog::ColType& ct, bool isNull, uint8_t& rf,
|
||||
const string& timeZone, T& v)
|
||||
const long timeZone, T& v)
|
||||
{
|
||||
if (str.size() == 0 || isNull)
|
||||
{
|
||||
@ -3446,7 +3446,6 @@ void JLF_ExecPlanToJobList::addJobSteps(JobStepVector& nsv, JobInfo& jobInfo, bo
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
|
@ -418,7 +418,6 @@ ostream& writeDotCmds(ostream& dotFile, const JobStepVector& query, const JobSte
|
||||
|
||||
} // end namespace jlf_graphics
|
||||
|
||||
// vim:ts=4 sw=4 syntax=cpp:
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
|
@ -64,7 +64,7 @@ using namespace joblist;
|
||||
|
||||
namespace
|
||||
{
|
||||
void getColumnValue(ConstantColumn** cc, uint64_t i, const Row& row, const string& timeZone)
|
||||
void getColumnValue(ConstantColumn** cc, uint64_t i, const Row& row, const long timeZone)
|
||||
{
|
||||
ostringstream oss;
|
||||
int64_t data = 0;
|
||||
@ -875,4 +875,3 @@ SJSTEP doUnionSub(CalpontExecutionPlan* ep, JobInfo& jobInfo)
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
@ -1140,9 +1140,10 @@ bool combineJobStepsByTable(TableInfoMap::iterator& mit, JobInfo& jobInfo)
|
||||
|
||||
for (unsigned i = 0; i < numOfStepsAddToBps; i++)
|
||||
{
|
||||
bps->setBPP((it + i)->get());
|
||||
auto pp = (it + i)->get();
|
||||
bps->setBPP(pp);
|
||||
bps->setStepCount();
|
||||
bps->setLastTupleId((it + i)->get()->tupleId());
|
||||
bps->setLastTupleId(pp->tupleId());
|
||||
}
|
||||
|
||||
it += itInc;
|
||||
@ -4559,7 +4560,6 @@ SJSTEP unionQueries(JobStepVector& queries, uint64_t distinctUnionNum, JobInfo&
|
||||
}
|
||||
|
||||
} // namespace joblist
|
||||
// vim:ts=4 sw=4:
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
|
@ -1233,4 +1233,3 @@ void TupleJobList::abort()
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
// vim:ts=4 sw=4:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user