From 688b47d4e738d57c54f2c12087604e0cb1347911 Mon Sep 17 00:00:00 2001 From: Roman Nozdrin Date: Thu, 23 Mar 2023 17:55:39 +0000 Subject: [PATCH 1/6] MCOL-5451 This resolves external GROUP BY result inconsistency issues Given that idx is a RH hashmap bucket number and info is intra-bucket idx the root cause is triggered by the difference of idx/hash pair calculation for a certain GROUP BY generation and for generation aggregations merging that takes place in RowAggStorage::finalize. This patch generalizes rowHashToIdx to leverage it in both cases mentioned above. --- utils/rowgroup/rowstorage.cpp | 55 +++++++++++++---------------------- utils/rowgroup/rowstorage.h | 43 ++++++++------------------- 2 files changed, 33 insertions(+), 65 deletions(-) diff --git a/utils/rowgroup/rowstorage.cpp b/utils/rowgroup/rowstorage.cpp index 4690f6cf5..5d997a6dc 100644 --- a/utils/rowgroup/rowstorage.cpp +++ b/utils/rowgroup/rowstorage.cpp @@ -1556,8 +1556,8 @@ bool RowAggStorage::getTargetRow(const Row& row, uint64_t hash, Row& rowOut) if (fExtKeys) { fRealKeysStorage.reset(new RowGroupStorage(fTmpDir, fKeysRowGroup, fMaxRows, fMM->getResourceManaged(), - fMM->getSessionLimit(), !fEnabledDiskAggregation, - !fEnabledDiskAggregation, fCompressor.get())); + fMM->getSessionLimit(), !fEnabledDiskAggregation, + !fEnabledDiskAggregation, fCompressor.get())); fKeysStorage = fRealKeysStorage.get(); } else @@ -1571,10 +1571,8 @@ bool RowAggStorage::getTargetRow(const Row& row, uint64_t hash, Row& rowOut) { increaseSize(); } - size_t idx{}; - uint32_t info{}; + auto [info, idx] = rowHashToIdx(hash); - rowHashToIdx(hash, info, idx); nextWhileLess(info, idx); while (info == fCurData->fInfo[idx]) @@ -1604,9 +1602,8 @@ bool RowAggStorage::getTargetRow(const Row& row, uint64_t hash, Row& rowOut) do { auto* genData = fGens[gen].get(); - size_t gidx{}; - uint32_t ginfo{}; - rowHashToIdx(hash, ginfo, gidx, genData); + auto [ginfo, gidx] = rowHashToIdx(hash, genData->fMask, genData->hashMultiplier_, genData->fInfoInc, + genData->fInfoHashShift); nextWhileLess(ginfo, gidx, genData); while (ginfo == genData->fInfo[gidx]) @@ -1694,9 +1691,7 @@ void RowAggStorage::dump() { startNewGeneration(); } - else if (fAllowGenerations && - freeMem < totalMem / 10 * 3 && - fRandDistr(fRandGen) < 30) + else if (fAllowGenerations && freeMem < totalMem / 10 * 3 && fRandDistr(fRandGen) < 30) { startNewGeneration(); } @@ -1786,18 +1781,6 @@ void RowAggStorage::shiftUp(size_t startIdx, size_t insIdx) fCurData->fHashes->shiftUp(startIdx, insIdx); } -void RowAggStorage::rowToIdx(const Row& row, uint32_t& info, size_t& idx, uint64_t& hash, - const Data* curData) const -{ - hash = hashRow(row, fLastKeyCol); - return rowHashToIdx(hash, info, idx, curData); -} - -void RowAggStorage::rowToIdx(const Row& row, uint32_t& info, size_t& idx, uint64_t& hash) const -{ - return rowToIdx(row, info, idx, hash, fCurData); -} - void RowAggStorage::increaseSize() { if (fCurData->fMask == 0) @@ -1828,7 +1811,9 @@ void RowAggStorage::increaseSize() // we have to resize, even though there would still be plenty of space left! // Try to rehash instead. Delete freed memory so we don't steadyily increase mem in case // we have to rehash a few times - nextHashMultiplier(); + // adding an *even* number, so that the multiplier will always stay odd. This is necessary + // so that the hash stays a mixing function (and thus doesn't have any information loss). + fCurData->hashMultiplier_ += 0xc4ceb9fe1a85ec54; rehashPowerOfTwo(fCurData->fMask + 1); } else @@ -1898,10 +1883,8 @@ void RowAggStorage::insertSwap(size_t oldIdx, RowPosHashStorage* oldHashes) logging::ERR_DISKAGG_OVERFLOW1); } - size_t idx{}; - uint32_t info{}; auto pos = oldHashes->get(oldIdx); - rowHashToIdx(pos.hash, info, idx); + auto [info, idx] = rowHashToIdx(pos.hash); while (info <= fCurData->fInfo[idx]) { @@ -2023,6 +2006,7 @@ void RowAggStorage::dumpInternalData() const bs << fCurData->fSize; bs << fCurData->fMask; bs << fCurData->fMaxSize; + bs << fCurData->hashMultiplier_; bs << fCurData->fInfoInc; bs << fCurData->fInfoHashShift; bs.append(fCurData->fInfo.get(), calcBytes(calcSizeWithBuffer(fCurData->fMask + 1, fCurData->fMaxSize))); @@ -2090,6 +2074,7 @@ void RowAggStorage::finalize(std::function mergeFunc, Row& rowOut) size_t prevSize; size_t prevMask; size_t prevMaxSize; + size_t prevHashMultiplier; uint32_t prevInfoInc; uint32_t prevInfoHashShift; std::unique_ptr prevInfo; @@ -2111,7 +2096,8 @@ void RowAggStorage::finalize(std::function mergeFunc, Row& rowOut) else prevKeyRowStorage = prevRowStorage.get(); - loadGeneration(prevGen, prevSize, prevMask, prevMaxSize, prevInfoInc, prevInfoHashShift, prevInfo); + loadGeneration(prevGen, prevSize, prevMask, prevMaxSize, prevHashMultiplier, prevInfoInc, + prevInfoHashShift, prevInfo); prevHashes = fCurData->fHashes->clone(prevMask + 1, prevGen, true); // iterate over current generation rows @@ -2128,7 +2114,6 @@ void RowAggStorage::finalize(std::function mergeFunc, Row& rowOut) } const auto& pos = fCurData->fHashes->get(idx); - if (fKeysStorage->isFinalized(pos.idx)) { // this row was already merged into newer generation, skip it @@ -2136,8 +2121,9 @@ void RowAggStorage::finalize(std::function mergeFunc, Row& rowOut) } // now try to find row in the previous generation - uint32_t pinfo = prevInfoInc + static_cast((pos.hash & INFO_MASK) >> prevInfoHashShift); - uint64_t pidx = (pos.hash >> INIT_INFO_BITS) & prevMask; + auto [pinfo, pidx] = + rowHashToIdx(pos.hash, prevMask, prevHashMultiplier, prevInfoInc, prevInfoHashShift); + while (pinfo < prevInfo[pidx]) { ++pidx; @@ -2276,12 +2262,12 @@ void RowAggStorage::finalize(std::function mergeFunc, Row& rowOut) void RowAggStorage::loadGeneration(uint16_t gen) { - loadGeneration(gen, fCurData->fSize, fCurData->fMask, fCurData->fMaxSize, fCurData->fInfoInc, - fCurData->fInfoHashShift, fCurData->fInfo); + loadGeneration(gen, fCurData->fSize, fCurData->fMask, fCurData->fMaxSize, fCurData->hashMultiplier_, + fCurData->fInfoInc, fCurData->fInfoHashShift, fCurData->fInfo); } void RowAggStorage::loadGeneration(uint16_t gen, size_t& size, size_t& mask, size_t& maxSize, - uint32_t& infoInc, uint32_t& infoHashShift, + size_t& hashMultiplier, uint32_t& infoInc, uint32_t& infoHashShift, std::unique_ptr& info) { messageqcpp::ByteStream bs; @@ -2312,6 +2298,7 @@ void RowAggStorage::loadGeneration(uint16_t gen, size_t& size, size_t& mask, siz bs >> size; bs >> mask; bs >> maxSize; + bs >> hashMultiplier; bs >> infoInc; bs >> infoHashShift; size_t infoSz = calcBytes(calcSizeWithBuffer(mask + 1, maxSize)); diff --git a/utils/rowgroup/rowstorage.h b/utils/rowgroup/rowstorage.h index 7277d7872..8b230cf1c 100644 --- a/utils/rowgroup/rowstorage.h +++ b/utils/rowgroup/rowstorage.h @@ -147,34 +147,22 @@ class RowAggStorage */ void shiftUp(size_t startIdx, size_t insIdx); - /** @brief Find best position of row and save it's hash. - * - * @param row(in) input row - * @param info(out) info data - * @param idx(out) index computed from row hash - * @param hash(out) row hash value - */ - void rowToIdx(const Row& row, uint32_t& info, size_t& idx, uint64_t& hash) const; - void rowToIdx(const Row& row, uint32_t& info, size_t& idx, uint64_t& hash, const Data* curData) const; - - /** @brief Find best position using precomputed hash - * - * @param h(in) row hash - * @param info(out) info data - * @param idx(out) index - */ - inline void rowHashToIdx(uint64_t h, uint32_t& info, size_t& idx, const Data* curData) const + using InfoIdxType = std::pair; + inline InfoIdxType rowHashToIdx(uint64_t h, const size_t mask, const uint64_t hashMultiplier, + const uint32_t infoInc, const uint32_t infoHashShift) const { // An addition from the original robin hood HM. - h *= fCurData->hashMultiplier_; + h *= hashMultiplier; h ^= h >> 33U; - info = curData->fInfoInc + static_cast((h & INFO_MASK) >> curData->fInfoHashShift); - idx = (h >> INIT_INFO_BITS) & curData->fMask; + uint32_t info = infoInc + static_cast((h & INFO_MASK) >> infoHashShift); + size_t idx = (h >> INIT_INFO_BITS) & mask; + return {info, idx}; } - inline void rowHashToIdx(uint64_t h, uint32_t& info, size_t& idx) const + inline InfoIdxType rowHashToIdx(uint64_t h) const { - return rowHashToIdx(h, info, idx, fCurData); + return rowHashToIdx(h, fCurData->fMask, fCurData->hashMultiplier_, fCurData->fInfoInc, + fCurData->fInfoHashShift); } /** @brief Iterate over internal info until info with less-or-equal distance @@ -237,13 +225,6 @@ class RowAggStorage info = fCurData->fInfo[idx]; } - void nextHashMultiplier() - { - // adding an *even* number, so that the multiplier will always stay odd. This is necessary - // so that the hash stays a mixing function (and thus doesn't have any information loss). - fCurData->hashMultiplier_ += 0xc4ceb9fe1a85ec54; - } - /** @brief Increase internal data size if needed */ void increaseSize(); @@ -310,8 +291,8 @@ class RowAggStorage */ void loadGeneration(uint16_t gen); /** @brief Load previously dumped data into the tmp storage */ - void loadGeneration(uint16_t gen, size_t& size, size_t& mask, size_t& maxSize, uint32_t& infoInc, - uint32_t& infoHashShift, std::unique_ptr& info); + void loadGeneration(uint16_t gen, size_t& size, size_t& mask, size_t& maxSize, size_t& hashMultiplier, + uint32_t& infoInc, uint32_t& infoHashShift, std::unique_ptr& info); /** @brief Remove temporary data files */ void cleanup(); From ed24f3ebec6d3954b682f68a382c25ae74cf2809 Mon Sep 17 00:00:00 2001 From: HanpyBin <975189452@qq.com> Date: Tue, 28 Mar 2023 15:04:13 +0800 Subject: [PATCH 2/6] fix dependency error --- build/bootstrap_mcs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bootstrap_mcs.sh b/build/bootstrap_mcs.sh index fcdb3d4b9..5f12f1927 100755 --- a/build/bootstrap_mcs.sh +++ b/build/bootstrap_mcs.sh @@ -96,7 +96,7 @@ install_deps() yum -y install epel-release \ && 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 \ - && yum -y install jemalloc-devel libcurl-devel gtest-devel cppunit-devel systemd-devel install lzo-devel xz-devel lz4-devel bzip2-devel \ + && yum -y install jemalloc-devel libcurl-devel gtest-devel cppunit-devel systemd-devel lzo-devel xz-devel lz4-devel bzip2-devel \ && yum -y install pcre2-devel fi } From b53c231ca64c2afc0816654a14f068f3b584e2b0 Mon Sep 17 00:00:00 2001 From: Sergey Zefirov Date: Thu, 30 Mar 2023 17:26:45 +0100 Subject: [PATCH 3/6] MCOL-271 empty strings should not be NULLs (#2794) This patch improves handling of NULLs in textual fields in ColumnStore. Previously empty strings were considered NULLs and it could be a problem if data scheme allows for empty strings. It was also one of major reasons of behavior difference between ColumnStore and other engines in MariaDB family. Also, this patch fixes some other bugs and incorrect behavior, for example, incorrect comparison for "column <= ''" which evaluates to constant True for all purposes before this patch. --- .drone.jsonnet | 13 +- datatypes/mcs_datatype.cpp | 10 + datatypes/mcs_datatype.h | 2 + datatypes/mcs_decimal.cpp | 35 +- datatypes/mcs_decimal.h | 2 + dbcon/dmlpackage/calpontdmlpackage.cpp | 1 + dbcon/dmlpackage/commanddmlpackage.cpp | 1 + dbcon/dmlpackage/dmlcolumn.cpp | 45 +- dbcon/dmlpackage/dmlcolumn.h | 34 +- dbcon/dmlpackage/dmlpkg.h | 3 +- dbcon/dmlpackage/insertdmlpackage.cpp | 15 +- dbcon/dmlpackage/row.cpp | 2 +- dbcon/dmlpackage/updatedmlpackage.cpp | 11 +- dbcon/dmlpackage/vendordmlstatement.h | 7 +- dbcon/execplan/aggregatecolumn.cpp | 11 +- dbcon/execplan/aggregatecolumn.h | 8 +- dbcon/execplan/arithmeticcolumn.h | 2 +- dbcon/execplan/arithmeticoperator.h | 8 +- dbcon/execplan/calpontsystemcatalog.cpp | 65 +- dbcon/execplan/calpontsystemcatalog.h | 15 +- dbcon/execplan/columnresult.h | 16 +- dbcon/execplan/constantcolumn.cpp | 32 +- dbcon/execplan/constantcolumn.h | 39 +- dbcon/execplan/functioncolumn.h | 9 +- dbcon/execplan/operator.h | 3 +- dbcon/execplan/parsetree.h | 2 +- dbcon/execplan/predicateoperator.cpp | 16 +- dbcon/execplan/simplecolumn.cpp | 2 +- dbcon/execplan/simplecolumn.h | 11 +- dbcon/execplan/simplecolumn_decimal.h | 22 +- dbcon/execplan/simplecolumn_int.h | 9 +- dbcon/execplan/simplecolumn_uint.h | 9 +- dbcon/execplan/simplefilter.cpp | 56 +- dbcon/execplan/treenode.h | 125 +- dbcon/execplan/windowfunctioncolumn.cpp | 13 +- dbcon/execplan/windowfunctioncolumn.h | 9 +- dbcon/joblist/crossenginestep.cpp | 27 +- dbcon/joblist/elementcompression.h | 34 +- dbcon/joblist/elementtype.cpp | 57 + dbcon/joblist/elementtype.h | 6 +- dbcon/joblist/groupconcat.cpp | 43 +- dbcon/joblist/groupconcat.h | 7 +- dbcon/joblist/jlf_execplantojoblist.cpp | 52 +- dbcon/joblist/jlf_subquery.cpp | 5 +- dbcon/joblist/jsonarrayagg.cpp | 19 +- dbcon/joblist/largehashjoin.cpp | 1147 ---- dbcon/joblist/primitivemsg.h | 10 + dbcon/joblist/tablecolumn.cpp | 4 +- dbcon/joblist/tablecolumn.h | 7 +- dbcon/joblist/tdriver-agg.cpp | 1 - dbcon/joblist/tdriver-hashjoin.cpp | 1 - dbcon/joblist/tupleaggregatestep.cpp | 10 +- dbcon/joblist/tupleconstantstep.cpp | 4 +- dbcon/joblist/tupleunion.cpp | 41 +- dbcon/mysql/ha_mcs_datatype.h | 5 + dbcon/mysql/ha_mcs_dml.cpp | 22 +- dbcon/mysql/ha_mcs_execplan.cpp | 31 +- dbcon/mysql/ha_mcs_impl.cpp | 8 +- dbcon/mysql/ha_mcs_impl_if.h | 6 +- dbcon/mysql/is_columnstore_columns.cpp | 4 +- ...4156_function_CNX_MID_SM_KnownIssue.result | 48 +- ...unction_CNX_SUBSTRING_SM_KnownIssue.result | 244 +- ...1_function_CNX_SUBSTR_SM_KnownIssue.result | 244 +- ...81_function_CNXPP_MID_SM_KnownIssue.result | 48 +- ...ction_CNXPP_SUBSTRING_SM_KnownIssue.result | 244 +- ...function_CNXPP_SUBSTR_SM_KnownIssue.result | 244 +- .../r/mcs6794_function_CNX_MID_SM.result | 2 +- .../mcs6813_function_CNX_SUBSTRING_SM.result | 8 +- .../r/mcs6814_function_CNX_SUBSTR_SM.result | 8 +- .../r/mcs6866_function_CNXPP_MID_SM.result | 2 +- ...mcs6885_function_CNXPP_SUBSTRING_SM.result | 8 +- .../r/mcs6886_function_CNXPP_SUBSTR_SM.result | 8 +- .../basic/r/func_json_contains.result | 2 +- .../basic/r/func_json_quote.result | 4 +- .../basic/r/func_jsonarrayagg.result | 8 +- .../r/mcol271-empty-string-is-not-null.result | 77 + .../basic/r/mcs115_count_distinct.result | 2 +- .../r/mcs123_window_function_cume_dist.result | 2 +- .../mcs124_window_function_dense_rank.result | 2 +- .../mcs125_window_function_first_value.result | 2 +- .../basic/r/mcs126_window_function_lag.result | 2 +- .../mcs127_window_function_last_value.result | 2 +- .../r/mcs128_window_function_lead.result | 2 +- .../r/mcs129_window_function_nth_value.result | 2 +- .../r/mcs130_window_function_ntile.result | 2 +- ...mcs131_window_function_percent_rank.result | 2 +- ...132_window_function_percentile_cont.result | 2 +- ...133_window_function_percentile_disc.result | 2 +- .../r/mcs134_window_function_rank.result | 2 +- .../mcs135_window_function_row_number.result | 2 +- .../basic/r/mcs136_window_function_sum.result | 2 +- .../r/mcs137_window_function_count.result | 2 +- .../basic/r/mcs138_window_function_max.result | 2 +- .../basic/r/mcs139_window_function_min.result | 2 +- .../r/mcs140_window_function_median.result | 2 +- .../basic/r/mcs141_window_function_std.result | 2 +- .../r/mcs142_window_function_stddev.result | 2 +- .../mcs143_window_function_stddev_pop.result | 2 +- .../mcs144_window_function_stddev_samp.result | 2 +- .../r/mcs145_window_function_variance.result | 2 +- .../r/mcs146_window_function_var_pop.result | 2 +- .../r/mcs147_window_function_var_samp.result | 2 +- .../r/mcs148_window_function_bit_or.result | 2 +- .../r/mcs149_window_function_bit_and.result | 2 +- .../r/mcs150_window_function_bit_xor.result | 2 +- .../basic/r/mcs151_window_function_avg.result | 2 +- .../basic/r/mcs152_win_frame_avg.result | 2 +- .../basic/r/mcs153_win_frame_bit_and.result | 2 +- .../basic/r/mcs154_win_frame_bit_or.result | 2 +- .../basic/r/mcs155_win_frame_bit_xor.result | 2 +- .../basic/r/mcs156_win_frame_count.result | 2 +- .../basic/r/mcs157_win_frame_lead.result | 2 +- .../basic/r/mcs158_win_frame_max.result | 40 +- .../basic/r/mcs159_win_frame_min.result | 40 +- .../basic/r/mcs160_win_frame_ntile.result | 2 +- .../basic/r/mcs161_win_frame_std.result | 2 +- .../basic/r/mcs162_win_frame_stddev.result | 2 +- .../r/mcs163_win_frame_stddev_pop.result | 2 +- .../r/mcs164_win_frame_stddev_samp.result | 2 +- .../basic/r/mcs165_win_frame_sum.result | 2 +- .../basic/r/mcs166_win_frame_var_pop.result | 2 +- .../basic/r/mcs167_win_frame_var_samp.result | 2 +- .../basic/r/mcs168_win_frame_variance.result | 2 +- .../basic/r/mcs169_bin_functions.result | 2 +- .../basic/r/mcs171_null_functions.result | 2 +- .../basic/r/mcs173_coalesce_function.result | 2 +- .../basic/r/mcs174_case_function.result | 2 +- .../basic/r/mcs176_if_function.result | 2 +- .../basic/r/mcs180_ascii_function.result | 2 +- .../r/mcs182_char_length_function.result | 2 +- .../basic/r/mcs188_avg_function.result | 2 +- .../basic/r/mcs189_sum_function.result | 2 +- .../basic/r/mcs190_max_function.result | 2 +- .../basic/r/mcs191_min_function.result | 2 +- .../basic/r/mcs192_corr_function.result | 2 +- .../basic/r/mcs193_covar_pop_function.result | 2 +- .../basic/r/mcs194_covar_samp_function.result | 2 +- .../r/mcs195_regr_avgx_avgy_function.result | 2 +- .../mcs196_regr_sxx_sxy_syy_functions.result | 2 +- .../basic/r/mcs197_regr_count_function.result | 2 +- .../r/mcs198_regr_intercept_function.result | 4 +- .../basic/r/mcs199_regr_r2_function.result | 2 +- .../basic/r/mcs200_regr_slope_function.result | 4 +- .../basic/r/mcs205_inet_aton_function.result | 2 +- .../basic/r/mcs206_inet_ntoa_function.result | 2 +- .../basic/r/mcs218_md5_function.result | 2 +- .../basic/r/mcs219_mid_function.result | 18 +- .../mcs21_insert_all_charset_collation.result | 10 +- .../basic/r/mcs222_position_function.result | 2 +- .../basic/r/mcs224_repeat_function.result | 2 +- .../basic/r/mcs225_replace_function.result | 2 +- .../basic/r/mcs22_insert_ignore.result | 16 +- .../basic/r/mcs259_instr_function.result | 2 +- .../basic/r/mcs260_space_function.result | 10 +- .../r/mcs271_substring_index_function.result | 2 +- .../basic/r/mcs285_right_function.result | 8 +- .../basic/r/mcs286_left_function.result | 8 +- .../basic/r/mcs37_select_distinct.result | 2 +- .../r/mcs44_select_crossengine_join.result | 6 +- .../r/mcs45_write_crossengine_join.result | 4 +- .../basic/r/mcs57_autoincrement.result | 2 +- .../basic/r/mcs63_crossengine_views.result | 10 +- .../basic/r/mcs65_crossengine_order_by.result | 4 +- .../basic/r/mcs69_cast_data_types.result | 2 +- .../basic/r/mcs74_check_constraint.result | 4 +- .../basic/r/mcs77_where_conditions.result | 2 +- .../columnstore/basic/r/mcs78_aliases.result | 2 +- .../columnstore/basic/r/mcs79_exists.result | 10 +- .../basic/r/mcs81_self_join.result | 2 +- .../basic/r/mcs82_update_join.result | 8 +- .../basic/r/mcs83_delete_join.result | 12 +- .../basic/r/mcs90_aggregate_functions.result | 2 +- .../basic/r/mcs91_comparison_functions.result | 15 +- .../basic/r/mcs93_string_functions.result | 42 +- .../basic/r/mcs95_variance_functions.result | 2 +- .../r/mcs96_std_deviation_functions.result | 8 +- .../basic/r/mcs97_group_concat.result | 2 +- .../columnstore/basic/r/regr-fe-conv.result | 527 ++ .../columnstore/basic/r/regr-fe-substr.result | 2749 +++++++++ .../basic/r/regr-fe-substring.result | 5041 +++++++++++++++++ .../columnstore/basic/r/type_string.result | 1 + mysql-test/columnstore/basic/suite.pm | 9 + .../t/mcol271-empty-string-is-not-null.test | 64 + .../t/mcs123_window_function_cume_dist.test | 2 +- .../t/mcs124_window_function_dense_rank.test | 2 +- .../t/mcs125_window_function_first_value.test | 2 +- .../basic/t/mcs126_window_function_lag.test | 2 +- .../t/mcs127_window_function_last_value.test | 2 +- .../basic/t/mcs128_window_function_lead.test | 2 +- .../t/mcs129_window_function_nth_value.test | 2 +- .../basic/t/mcs130_window_function_ntile.test | 2 +- .../mcs131_window_function_percent_rank.test | 2 +- ...cs132_window_function_percentile_cont.test | 2 +- ...cs133_window_function_percentile_disc.test | 2 +- .../basic/t/mcs134_window_function_rank.test | 2 +- .../t/mcs135_window_function_row_number.test | 2 +- .../basic/t/mcs136_window_function_sum.test | 2 +- .../basic/t/mcs137_window_function_count.test | 2 +- .../basic/t/mcs138_window_function_max.test | 2 +- .../basic/t/mcs139_window_function_min.test | 2 +- .../t/mcs140_window_function_median.test | 2 +- .../basic/t/mcs141_window_function_std.test | 2 +- .../t/mcs142_window_function_stddev.test | 2 +- .../t/mcs143_window_function_stddev_pop.test | 2 +- .../t/mcs144_window_function_stddev_samp.test | 2 +- .../t/mcs145_window_function_variance.test | 2 +- .../t/mcs146_window_function_var_pop.test | 2 +- .../t/mcs147_window_function_var_samp.test | 2 +- .../t/mcs148_window_function_bit_or.test | 2 +- .../t/mcs149_window_function_bit_and.test | 2 +- .../t/mcs150_window_function_bit_xor.test | 2 +- .../basic/t/mcs151_window_function_avg.test | 2 +- .../basic/t/mcs152_win_frame_avg.test | 2 +- .../basic/t/mcs153_win_frame_bit_and.test | 2 +- .../basic/t/mcs154_win_frame_bit_or.test | 2 +- .../basic/t/mcs155_win_frame_bit_xor.test | 2 +- .../basic/t/mcs156_win_frame_count.test | 2 +- .../basic/t/mcs157_win_frame_lead.test | 2 +- .../basic/t/mcs160_win_frame_ntile.test | 2 +- .../basic/t/mcs161_win_frame_std.test | 2 +- .../basic/t/mcs162_win_frame_stddev.test | 2 +- .../basic/t/mcs163_win_frame_stddev_pop.test | 2 +- .../basic/t/mcs164_win_frame_stddev_samp.test | 2 +- .../basic/t/mcs165_win_frame_sum.test | 2 +- .../basic/t/mcs166_win_frame_var_pop.test | 2 +- .../basic/t/mcs167_win_frame_var_samp.test | 2 +- .../basic/t/mcs168_win_frame_variance.test | 2 +- .../basic/t/mcs169_bin_functions.test | 2 +- .../basic/t/mcs171_null_functions.test | 2 +- .../basic/t/mcs173_coalesce_function.test | 2 +- .../basic/t/mcs174_case_function.test | 2 +- .../basic/t/mcs176_if_function.test | 2 +- .../basic/t/mcs180_ascii_function.test | 2 +- .../basic/t/mcs182_char_length_function.test | 2 +- .../basic/t/mcs188_avg_function.test | 2 +- .../basic/t/mcs189_sum_function.test | 2 +- .../basic/t/mcs190_max_function.test | 2 +- .../basic/t/mcs191_min_function.test | 2 +- .../basic/t/mcs192_corr_function.test | 2 +- .../basic/t/mcs193_covar_pop_function.test | 2 +- .../basic/t/mcs194_covar_samp_function.test | 2 +- .../t/mcs195_regr_avgx_avgy_function.test | 2 +- .../t/mcs196_regr_sxx_sxy_syy_functions.test | 2 +- .../basic/t/mcs197_regr_count_function.test | 2 +- .../basic/t/mcs199_regr_r2_function.test | 2 +- .../basic/t/mcs205_inet_aton_function.test | 2 +- .../basic/t/mcs206_inet_ntoa_function.test | 2 +- .../basic/t/mcs218_md5_function.test | 2 +- .../basic/t/mcs219_mid_function.test | 2 +- .../basic/t/mcs222_position_function.test | 2 +- .../basic/t/mcs224_repeat_function.test | 2 +- .../basic/t/mcs225_replace_function.test | 2 +- .../basic/t/mcs22_insert_ignore.test | 12 +- .../basic/t/mcs259_instr_function.test | 2 +- .../basic/t/mcs285_right_function.test | 2 +- .../basic/t/mcs286_left_function.test | 2 +- .../basic/t/mcs37_select_distinct.test | 2 +- .../basic/t/mcs65_crossengine_order_by.test | 4 +- .../basic/t/mcs69_cast_data_types.test | 2 +- .../basic/t/mcs74_check_constraint.test | 2 +- .../basic/t/mcs77_where_conditions.test | 2 +- .../columnstore/basic/t/mcs78_aliases.test | 2 +- .../columnstore/basic/t/mcs79_exists.test | 4 +- .../columnstore/basic/t/mcs81_self_join.test | 2 +- .../basic/t/mcs82_update_join.test | 4 +- .../basic/t/mcs83_delete_join.test | 4 +- .../basic/t/mcs90_aggregate_functions.test | 2 +- .../basic/t/mcs91_comparison_functions.test | 2 +- .../basic/t/mcs93_string_functions.test | 1 + .../basic/t/mcs95_variance_functions.test | 2 +- .../basic/t/mcs97_group_concat.test | 2 +- .../columnstore/basic/t/regr-fe-conv.test | 32 + .../columnstore/basic/t/regr-fe-substr.test | 226 + .../basic/t/regr-fe-substring.test | 431 ++ .../columnstore/basic/t/type_string.test | 2 + .../columnstore/basic/t/type_uint64.test | 1 - .../basic/t/udf_calshowpartitions.test | 5 + .../oracle/func_trim_oracle.result | 8 +- primitives/linux-port/column.cpp | 79 +- primitives/linux-port/dictionary.cpp | 31 +- .../primproc/batchprimitiveprocessor.cpp | 4 +- primitives/primproc/batchprimitiveprocessor.h | 4 +- primitives/primproc/dictstep.cpp | 36 +- primitives/primproc/dictstep.h | 4 +- primitives/primproc/filtercommand.cpp | 18 +- primitives/primproc/primitiveserver.cpp | 17 +- tests/rowgroup-tests.cpp | 23 +- utils/common/collation.h | 6 +- utils/common/conststring.h | 23 + utils/common/nullstring.h | 217 + utils/dataconvert/dataconvert.cpp | 47 + utils/dataconvert/dataconvert.h | 8 + utils/funcexp/func_add_time.cpp | 28 +- utils/funcexp/func_ascii.cpp | 6 +- utils/funcexp/func_between.cpp | 17 +- utils/funcexp/func_bitwise.cpp | 2 +- utils/funcexp/func_case.cpp | 8 +- utils/funcexp/func_cast.cpp | 36 +- utils/funcexp/func_ceil.cpp | 22 +- utils/funcexp/func_char_length.cpp | 6 +- utils/funcexp/func_coalesce.cpp | 2 +- utils/funcexp/func_concat.cpp | 23 +- utils/funcexp/func_concat_ws.cpp | 11 +- utils/funcexp/func_conv.cpp | 10 +- utils/funcexp/func_convert_tz.cpp | 24 +- utils/funcexp/func_crc32.cpp | 4 +- utils/funcexp/func_date.cpp | 4 +- utils/funcexp/func_date_add.cpp | 6 +- utils/funcexp/func_date_format.cpp | 4 +- utils/funcexp/func_day.cpp | 2 +- utils/funcexp/func_dayname.cpp | 2 +- utils/funcexp/func_dayofweek.cpp | 32 +- utils/funcexp/func_decode.cpp | 8 +- utils/funcexp/func_decode_oracle.cpp | 8 +- utils/funcexp/func_encode.cpp | 8 +- utils/funcexp/func_extract.cpp | 4 +- utils/funcexp/func_find_in_set.cpp | 16 +- utils/funcexp/func_floor.cpp | 20 +- utils/funcexp/func_from_unixtime.cpp | 4 +- utils/funcexp/func_get_format.cpp | 8 +- utils/funcexp/func_greatest.cpp | 10 +- utils/funcexp/func_hex.cpp | 14 +- utils/funcexp/func_if.cpp | 16 +- utils/funcexp/func_ifnull.cpp | 9 +- utils/funcexp/func_in.cpp | 6 +- utils/funcexp/func_inet_aton.cpp | 62 +- utils/funcexp/func_instr.cpp | 12 +- utils/funcexp/func_json_array_append.cpp | 14 +- utils/funcexp/func_json_array_insert.cpp | 12 +- utils/funcexp/func_json_contains.cpp | 4 +- utils/funcexp/func_json_contains_path.cpp | 7 +- utils/funcexp/func_json_depth.cpp | 2 +- utils/funcexp/func_json_equals.cpp | 7 +- utils/funcexp/func_json_exists.cpp | 2 +- utils/funcexp/func_json_extract.cpp | 25 +- utils/funcexp/func_json_format.cpp | 2 +- utils/funcexp/func_json_insert.cpp | 10 +- utils/funcexp/func_json_keys.cpp | 4 +- utils/funcexp/func_json_length.cpp | 2 +- utils/funcexp/func_json_merge.cpp | 8 +- utils/funcexp/func_json_merge_patch.cpp | 49 +- utils/funcexp/func_json_normalize.cpp | 3 +- utils/funcexp/func_json_overlaps.cpp | 4 +- utils/funcexp/func_json_quote.cpp | 5 +- utils/funcexp/func_json_remove.cpp | 13 +- utils/funcexp/func_json_search.cpp | 21 +- utils/funcexp/func_json_type.cpp | 2 +- utils/funcexp/func_json_unquote.cpp | 6 +- utils/funcexp/func_json_valid.cpp | 4 +- utils/funcexp/func_json_value.cpp | 5 +- utils/funcexp/func_lcase.cpp | 4 +- utils/funcexp/func_least.cpp | 8 +- utils/funcexp/func_left.cpp | 10 +- utils/funcexp/func_length.cpp | 7 +- utils/funcexp/func_lpad.cpp | 20 +- utils/funcexp/func_ltrim.cpp | 12 +- utils/funcexp/func_ltrim_oracle.cpp | 18 +- utils/funcexp/func_makedate.cpp | 2 +- utils/funcexp/func_math.cpp | 2 +- utils/funcexp/func_md5.cpp | 8 +- utils/funcexp/func_nullif.cpp | 8 +- utils/funcexp/func_period_diff.cpp | 6 +- utils/funcexp/func_quote.cpp | 7 +- utils/funcexp/func_regexp.cpp | 4 +- utils/funcexp/func_repeat.cpp | 11 +- utils/funcexp/func_replace.cpp | 18 +- utils/funcexp/func_replace_oracle.cpp | 18 +- utils/funcexp/func_right.cpp | 10 +- utils/funcexp/func_rpad.cpp | 18 +- utils/funcexp/func_rtrim.cpp | 12 +- utils/funcexp/func_rtrim_oracle.cpp | 18 +- utils/funcexp/func_sha.cpp | 2 +- utils/funcexp/func_space.cpp | 3 + utils/funcexp/func_str_to_date.cpp | 4 +- utils/funcexp/func_strcmp.cpp | 7 +- utils/funcexp/func_substr.cpp | 8 +- utils/funcexp/func_substring_index.cpp | 10 +- utils/funcexp/func_time_format.cpp | 11 +- utils/funcexp/func_time_to_sec.cpp | 4 +- utils/funcexp/func_timediff.cpp | 12 +- utils/funcexp/func_to_days.cpp | 4 +- utils/funcexp/func_trim.cpp | 12 +- utils/funcexp/func_trim_oracle.cpp | 12 +- utils/funcexp/func_ucase.cpp | 6 +- utils/funcexp/func_unhex.cpp | 6 +- utils/funcexp/funcexp.cpp | 8 +- utils/funcexp/functor.h | 14 + utils/funcexp/functor_json.h | 4 +- utils/funcexp/functor_str.h | 15 +- utils/funcexp/jsonhelpers.cpp | 19 +- utils/funcexp/jsonhelpers.h | 11 +- utils/messageqcpp/bytestream.cpp | 28 + utils/messageqcpp/bytestream.h | 9 + utils/regr/moda.cpp | 17 +- utils/rowgroup/rowaggregation.cpp | 120 +- utils/rowgroup/rowaggregation.h | 21 +- utils/rowgroup/rowgroup.cpp | 335 +- utils/rowgroup/rowgroup.h | 235 +- utils/udfsdk/mcsv1_udaf.cpp | 2 +- utils/windowfunction/wf_count.cpp | 2 +- utils/windowfunction/wf_lead_lag.cpp | 4 +- utils/windowfunction/wf_min_max.cpp | 2 +- utils/windowfunction/wf_nth_value.cpp | 2 +- utils/windowfunction/wf_percentile.cpp | 7 +- utils/windowfunction/wf_udaf.cpp | 25 +- utils/windowfunction/windowfunctiontype.cpp | 18 +- utils/windowfunction/windowfunctiontype.h | 1 + writeengine/bulk/we_bulkloadbuffer.cpp | 4 +- writeengine/dictionary/we_dctnry.cpp | 11 +- writeengine/dictionary/we_dctnry.h | 5 +- writeengine/server/we_ddlcommandproc.cpp | 49 +- writeengine/server/we_dmlcommandproc.cpp | 285 +- writeengine/server/we_dmlcommandproc.h | 3 +- writeengine/shared/we_type.h | 5 +- writeengine/wrapper/writeengine.cpp | 40 +- writeengine/xml/we_xmlgenproc.cpp | 9 +- writeengine/xml/we_xmljob.cpp | 22 +- 417 files changed, 12459 insertions(+), 3520 deletions(-) delete mode 100644 dbcon/joblist/largehashjoin.cpp create mode 100644 mysql-test/columnstore/basic/r/mcol271-empty-string-is-not-null.result create mode 100644 mysql-test/columnstore/basic/r/regr-fe-conv.result create mode 100644 mysql-test/columnstore/basic/r/regr-fe-substr.result create mode 100644 mysql-test/columnstore/basic/r/regr-fe-substring.result create mode 100644 mysql-test/columnstore/basic/t/mcol271-empty-string-is-not-null.test create mode 100644 mysql-test/columnstore/basic/t/regr-fe-conv.test create mode 100644 mysql-test/columnstore/basic/t/regr-fe-substr.test create mode 100644 mysql-test/columnstore/basic/t/regr-fe-substring.test create mode 100644 utils/common/nullstring.h diff --git a/.drone.jsonnet b/.drone.jsonnet index 6ad096d31..27439d2ef 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -320,9 +320,20 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise') image: 'docker:git', volumes: [pipeline._volumes.docker, pipeline._volumes.mdb], environment: { - REGRESSION_REF: '${REGRESSION_REF:-' + regression_ref + '}', + REGRESSION_BRANCH_REF: '${DRONE_SOURCE_BRANCH}', + REGRESSION_REF_AUX: regression_ref, }, commands: [ + // compute branch. + 'echo "$$REGRESSION_REF"', + 'echo "$$REGRESSION_BRANCH_REF"', + // if REGRESSION_REF is empty, try to see whether regression repository has a branch named as one we PR. + 'export REGRESSION_REF=$${REGRESSION_REF:-$$(git ls-remote https://github.com/mariadb-corporation/mariadb-columnstore-regression-test --h --sort origin "refs/heads/$$REGRESSION_BRANCH_REF" | grep -E -o "[^/]+$$")}', + 'echo "$$REGRESSION_REF"', + // REGRESSION_REF can be empty if there is no appropriate branch in regression repository. + // assign what is appropriate by default. + 'export REGRESSION_REF=$${REGRESSION_REF:-$$REGRESSION_REF_AUX}', + 'echo "$$REGRESSION_REF"', // clone regression test repo 'git clone --recurse-submodules --branch $$REGRESSION_REF --depth 1 https://github.com/mariadb-corporation/mariadb-columnstore-regression-test', // where are we now? diff --git a/datatypes/mcs_datatype.cpp b/datatypes/mcs_datatype.cpp index 9dc2864e3..fbc6f5e23 100644 --- a/datatypes/mcs_datatype.cpp +++ b/datatypes/mcs_datatype.cpp @@ -58,6 +58,16 @@ int128_t SystemCatalog::TypeAttributesStd::decimal128FromString(const std::strin return result; } +int128_t SystemCatalog::TypeAttributesStd::decimal128FromString(const utils::NullString& value, + bool* saturate) const +{ + if (value.isNull()) + { + return TSInt128::NullValue; + } + return decimal128FromString(value.unsafeStringRef(), saturate); +} + const string& TypeHandlerSInt8::name() const { static const string xname = "TINYINT"; diff --git a/datatypes/mcs_datatype.h b/datatypes/mcs_datatype.h index fd4050505..498ca43b1 100644 --- a/datatypes/mcs_datatype.h +++ b/datatypes/mcs_datatype.h @@ -26,6 +26,7 @@ #include "mcs_decimal.h" #include "mcs_double.h" #include "mcs_longdouble.h" +#include "nullstring.h" typedef int32_t mcs_sint32_t; @@ -241,6 +242,7 @@ class SystemCatalog @brief Convenience method to get int128 from a std::string. */ int128_t decimal128FromString(const std::string& value, bool* saturate = 0) const; + int128_t decimal128FromString(const utils::NullString& value, bool* saturate = 0) const; /** @brief The method sets the legacy scale and precision of a wide decimal diff --git a/datatypes/mcs_decimal.cpp b/datatypes/mcs_decimal.cpp index a5b74f409..fe5ae5e02 100644 --- a/datatypes/mcs_decimal.cpp +++ b/datatypes/mcs_decimal.cpp @@ -607,26 +607,45 @@ std::string Decimal::toStringTSInt64() const // Dispatcher method for toString() implementations std::string Decimal::toString(bool hasTSInt128) const { - // There must be no empty at this point though - if (isNull()) + utils::NullString result = toNullString(hasTSInt128); + if (result.isNull()) { return std::string("NULL"); } + return result.unsafeStringRef(); +} +utils::NullString Decimal::toNullString(bool hasTSInt128) const +{ + // There must be no empty at this point though + utils::NullString result; + if (isNull()) + { + return result; + } + + std::string v; if (LIKELY(hasTSInt128 || isTSInt128ByPrecision())) { if (scale) { - return toStringTSInt128WithScale(); + v = toStringTSInt128WithScale(); + } + else + { + v = TSInt128::toString(); } - return TSInt128::toString(); } - // TSInt64 Decimal - if (scale) + else if (scale) // TSInt64 Decimal { - return toStringTSInt64(); + v = toStringTSInt64(); } - return std::to_string(value); + else + { + v = std::to_string(value); + } + result.assign(v); + return result; } std::ostream& operator<<(std::ostream& os, const Decimal& dec) diff --git a/datatypes/mcs_decimal.h b/datatypes/mcs_decimal.h index 6acd70605..85907ee21 100644 --- a/datatypes/mcs_decimal.h +++ b/datatypes/mcs_decimal.h @@ -30,6 +30,7 @@ #include "checks.h" #include "branchpred.h" #include "mcs_data_condition.h" +#include "nullstring.h" namespace datatypes { @@ -811,6 +812,7 @@ class Decimal : public TDecimal128, public TDecimal64 // where precision can't detect decimal type properly, e.g. // DECIMAL(10)/DECIMAL(38) std::string toString(bool hasTSInt128 = false) const; + utils::NullString toNullString(bool hasTSInt128 = false) const; friend std::ostream& operator<<(std::ostream& os, const Decimal& dec); int8_t scale; // 0~38 diff --git a/dbcon/dmlpackage/calpontdmlpackage.cpp b/dbcon/dmlpackage/calpontdmlpackage.cpp index 37cd1e486..f00fbac89 100644 --- a/dbcon/dmlpackage/calpontdmlpackage.cpp +++ b/dbcon/dmlpackage/calpontdmlpackage.cpp @@ -22,6 +22,7 @@ ***********************************************************************/ #include "calpontdmlpackage.h" +#include "exceptclasses.h" using namespace std; namespace dmlpackage diff --git a/dbcon/dmlpackage/commanddmlpackage.cpp b/dbcon/dmlpackage/commanddmlpackage.cpp index 16c435008..92d55d6b1 100644 --- a/dbcon/dmlpackage/commanddmlpackage.cpp +++ b/dbcon/dmlpackage/commanddmlpackage.cpp @@ -29,6 +29,7 @@ using namespace std; #define COMMANDDMLPKG_DLLEXPORT #include "commanddmlpackage.h" #undef COMMANDDMLPKG_DLLEXPORT +#include "exceptclasses.h" namespace dmlpackage { CommandDMLPackage::CommandDMLPackage() diff --git a/dbcon/dmlpackage/dmlcolumn.cpp b/dbcon/dmlpackage/dmlcolumn.cpp index 76426ab1d..0a4ee8f2e 100644 --- a/dbcon/dmlpackage/dmlcolumn.cpp +++ b/dbcon/dmlpackage/dmlcolumn.cpp @@ -32,22 +32,17 @@ DMLColumn::DMLColumn() { } -DMLColumn::DMLColumn(std::string name, std::string value, bool isFromCol, uint32_t funcScale, bool isNULL) +DMLColumn::DMLColumn(std::string name, utils::NullString& value, bool isFromCol, + uint32_t funcScale, bool isNULL) { fName = name; - fData = value; - - if ((strcasecmp(value.c_str(), "NULL") == 0) || (value.length() == 0)) - { - isNULL = true; - } - - fisNULL = isNULL; + fColValuesList.push_back(value); + fisNULL = isNULL || value.isNull() || (strcasecmp(value.str(), "NULL") == 0); fIsFromCol = isFromCol; fFuncScale = funcScale; } -DMLColumn::DMLColumn(std::string name, std::vector& valueList, bool isFromCol, +DMLColumn::DMLColumn(std::string name, const std::vector& valueList, bool isFromCol, uint32_t funcScale, bool isNULL) { fName = name; @@ -69,25 +64,17 @@ int DMLColumn::read(messageqcpp::ByteStream& bytestream) uint32_t vectorSize; bytestream >> vectorSize; - if (vectorSize > 0) + for (uint32_t i = 0; i < vectorSize; i++) { - for (uint32_t i = 0; i < vectorSize; i++) - { - std::string dataStr; - bytestream >> dataStr; - // if ( !fisNULL && (dataStr.length() == 0 )) - // dataStr = (char) 0; + utils::NullString dataStr; + bytestream >> dataStr; + // if ( !fisNULL && (dataStr.length() == 0 )) + // dataStr = (char) 0; - fColValuesList.push_back(dataStr); - } + fColValuesList.push_back(dataStr); } - else - bytestream >> fData; // deprecated. - if ((fColValuesList.size() < 1) && (fColValuesList.size() > 0)) // deprecated. - fData = fColValuesList[0]; // deprecated. - // bytestream >> reinterpret_cast(fisNULL); bytestream >> reinterpret_cast(fIsFromCol); bytestream >> (uint32_t&)fFuncScale; return retval; @@ -101,17 +88,11 @@ int DMLColumn::write(messageqcpp::ByteStream& bytestream) uint32_t vectorSize = fColValuesList.size(); bytestream << vectorSize; - if (vectorSize > 0) + for (uint32_t i = 0; i < vectorSize; i++) { - for (uint32_t i = 0; i < vectorSize; i++) - { - bytestream << fColValuesList[i]; - } + bytestream << fColValuesList[i]; } - else - bytestream << fData; // deprecated. - // bytestream << static_cast(fisNULL); bytestream << static_cast(fIsFromCol); bytestream << (uint32_t)fFuncScale; return retval; diff --git a/dbcon/dmlpackage/dmlcolumn.h b/dbcon/dmlpackage/dmlcolumn.h index 236154285..13f2b4718 100644 --- a/dbcon/dmlpackage/dmlcolumn.h +++ b/dbcon/dmlpackage/dmlcolumn.h @@ -28,6 +28,7 @@ #include "dmlobject.h" #include "bytestream.h" #include +#include "nullstring.h" #define EXPORT @@ -43,16 +44,18 @@ class DMLColumn : public DMLObject */ EXPORT DMLColumn(); - /** @brief ctor - */ - - EXPORT DMLColumn(std::string name, std::string value, bool isFromCol = false, uint32_t funcScale = 0, - bool isNULL = false); /** @brief new ctor * isNUll is currently not in use. It supposed to indicate whether each value is null or not. */ - EXPORT DMLColumn(std::string name, std::vector& valueList, bool isFromCol = false, + EXPORT DMLColumn(std::string name, const std::vector& valueList, bool isFromCol = false, + uint32_t funcScale = 0, bool isNULL = false); + + /** @brief new ctor + * + */ + + EXPORT DMLColumn(std::string name, utils::NullString& value, bool isFromCol = false, uint32_t funcScale = 0, bool isNULL = false); /** @brief dtor @@ -73,12 +76,7 @@ class DMLColumn : public DMLObject /** @brief get the data for the column */ - const std::string get_Data() const - { - return fData; - } - - const std::vector& get_DataVector() const + const std::vector& get_DataVector() const { return fColValuesList; } @@ -132,21 +130,11 @@ class DMLColumn : public DMLObject { fFuncScale = funcScale; } - void set_Data(std::string data) - { - fData = data; - } - - void set_DataVector(std::vector& dataVec) - { - fColValuesList = dataVec; - } protected: private: std::string fName; - std::string fData; - std::vector fColValuesList; + std::vector fColValuesList; bool fisNULL; bool fIsFromCol; uint32_t fFuncScale; diff --git a/dbcon/dmlpackage/dmlpkg.h b/dbcon/dmlpackage/dmlpkg.h index dba02b553..c85bbb25f 100644 --- a/dbcon/dmlpackage/dmlpkg.h +++ b/dbcon/dmlpackage/dmlpkg.h @@ -30,6 +30,7 @@ #include #include #include +#include "nullstring.h" namespace dmlpackage { @@ -67,7 +68,7 @@ typedef std::vector AtomList; typedef std::vector QueryBuffer; -typedef std::vector ColValuesList; +typedef std::vector ColValuesList; typedef std::vector ColNameList; typedef std::map TableValuesMap; typedef std::bitset<4096> NullValuesBitset; diff --git a/dbcon/dmlpackage/insertdmlpackage.cpp b/dbcon/dmlpackage/insertdmlpackage.cpp index 57f953c96..35f28ed46 100644 --- a/dbcon/dmlpackage/insertdmlpackage.cpp +++ b/dbcon/dmlpackage/insertdmlpackage.cpp @@ -186,10 +186,12 @@ int InsertDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows n++; colValue = dataList[n]; n++; + // XXX check for "null"? what values do we have here? + utils::NullString nullColValue(colValue); #ifdef DML_PACKAGE_DEBUG // cout << "The column data: " << colName << " " << colValue << endl; #endif - DMLColumn* aColumn = new DMLColumn(colName, colValue, false); + DMLColumn* aColumn = new DMLColumn(colName, nullColValue, false); (aRowPtr->get_ColumnList()).push_back(aColumn); } @@ -208,7 +210,7 @@ int InsertDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValues initializeTable(); Row* aRowPtr = new Row(); std::string colName; - std::vector colValList; + ColValuesList colValList; for (int j = 0; j < columns; j++) { @@ -258,7 +260,10 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement) for (unsigned int i = 0; i < columnNameList.size(); i++) { - DMLColumn* aColumn = new DMLColumn(columnNameList[i], valuesList[i], isNULL); + // XXX can here be NULLs? + idbassert(!isNULL); + utils::NullString ithValue(valuesList[i]); + DMLColumn* aColumn = new DMLColumn(columnNameList[i], ithValue); (aRow->get_ColumnList()).push_back(aColumn); } @@ -275,6 +280,7 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement) while (iter != valuesList.end()) { colValue = *iter; + utils::NullString nullColValue; if (strcasecmp(colValue.c_str(), "NULL") == 0) { @@ -282,10 +288,11 @@ int InsertDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement) } else { + nullColValue.assign(colValue); isNULL = false; } - DMLColumn* aColumn = new DMLColumn(colName, colValue, isNULL); + DMLColumn* aColumn = new DMLColumn(colName, nullColValue, isNULL); (aRow->get_ColumnList()).push_back(aColumn); ++iter; diff --git a/dbcon/dmlpackage/row.cpp b/dbcon/dmlpackage/row.cpp index 1f62041bf..c952a9d2d 100644 --- a/dbcon/dmlpackage/row.cpp +++ b/dbcon/dmlpackage/row.cpp @@ -47,7 +47,7 @@ Row::Row(const Row& row) for (unsigned int i = 0; i < row.fColumnList.size(); i++) { const DMLColumn* aColumn = row.get_ColumnAt(i); - DMLColumn* newColumn = new DMLColumn(aColumn->get_Name(), aColumn->get_Data()); + DMLColumn* newColumn = new DMLColumn(aColumn->get_Name(), aColumn->get_DataVector()); fColumnList.push_back(newColumn); } diff --git a/dbcon/dmlpackage/updatedmlpackage.cpp b/dbcon/dmlpackage/updatedmlpackage.cpp index d2096b689..488b42964 100644 --- a/dbcon/dmlpackage/updatedmlpackage.cpp +++ b/dbcon/dmlpackage/updatedmlpackage.cpp @@ -143,7 +143,8 @@ int UpdateDMLPackage::buildFromSqlStatement(SqlStatement& sqlStatement) while (iter != updateStmt.fColAssignmentListPtr->end()) { ColumnAssignment* colaPtr = *iter; - DMLColumn* colPtr = new DMLColumn(colaPtr->fColumn, colaPtr->fScalarExpression); + NullString expr(colaPtr->fScalarExpression); + DMLColumn* colPtr = new DMLColumn(colaPtr->fColumn, expr); rowPtr->get_ColumnList().push_back(colPtr); ++iter; @@ -205,12 +206,13 @@ int UpdateDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows // Build a column list colName = dataList[n++]; colValue = dataList[n++]; + NullString val(colValue); #ifdef DML_PACKAGE_DEBUG // cout << "The column data: " << colName << " " << colValue << endl; #endif - DMLColumn* aColumn = new DMLColumn(colName, colValue); + DMLColumn* aColumn = new DMLColumn(colName, val); (aRowPtr->get_ColumnList()).push_back(aColumn); } @@ -228,7 +230,7 @@ int UpdateDMLPackage::buildFromMysqlBuffer(ColNameList& colNameList, TableValues initializeTable(); Row* aRowPtr = new Row(); std::string colName; - std::vector colValList; + ColValuesList colValList; for (int j = 0; j < columns; j++) { @@ -262,7 +264,8 @@ void UpdateDMLPackage::buildUpdateFromMysqlBuffer(UpdateSqlStatement& updateStmt while (iter != updateStmt.fColAssignmentListPtr->end()) { ColumnAssignment* colaPtr = *iter; - DMLColumn* colPtr = new DMLColumn(colaPtr->fColumn, colaPtr->fScalarExpression, colaPtr->fFromCol, + NullString scalarExpression(colaPtr->fScalarExpression); + DMLColumn* colPtr = new DMLColumn(colaPtr->fColumn, scalarExpression, colaPtr->fFromCol, colaPtr->fFuncScale, colaPtr->fIsNull); rowPtr->get_ColumnList().push_back(colPtr); diff --git a/dbcon/dmlpackage/vendordmlstatement.h b/dbcon/dmlpackage/vendordmlstatement.h index 115e236da..a9d4dcffc 100644 --- a/dbcon/dmlpackage/vendordmlstatement.h +++ b/dbcon/dmlpackage/vendordmlstatement.h @@ -27,14 +27,11 @@ #include #include #include +#include "dmlpkg.h" #define EXPORT namespace dmlpackage { -typedef std::vector ColValuesList; -typedef std::vector ColNameList; -typedef std::map TableValuesMap; -typedef std::bitset<4096> NullValuesBitset; /** @brief describes the general interface * and implementation of a Vendor DML Statement @@ -60,7 +57,7 @@ class VendorDMLStatement EXPORT VendorDMLStatement(std::string dmlstatement, int stmttype, std::string tName, std::string schema, int rows, int columns, ColNameList& colNameList, TableValuesMap& tableValuesMap, NullValuesBitset& nullValues, int sessionID); - + /** @brief destructor */ EXPORT ~VendorDMLStatement(); diff --git a/dbcon/execplan/aggregatecolumn.cpp b/dbcon/execplan/aggregatecolumn.cpp index 07745d97c..a715de6f2 100644 --- a/dbcon/execplan/aggregatecolumn.cpp +++ b/dbcon/execplan/aggregatecolumn.cpp @@ -417,14 +417,11 @@ void AggregateColumn::evaluate(Row& row, bool& isNull) default: { auto const str = row.getConstString(fInputIndex); - if (str.eq(utils::ConstString(CPNULLSTRMARK))) - isNull = true; - else - fResult.strVal = str.toString(); + fResult.strVal.dropString(); + if (!str.isNull()) + fResult.strVal.assign((const uint8_t*)str.str(), str.length()); - // stringColVal is padded with '\0' to colWidth so can't use str.length() - if (strlen(fResult.strVal.c_str()) == 0) - isNull = true; + isNull = isNull || fResult.strVal.isNull(); break; } diff --git a/dbcon/execplan/aggregatecolumn.h b/dbcon/execplan/aggregatecolumn.h index 00230c263..ec73b2256 100644 --- a/dbcon/execplan/aggregatecolumn.h +++ b/dbcon/execplan/aggregatecolumn.h @@ -356,10 +356,12 @@ class AggregateColumn : public ReturnedColumn /** * F&E */ - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { - evaluate(row, isNull); - return TreeNode::getStrVal(fTimeZone); + bool localIsNull = false; + evaluate(row, localIsNull); + isNull = isNull || localIsNull; + return localIsNull ? fResult.strVal.dropString() : TreeNode::getStrVal(fTimeZone); } /** diff --git a/dbcon/execplan/arithmeticcolumn.h b/dbcon/execplan/arithmeticcolumn.h index 8acc26701..ed577dd18 100644 --- a/dbcon/execplan/arithmeticcolumn.h +++ b/dbcon/execplan/arithmeticcolumn.h @@ -211,7 +211,7 @@ class ArithmeticColumn : public ReturnedColumn * F&E framework * ***********************************************************/ public: - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { return fExpression->getStrVal(row, isNull); } diff --git a/dbcon/execplan/arithmeticoperator.h b/dbcon/execplan/arithmeticoperator.h index 1d4c642bc..e694e577e 100644 --- a/dbcon/execplan/arithmeticoperator.h +++ b/dbcon/execplan/arithmeticoperator.h @@ -109,10 +109,12 @@ class ArithmeticOperator : public Operator inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override; using Operator::getStrVal; - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override { - evaluate(row, isNull, lop, rop); - return TreeNode::getStrVal(fTimeZone); + bool localIsNull = false; + evaluate(row, localIsNull, lop, rop); + isNull = isNull || localIsNull; + return localIsNull ? fResult.strVal.dropString() : TreeNode::getStrVal(fTimeZone); } using Operator::getIntVal; virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 0d844164f..0d716ecc2 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -712,18 +712,18 @@ CalpontSystemCatalog::OID CalpontSystemCatalog::lookupOID(const TableColName& ta { ct.defaultValue = ((*it)->GetStringData(0)); - if ((!ct.defaultValue.empty()) || (ct.defaultValue.length() > 0)) + if (!ct.defaultValue.isNull()) { if (ct.constraintType != NOTNULL_CONSTRAINT) ct.constraintType = DEFAULT_CONSTRAINT; } } else if ((*it)->ColumnOID() == DICTOID_SYSCOLUMN_SCHEMA) - tcn.schema = ((*it)->GetStringData(0)); + tcn.schema = ((*it)->GetStringData(0).safeString("")); else if ((*it)->ColumnOID() == DICTOID_SYSCOLUMN_TABLENAME) - tcn.table = ((*it)->GetStringData(0)); + tcn.table = ((*it)->GetStringData(0).safeString("")); else if ((*it)->ColumnOID() == DICTOID_SYSCOLUMN_COLNAME) - tcn.column = ((*it)->GetStringData(0)); + tcn.column = ((*it)->GetStringData(0).safeString("")); } // temporialy memory leak fix until defaultvalue is added. @@ -1195,7 +1195,7 @@ const CalpontSystemCatalog::ColType CalpontSystemCatalog::colType(const OID& Oid { ct.defaultValue = ((*it)->GetStringData(0)); - if ((!ct.defaultValue.empty()) || (ct.defaultValue.length() > 0)) + if (!ct.defaultValue.isNull()) { if (ct.constraintType != NOTNULL_CONSTRAINT) ct.constraintType = DEFAULT_CONSTRAINT; @@ -1204,11 +1204,11 @@ const CalpontSystemCatalog::ColType CalpontSystemCatalog::colType(const OID& Oid // NJL fix. The schema, table, and column now return the oids for the dictionary columns // on schema, table, and column. else if ((*it)->ColumnOID() == DICTOID_SYSCOLUMN_SCHEMA) - tcn.schema = ((*it)->GetStringData(0)); + tcn.schema = ((*it)->GetStringData(0).safeString("")); else if ((*it)->ColumnOID() == DICTOID_SYSCOLUMN_TABLENAME) - tcn.table = ((*it)->GetStringData(0)); + tcn.table = ((*it)->GetStringData(0).safeString("")); else if ((*it)->ColumnOID() == DICTOID_SYSCOLUMN_COLNAME) - tcn.column = ((*it)->GetStringData(0)); + tcn.column = ((*it)->GetStringData(0).safeString("")); else if ((*it)->ColumnOID() == oid[13]) { if (static_cast((*it)->GetData(0)) == 0) @@ -1447,11 +1447,11 @@ const CalpontSystemCatalog::TableColName CalpontSystemCatalog::colName(const OID for (it = sysDataList.begin(); it != sysDataList.end(); it++) { if ((*it)->ColumnOID() == oid2) - tableColName.schema = (*it)->GetStringData(0); + tableColName.schema = (*it)->GetStringData(0).safeString(""); else if ((*it)->ColumnOID() == oid3) - tableColName.table = (*it)->GetStringData(0); + tableColName.table = (*it)->GetStringData(0).safeString(""); else if ((*it)->ColumnOID() == oid4) - tableColName.column = (*it)->GetStringData(0); + tableColName.column = (*it)->GetStringData(0).safeString(""); } if (oid > 3000) @@ -1548,11 +1548,11 @@ const CalpontSystemCatalog::TableColName CalpontSystemCatalog::dictColName(const for (it = sysDataList.begin(); it != sysDataList.end(); it++) { if ((*it)->ColumnOID() == oid2) - tableColName.schema = (*it)->GetStringData(0); + tableColName.schema = (*it)->GetStringData(0).safeString(""); else if ((*it)->ColumnOID() == oid3) - tableColName.table = (*it)->GetStringData(0); + tableColName.table = (*it)->GetStringData(0).safeString(""); else if ((*it)->ColumnOID() == oid4) - tableColName.column = (*it)->GetStringData(0); + tableColName.column = (*it)->GetStringData(0).safeString(""); } if (oid > 3000) @@ -2811,8 +2811,8 @@ CalpontSystemCatalog::getTables(const std::string schema, int lower_case_table_n { for (int i = 0; i < (*it)->dataCount(); i++) { - tables.push_back(make_pair(0, make_table("", (*it)->GetStringData(i)))); - tnl.push_back((*it)->GetStringData(i)); + tables.push_back(make_pair(0, make_table("", (*it)->GetStringData(i).safeString("")))); + tnl.push_back((*it)->GetStringData(i).safeString("")); } } } @@ -2822,7 +2822,7 @@ CalpontSystemCatalog::getTables(const std::string schema, int lower_case_table_n if ((*it)->ColumnOID() == oid2) { for (int i = 0; i < (*it)->dataCount(); i++) - tables[i].second.schema = (*it)->GetStringData(i); + tables[i].second.schema = (*it)->GetStringData(i).safeString(""); } } @@ -3210,7 +3210,7 @@ const CalpontSystemCatalog::RIDList CalpontSystemCatalog::columnRIDs(const Table for (int i = 0; i < (*it)->dataCount(); i++) { - TableColName tcn = make_tcn(aTableName.schema, aTableName.table, (*it)->GetStringData(i)); + TableColName tcn = make_tcn(aTableName.schema, aTableName.table, (*it)->GetStringData(i).safeString("")); fOIDmap[tcn] = rl[i].objnum; if (fIdentity == EC) @@ -3266,7 +3266,7 @@ const CalpontSystemCatalog::RIDList CalpontSystemCatalog::columnRIDs(const Table { ctList[i].defaultValue = ((*it)->GetStringData(i)); - if ((!ctList[i].defaultValue.empty()) || (ctList[i].defaultValue.length() > 0)) + if (!ctList[i].defaultValue.isNull()) { if (ctList[i].constraintType != NOTNULL_CONSTRAINT) ctList[i].constraintType = DEFAULT_CONSTRAINT; @@ -3435,9 +3435,9 @@ const CalpontSystemCatalog::TableName CalpontSystemCatalog::tableName(const OID& } if ((*it)->ColumnOID() == oid2) - tableName.schema = (*it)->GetStringData(0); + tableName.schema = (*it)->GetStringData(0).safeString(""); else if ((*it)->ColumnOID() == oid3) - tableName.table = (*it)->GetStringData(0); + tableName.table = (*it)->GetStringData(0).safeString(""); } //@Bug 2682. datacount 0 sometimes does not mean the table is not found. @@ -5670,7 +5670,7 @@ void CalpontSystemCatalog::getSchemaInfo(const string& in_schema, int lower_case { for (int i = 0; i < (*it)->dataCount(); i++) { - tableNames.push_back((*it)->GetStringData(i)); + tableNames.push_back((*it)->GetStringData(i).safeString("")); tbIter = tbInfo.find(tableNames[i]); if (tbIter == tbInfo.end()) @@ -5713,7 +5713,7 @@ void CalpontSystemCatalog::getSchemaInfo(const string& in_schema, int lower_case // lk2.lock(); for (int i = 0; i < (*it)->dataCount(); i++) { - TableColName tcn = make_tcn(schema, tableNames[i], (*it)->GetStringData(i)); + TableColName tcn = make_tcn(schema, tableNames[i], (*it)->GetStringData(i).safeString("")); fOIDmap[tcn] = rl[i].objnum; if (fIdentity == EC) @@ -5768,7 +5768,7 @@ void CalpontSystemCatalog::getSchemaInfo(const string& in_schema, int lower_case { ctList[i].defaultValue = ((*it)->GetStringData(i)); - if ((!ctList[i].defaultValue.empty()) || (ctList[i].defaultValue.length() > 0)) + if (!ctList[i].defaultValue.isNull()) { if (ctList[i].constraintType != NOTNULL_CONSTRAINT) ctList[i].constraintType = DEFAULT_CONSTRAINT; @@ -6301,7 +6301,6 @@ void CalpontSystemCatalog::checkSysCatVer() CalpontSystemCatalog::ColType::ColType() : constraintType(NO_CONSTRAINT) - , defaultValue("") , colPosition(-1) , compressionType(NO_COMPRESSION) , columnOID(0) @@ -6376,6 +6375,22 @@ boost::any CalpontSystemCatalog::ColType::convertColumnData(const std::string& d return h->convertFromString(*this, prm, data, pushWarning); } +boost::any CalpontSystemCatalog::ColType::convertColumnData(const NullString& data, bool& pushWarning, + long timeZone, bool noRoundup, + bool isUpdate) const +{ + pushWarning = false; + const datatypes::TypeHandler* h = typeHandler(); + if (!h) + throw QueryDataExcept("convertColumnData: unknown column data type.", dataTypeErr); + + if (data.isNull()) + return h->getNullValueForType(*this); + + const datatypes::ConvertFromStringParam prm(timeZone, noRoundup, isUpdate); + return h->convertFromString(*this, prm, data.unsafeStringRef(), pushWarning); +} + CalpontSystemCatalog::ColType CalpontSystemCatalog::ColType::convertUnionColType( vector& types, unsigned int& rc) diff --git a/dbcon/execplan/calpontsystemcatalog.h b/dbcon/execplan/calpontsystemcatalog.h index 44f38be11..f8d7d500a 100644 --- a/dbcon/execplan/calpontsystemcatalog.h +++ b/dbcon/execplan/calpontsystemcatalog.h @@ -50,6 +50,7 @@ #include "mcs_datatype.h" #include "collation.h" // CHARSET_INFO, class Charset +#include "nullstring.h" class ExecPlanTest; namespace messageqcpp @@ -207,7 +208,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog { ConstraintType constraintType; DictOID ddn; - std::string defaultValue; + NullString defaultValue; int32_t colPosition; // temporally put here. may need to have ColInfo struct later int32_t compressionType; OID columnOID; @@ -271,6 +272,18 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog boost::any convertColumnData(const std::string& data, bool& bSaturate, long timeZone, bool nulFlag = false, bool noRoundup = false, bool isUpdate = false) const; + /** + * @brief convert a columns data, represnted as a string, + * to its native format + * @param data - the string representation, with special NULL value + * @param [OUT] bSaturate - the value was truncated/adjusted + * @param timeZone - the time zone name, for TIMESTAMP conversion + * @param nRoundtrip + * @param isUpdate + */ + boost::any convertColumnData(const NullString& data, bool& bSaturate, long timeZone, + bool noRoundup = false, bool isUpdate = false) const; + const std::string toString() const; // Put these here so udf doesn't need to link libexecplan diff --git a/dbcon/execplan/columnresult.h b/dbcon/execplan/columnresult.h index 4bf410607..f0c1f1061 100644 --- a/dbcon/execplan/columnresult.h +++ b/dbcon/execplan/columnresult.h @@ -28,6 +28,9 @@ #include #include +#include "nullstring.h" +using namespace utils; + namespace execplan { /** @file @@ -58,17 +61,24 @@ class ColumnResult dcount++; } - const std::string& GetStringData(uint32_t index) const + const NullString& GetStringData(uint32_t index) const { return stringData[index]; } - void PutStringData(const std::string& s) + void PutStringData(const NullString& s) { stringData.push_back(s); dcount++; } + void PutStringData(const char*str, size_t len) + { + idbassert(str != nullptr || len == 0); + NullString tmp(str, len); + PutStringData(tmp); + } + int ColumnOID() const { return oid; @@ -106,7 +116,7 @@ class ColumnResult // ColumnResult& operator=(const ColumnResult& rhs); std::vector intData; - std::vector stringData; + std::vector stringData; std::vector rids; int oid; int dcount; // data, string, and row counters diff --git a/dbcon/execplan/constantcolumn.cpp b/dbcon/execplan/constantcolumn.cpp index f61f06031..0ebbcc841 100644 --- a/dbcon/execplan/constantcolumn.cpp +++ b/dbcon/execplan/constantcolumn.cpp @@ -39,14 +39,14 @@ namespace execplan /** * Constructors/Destructors */ -ConstantColumn::ConstantColumn() : ReturnedColumn(), fType(0) +ConstantColumn::ConstantColumn() : ReturnedColumn(), fType(NULLDATA) { } ConstantColumn::ConstantColumn(const string& sql, TYPE type) : ReturnedColumn(), fConstval(sql), fType(type), fData(sql) { - fResult.strVal = sql; + fResult.strVal.assign(sql); fResult.intVal = atoll(sql.c_str()); fResult.uintVal = strtoull(sql.c_str(), NULL, 0); @@ -81,7 +81,7 @@ ConstantColumn::ConstantColumn(const string& sql, TYPE type) ConstantColumn::ConstantColumn(const string& sql, const double val) : ReturnedColumn(), fConstval(sql), fType(NUM), fData(sql) { - fResult.strVal = sql; + fResult.strVal.assign(sql); fResult.doubleVal = val; fResult.intVal = (int64_t)val; fResult.uintVal = (uint64_t)val; @@ -96,7 +96,7 @@ ConstantColumn::ConstantColumn(const string& sql, const double val) ConstantColumn::ConstantColumn(const string& sql, const long double val) : ReturnedColumn(), fConstval(sql), fType(NUM), fData(sql) { - fResult.strVal = sql; + fResult.strVal.assign(sql); fResult.doubleVal = (double)val; fResult.intVal = (int64_t)val; fResult.uintVal = (uint64_t)val; @@ -111,7 +111,7 @@ ConstantColumn::ConstantColumn(const string& sql, const long double val) ConstantColumn::ConstantColumn(const string& sql, const int64_t val, TYPE type) : ReturnedColumn(), fConstval(sql), fType(type), fData(sql) { - fResult.strVal = sql; + fResult.strVal.assign(sql); fResult.intVal = val; fResult.uintVal = (uint64_t)fResult.intVal; fResult.floatVal = (float)fResult.intVal; @@ -125,7 +125,7 @@ ConstantColumn::ConstantColumn(const string& sql, const int64_t val, TYPE type) ConstantColumn::ConstantColumn(const string& sql, const uint64_t val, TYPE type) : ReturnedColumn(), fConstval(sql), fType(type), fData(sql) { - fResult.strVal = sql; + fResult.strVal.assign(sql); fResult.uintVal = val; fResult.intVal = (int64_t)fResult.uintVal; fResult.floatVal = (float)fResult.uintVal; @@ -139,7 +139,7 @@ ConstantColumn::ConstantColumn(const string& sql, const uint64_t val, TYPE type) ConstantColumn::ConstantColumn(const string& sql, const IDB_Decimal& val) : ReturnedColumn(), fConstval(sql), fType(NUM), fData(sql) { - fResult.strVal = sql; + fResult.strVal.assign(sql); fResult.intVal = (int64_t)atoll(sql.c_str()); fResult.uintVal = strtoull(sql.c_str(), NULL, 0); fResult.floatVal = atof(sql.c_str()); @@ -167,9 +167,9 @@ ConstantColumn::ConstantColumn(const int64_t val, TYPE type) : ReturnedColumn(), { ostringstream oss; oss << val; - fConstval = oss.str(); + fConstval.assign(oss.str()); fData = oss.str(); - fResult.strVal = fData; + fResult.strVal.assign(fData); fResult.intVal = val; fResult.uintVal = (uint64_t)fResult.intVal; fResult.floatVal = (float)fResult.intVal; @@ -185,9 +185,9 @@ ConstantColumn::ConstantColumn(const uint64_t val, TYPE type, int8_t scale, uint { ostringstream oss; oss << val; - fConstval = oss.str(); + fConstval.assign(oss.str()); fData = oss.str(); - fResult.strVal = fData; + fResult.strVal.assign(fData); fResult.intVal = (int64_t)val; fResult.uintVal = val; fResult.floatVal = (float)fResult.uintVal; @@ -205,7 +205,8 @@ ConstantColumn::~ConstantColumn() const string ConstantColumn::toString() const { ostringstream oss; - oss << "ConstantColumn: " << fConstval << " intVal=" << fResult.intVal << " uintVal=" << fResult.uintVal; + oss << "ConstantColumn: " << fConstval.safeString("<>") << " intVal=" << fResult.intVal + << " uintVal=" << fResult.uintVal; oss << '('; if (fType == LITERAL) @@ -228,7 +229,7 @@ std::string ConstantColumn::toCppCode(IncludeSet& includes) const { includes.insert("constantcolumn.h"); std::stringstream ss; - ss << "ConstantColumn(" << std::quoted(fData) << ", " << fConstval << ")"; + ss << "ConstantColumn(" << std::quoted(fData) << ", " << fConstval.safeString() << ")"; return ss.str(); } @@ -305,7 +306,10 @@ bool ConstantColumn::operator==(const ConstantColumn& t) const if (*rc1 != *rc2) return false; - if (fConstval != t.fConstval) + if (fConstval.isNull() != t.fConstval.isNull()) + return false; + + if (!fConstval.isNull() && fConstval.unsafeStringRef() != t.fConstval.unsafeStringRef()) return false; if (fType != t.fType) diff --git a/dbcon/execplan/constantcolumn.h b/dbcon/execplan/constantcolumn.h index c74825c1e..43ed475e0 100644 --- a/dbcon/execplan/constantcolumn.h +++ b/dbcon/execplan/constantcolumn.h @@ -27,6 +27,10 @@ #include #include "returnedcolumn.h" +#include "nullstring.h" + +#include "stdlib.h" +#include "execinfo.h" namespace messageqcpp { @@ -100,16 +104,28 @@ class ConstantColumn : public ReturnedColumn /** * accessor */ - inline const std::string& constval() const + inline const utils::NullString& constval() const { + if (isNull()) + { + static NullString nullstr; + return nullstr; + } return fConstval; } /** * accessor */ - inline void constval(const std::string& constval) + inline void constval(const utils::NullString& constval) { fConstval = constval; + fResult.strVal = constval; + } + inline void constval(const std::string& constval) + { + idbassert(fType != NULLDATA); + fConstval.assign(constval); + fResult.strVal.assign(constval); } /** * accessor @@ -202,8 +218,13 @@ class ConstantColumn : public ReturnedColumn fDerivedTable = std::string("*"); } + bool isNull() const + { + return fType == NULLDATA || fConstval.isNull(); + } + private: - std::string fConstval; + utils::NullString fConstval; int fType; std::string fData; long fTimeZone; @@ -254,7 +275,7 @@ class ConstantColumn : public ReturnedColumn /** * F&E */ - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { isNull = isNull || (fType == NULLDATA); return fResult.strVal; @@ -308,7 +329,7 @@ class ConstantColumn : public ReturnedColumn if (!fResult.valueConverted) { - fResult.intVal = dataconvert::DataConvert::stringToDate(fResult.strVal); + fResult.intVal = dataconvert::DataConvert::stringToDate(fResult.strVal.safeString()); fResult.valueConverted = true; } @@ -323,7 +344,8 @@ class ConstantColumn : public ReturnedColumn if (!fResult.valueConverted) { - fResult.intVal = dataconvert::DataConvert::stringToDatetime(fResult.strVal); + isNull = isNull || fResult.strVal.isNull(); + fResult.intVal = dataconvert::DataConvert::stringToDatetime(fResult.strVal.safeString("")); fResult.valueConverted = true; } @@ -338,7 +360,8 @@ class ConstantColumn : public ReturnedColumn if (!fResult.valueConverted) { - fResult.intVal = dataconvert::DataConvert::stringToTimestamp(fResult.strVal, fTimeZone); + isNull = isNull || fResult.strVal.isNull(); + fResult.intVal = dataconvert::DataConvert::stringToTimestamp(fResult.strVal.safeString(""), fTimeZone); fResult.valueConverted = true; } @@ -353,7 +376,7 @@ class ConstantColumn : public ReturnedColumn if (!fResult.valueConverted) { - fResult.intVal = dataconvert::DataConvert::stringToTime(fResult.strVal); + fResult.intVal = dataconvert::DataConvert::stringToTime(fResult.strVal.safeString("")); fResult.valueConverted = true; } diff --git a/dbcon/execplan/functioncolumn.h b/dbcon/execplan/functioncolumn.h index b1a702c9a..57843828c 100644 --- a/dbcon/execplan/functioncolumn.h +++ b/dbcon/execplan/functioncolumn.h @@ -217,10 +217,15 @@ class FunctionColumn : public ReturnedColumn * F&E framework * ***********************************************************/ public: - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { fOperationType.setTimeZone(fTimeZone); - fResult.strVal = fFunctor->getStrVal(row, fFunctionParms, isNull, fOperationType); + fResult.strVal.dropString(); + std::string val = fFunctor->getStrVal(row, fFunctionParms, isNull, fOperationType); + if (!isNull) + { + fResult.strVal.assign(val); + } return fResult.strVal; } virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override diff --git a/dbcon/execplan/operator.h b/dbcon/execplan/operator.h index 2177bc0b2..e1598fbe0 100644 --- a/dbcon/execplan/operator.h +++ b/dbcon/execplan/operator.h @@ -163,8 +163,9 @@ class Operator : public TreeNode // The following methods should be pure virtual. Currently too many instanslization exists. using TreeNode::getStrVal; - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) { + isNull = isNull || fResult.strVal.isNull(); return fResult.strVal; } using TreeNode::getIntVal; diff --git a/dbcon/execplan/parsetree.h b/dbcon/execplan/parsetree.h index eefe09147..1a40d587f 100644 --- a/dbcon/execplan/parsetree.h +++ b/dbcon/execplan/parsetree.h @@ -238,7 +238,7 @@ class ParseTree **********************************************************************/ public: - inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) + inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) { if (fLeft && fRight) return (reinterpret_cast(fData))->getStrVal(row, isNull, fLeft, fRight); diff --git a/dbcon/execplan/predicateoperator.cpp b/dbcon/execplan/predicateoperator.cpp index 6ff4d311b..fb8d1993a 100644 --- a/dbcon/execplan/predicateoperator.cpp +++ b/dbcon/execplan/predicateoperator.cpp @@ -367,14 +367,14 @@ bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedCol // like operator. both sides are string. if (fOp == OP_LIKE || fOp == OP_NOTLIKE) { - const std::string& subject = lop->getStrVal(row, isNull); + const auto& subject = lop->getStrVal(row, isNull); if (isNull) return false; - const std::string& pattern = rop->getStrVal(row, isNull); + const auto& pattern = rop->getStrVal(row, isNull); if (isNull) return false; - return datatypes::Charset(cs).like(fOp == OP_NOTLIKE, utils::ConstString(subject), - utils::ConstString(pattern)); + return datatypes::Charset(cs).like(fOp == OP_NOTLIKE, utils::ConstString(subject.str(), subject.length()), + utils::ConstString(pattern.str(), pattern.length())); } // fOpType should have already been set on the connector during parsing @@ -709,11 +709,15 @@ bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedCol if (isNull) return false; - const std::string& val1 = lop->getStrVal(row, isNull); + const auto& val1 = lop->getStrVal(row, isNull); if (isNull) return false; - return strTrimCompare(val1, rop->getStrVal(row, isNull)) && !isNull; + const auto& val2 = rop->getStrVal(row, isNull); + if (isNull) + return false; + + return strTrimCompare(val1.safeString(""), val2.safeString("")); } case execplan::CalpontSystemCatalog::VARBINARY: diff --git a/dbcon/execplan/simplecolumn.cpp b/dbcon/execplan/simplecolumn.cpp index dc6ba80c5..e3293527a 100644 --- a/dbcon/execplan/simplecolumn.cpp +++ b/dbcon/execplan/simplecolumn.cpp @@ -680,7 +680,7 @@ void SimpleColumn::evaluate(Row& row, bool& isNull) case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: { - fResult.strVal = row.getVarBinaryStringField(fInputIndex); + fResult.strVal.assign(row.getVarBinaryField(fInputIndex), row.getVarBinaryLength(fInputIndex)); break; } diff --git a/dbcon/execplan/simplecolumn.h b/dbcon/execplan/simplecolumn.h index 9437cda92..e3d5f6550 100644 --- a/dbcon/execplan/simplecolumn.h +++ b/dbcon/execplan/simplecolumn.h @@ -287,9 +287,16 @@ class SimpleColumn : public ReturnedColumn evaluate(row, isNull); return TreeNode::getBoolVal(); } - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { - evaluate(row, isNull); + bool localIsNull = false; + evaluate(row, localIsNull); + if (localIsNull) + { + isNull = isNull || localIsNull; + fResult.strVal.dropString(); + return fResult.strVal; + } return TreeNode::getStrVal(fTimeZone); } diff --git a/dbcon/execplan/simplecolumn_decimal.h b/dbcon/execplan/simplecolumn_decimal.h index 3b7d208fb..8d4fd388b 100644 --- a/dbcon/execplan/simplecolumn_decimal.h +++ b/dbcon/execplan/simplecolumn_decimal.h @@ -70,7 +70,7 @@ class SimpleColumn_Decimal : public SimpleColumn } /** Evaluate methods */ - virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override; + virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override; @@ -93,8 +93,8 @@ std::string SimpleColumn_Decimal::toCppCode(IncludeSet& includes) const { includes.insert("simplecolumn_decimal.h"); std::stringstream ss; - ss << "SimpleColumn_Decimal<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) << ", " << - std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")"; + ss << "SimpleColumn_Decimal<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) + << ", " << std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")"; return ss.str(); } @@ -148,11 +148,19 @@ void SimpleColumn_Decimal::setNullVal() } template -inline const std::string& SimpleColumn_Decimal::getStrVal(rowgroup::Row& row, bool& isNull) +inline const utils::NullString& SimpleColumn_Decimal::getStrVal(rowgroup::Row& row, bool& isNull) { - datatypes::Decimal dec((int64_t)row.getIntField(fInputIndex), fResultType.scale, - fResultType.precision); - fResult.strVal = dec.toString(); + if (row.equals(fNullVal, fInputIndex)) + { + isNull = true; + fResult.strVal.dropString(); + } + else + { + datatypes::Decimal dec((int64_t)row.getIntField(fInputIndex), fResultType.scale, + fResultType.precision); + fResult.strVal.assign(dec.toString()); + } return fResult.strVal; } diff --git a/dbcon/execplan/simplecolumn_int.h b/dbcon/execplan/simplecolumn_int.h index e1f1a59bf..0533c3596 100644 --- a/dbcon/execplan/simplecolumn_int.h +++ b/dbcon/execplan/simplecolumn_int.h @@ -69,7 +69,7 @@ class SimpleColumn_INT : public SimpleColumn } /** Evaluate methods */ - virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override; + virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override; virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; @@ -146,10 +146,13 @@ void SimpleColumn_INT::setNullVal() } template -inline const std::string& SimpleColumn_INT::getStrVal(rowgroup::Row& row, bool& isNull) +inline const utils::NullString & SimpleColumn_INT::getStrVal(rowgroup::Row& row, bool& isNull) { if (row.equals(fNullVal, fInputIndex)) + { isNull = true; + fResult.strVal.dropString(); + } else { #ifndef __LP64__ @@ -157,9 +160,9 @@ inline const std::string& SimpleColumn_INT::getStrVal(rowgroup::Row& row, b #else snprintf(tmp, 20, "%ld", (int64_t)row.getIntField(fInputIndex)); #endif + fResult.strVal.assign(std::string(tmp)); } - fResult.strVal = std::string(tmp); return fResult.strVal; } diff --git a/dbcon/execplan/simplecolumn_uint.h b/dbcon/execplan/simplecolumn_uint.h index 52e552c78..2e5b67ab0 100644 --- a/dbcon/execplan/simplecolumn_uint.h +++ b/dbcon/execplan/simplecolumn_uint.h @@ -69,7 +69,7 @@ class SimpleColumn_UINT : public SimpleColumn } /** Evaluate methods */ - virtual inline const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override; + virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override; virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override; virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override; virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override; @@ -148,10 +148,13 @@ void SimpleColumn_UINT::setNullVal() } template -inline const std::string& SimpleColumn_UINT::getStrVal(rowgroup::Row& row, bool& isNull) +inline const utils::NullString& SimpleColumn_UINT::getStrVal(rowgroup::Row& row, bool& isNull) { if (row.equals(fNullVal, fInputIndex)) + { isNull = true; + fResult.strVal.dropString(); + } else { #ifndef __LP64__ @@ -159,9 +162,9 @@ inline const std::string& SimpleColumn_UINT::getStrVal(rowgroup::Row& row, #else snprintf(tmp, 21, "%lu", row.getUintField(fInputIndex)); #endif + fResult.strVal.assign(std::string(tmp)); } - fResult.strVal = std::string(tmp); return fResult.strVal; } diff --git a/dbcon/execplan/simplefilter.cpp b/dbcon/execplan/simplefilter.cpp index fc53c8080..83a73e227 100644 --- a/dbcon/execplan/simplefilter.cpp +++ b/dbcon/execplan/simplefilter.cpp @@ -562,54 +562,50 @@ void SimpleFilter::convertConstant() if (fRhs->resultType().colDataType == CalpontSystemCatalog::DATE) { - if (lcc->constval().empty()) + if (lcc->isNull()) { - lcc->constval("0000-00-00"); result.intVal = 0; - result.strVal = lcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::dateToInt(result.strVal); + result.intVal = dataconvert::DataConvert::dateToInt(result.strVal.safeString("")); } } else if (fRhs->resultType().colDataType == CalpontSystemCatalog::DATETIME) { - if (lcc->constval().empty()) + if (lcc->isNull()) { - lcc->constval("0000-00-00 00:00:00"); result.intVal = 0; - result.strVal = lcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::datetimeToInt(result.strVal); + result.intVal = dataconvert::DataConvert::datetimeToInt(result.strVal.safeString("")); } } else if (fRhs->resultType().colDataType == CalpontSystemCatalog::TIMESTAMP) { - if (lcc->constval().empty()) + if (lcc->isNull()) { - lcc->constval("0000-00-00 00:00:00"); result.intVal = 0; - result.strVal = lcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal, fTimeZone); + result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal.safeString(""), fTimeZone); } } else if (fRhs->resultType().colDataType == CalpontSystemCatalog::TIME) { - if (lcc->constval().empty()) + if (lcc->isNull()) { - lcc->constval("00:00:00"); result.intVal = 0; - result.strVal = lcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::timeToInt(result.strVal); + result.intVal = dataconvert::DataConvert::timeToInt(result.strVal.safeString("")); } } @@ -622,54 +618,50 @@ void SimpleFilter::convertConstant() if (fLhs->resultType().colDataType == CalpontSystemCatalog::DATE) { - if (rcc->constval().empty()) + if (rcc->isNull()) { - rcc->constval("0000-00-00"); result.intVal = 0; - result.strVal = rcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::dateToInt(result.strVal); + result.intVal = dataconvert::DataConvert::dateToInt(result.strVal.safeString("")); } } else if (fLhs->resultType().colDataType == CalpontSystemCatalog::DATETIME) { - if (rcc->constval().empty()) + if (rcc->isNull()) { - rcc->constval("0000-00-00 00:00:00"); result.intVal = 0; - result.strVal = rcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::datetimeToInt(result.strVal); + result.intVal = dataconvert::DataConvert::datetimeToInt(result.strVal.safeString("")); } } else if (fLhs->resultType().colDataType == CalpontSystemCatalog::TIMESTAMP) { - if (rcc->constval().empty()) + if (rcc->isNull()) { - rcc->constval("0000-00-00 00:00:00"); result.intVal = 0; - result.strVal = rcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal, fTimeZone); + result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal.safeString(""), fTimeZone); } } else if (fLhs->resultType().colDataType == CalpontSystemCatalog::TIME) { - if (rcc->constval().empty()) + if (rcc->isNull()) { - rcc->constval("00:00:00"); result.intVal = 0; - result.strVal = rcc->constval(); + result.strVal.dropString(); } else { - result.intVal = dataconvert::DataConvert::timeToInt(result.strVal); + result.intVal = dataconvert::DataConvert::timeToInt(result.strVal.safeString()); } } diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index dbcd377da..710c82eaa 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -40,6 +40,7 @@ #include "mcs_decimal.h" #include "mcs_int64.h" #include "numericliteral.h" +#include "nullstring.h" namespace messageqcpp { @@ -145,7 +146,7 @@ struct Result , longDoubleVal(0) , floatVal(0) , boolVal(false) - , strVal("") + , strVal() , decimalVal(IDB_Decimal()) , valueConverted(false) { @@ -160,7 +161,7 @@ struct Result long double longDoubleVal; float floatVal; bool boolVal; - std::string strVal; + utils::NullString strVal; IDB_Decimal decimalVal; bool valueConverted; }; @@ -266,8 +267,9 @@ class TreeNode /*********************************************************************** * F&E framework * ***********************************************************************/ - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) { + isNull = isNull || fResult.strVal.isNull(); // XXX: NullString returns isNull, we should remove that parameter altogether. return fResult.strVal; } virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) @@ -331,7 +333,7 @@ class TreeNode } inline bool getBoolVal(); - inline const std::string& getStrVal(const long timeZone); + inline const utils::NullString& getStrVal(const long timeZone); inline int64_t getIntVal(); inline uint64_t getUintVal(); inline float getFloatVal(); @@ -409,13 +411,15 @@ inline bool TreeNode::getBoolVal() if (fResultType.colWidth <= 8) return (atoi((char*)(&fResult.origIntVal)) != 0); - return (atoi(fResult.strVal.c_str()) != 0); + idbassert(fResult.strVal.str()); + return (atoi(fResult.strVal.str()) != 0); case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) return (atoi((char*)(&fResult.origIntVal)) != 0); - return (atoi(fResult.strVal.c_str()) != 0); + idbassert(fResult.strVal.str()); + return (atoi(fResult.strVal.str()) != 0); // FIXME: Huh??? case CalpontSystemCatalog::VARBINARY: @@ -424,7 +428,8 @@ inline bool TreeNode::getBoolVal() if (fResultType.colWidth <= 7) return (atoi((char*)(&fResult.origIntVal)) != 0); - return (atoi(fResult.strVal.c_str()) != 0); + idbassert(fResult.strVal.str()); + return (atoi(fResult.strVal.str()) != 0); case CalpontSystemCatalog::BIGINT: case CalpontSystemCatalog::SMALLINT: @@ -463,28 +468,28 @@ inline bool TreeNode::getBoolVal() return fResult.boolVal; } -inline const std::string& TreeNode::getStrVal(const long timeZone) +inline const utils::NullString& TreeNode::getStrVal(const long timeZone) { switch (fResultType.colDataType) { - case CalpontSystemCatalog::CHAR: - if (fResultType.colWidth <= 8) - fResult.strVal = (char*)(&fResult.origIntVal); - - break; - case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) - fResult.strVal = (char*)(&fResult.origIntVal); + { + const char *intAsChar = (const char*) (&fResult.origIntVal); + fResult.strVal.assign((const uint8_t*)intAsChar, strlen(intAsChar)); + } break; - // FIXME: ??? - case CalpontSystemCatalog::VARBINARY: + case CalpontSystemCatalog::CHAR: + case CalpontSystemCatalog::VARBINARY: // XXX: TODO: we don't have varbinary support now, but it may be handled just like varchar. case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: - if (fResultType.colWidth <= 7) - fResult.strVal = (char*)(&fResult.origIntVal); + if (fResultType.colWidth <= 8) + { + const char *intAsChar = (const char*) (&fResult.origIntVal); + fResult.strVal.assign((const uint8_t*)intAsChar, strlen(intAsChar)); + } break; @@ -499,7 +504,7 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) #else snprintf(tmp, 20, "%ld", fResult.intVal); #endif - fResult.strVal = std::string(tmp); + fResult.strVal.assign(std::string(tmp)); break; } @@ -514,7 +519,7 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) #else snprintf(tmp, 20, "%lu", fResult.uintVal); #endif - fResult.strVal = std::string(tmp); + fResult.strVal.assign(std::string(tmp)); break; } @@ -524,7 +529,7 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) if ((fabs(fResult.floatVal) > (1.0 / IDB_pow[4])) && (fabs(fResult.floatVal) < (float)IDB_pow[6])) { snprintf(tmp, 312, "%f", fResult.floatVal); - fResult.strVal = removeTrailing0(tmp, 312); + fResult.strVal.assign(removeTrailing0(tmp, 312)); } else { @@ -535,14 +540,15 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) if (std::isnan(exponent) || std::isnan(base)) { snprintf(tmp, 312, "%f", fResult.floatVal); - fResult.strVal = removeTrailing0(tmp, 312); + fResult.strVal.assign(removeTrailing0(tmp, 312)); } else { snprintf(tmp, 312, "%.5f", base); - fResult.strVal = removeTrailing0(tmp, 312); + std::string tmpCat(removeTrailing0(tmp, 312)); snprintf(tmp, 312, "e%02d", exponent); - fResult.strVal += tmp; + tmpCat += tmp; + fResult.strVal.assign(tmpCat); } // snprintf(tmp, 312, "%e.5", fResult.floatVal); @@ -558,7 +564,7 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) if ((fabs(fResult.doubleVal) > (1.0 / IDB_pow[13])) && (fabs(fResult.doubleVal) < (float)IDB_pow[15])) { snprintf(tmp, 312, "%f", fResult.doubleVal); - fResult.strVal = removeTrailing0(tmp, 312); + fResult.strVal.assign(removeTrailing0(tmp, 312)); } else { @@ -569,14 +575,15 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) if (std::isnan(exponent) || std::isnan(base)) { snprintf(tmp, 312, "%f", fResult.doubleVal); - fResult.strVal = removeTrailing0(tmp, 312); + fResult.strVal.assign(removeTrailing0(tmp, 312)); } else { snprintf(tmp, 312, "%.9f", base); - fResult.strVal = removeTrailing0(tmp, 312); + std::string tmpCat(removeTrailing0(tmp, 312)); snprintf(tmp, 312, "e%02d", exponent); - fResult.strVal += tmp; + tmpCat += tmp; + fResult.strVal.assign(tmpCat); } // snprintf(tmp, 312, "%e", fResult.doubleVal); @@ -592,7 +599,7 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) (fabsl(fResult.longDoubleVal) < (float)IDB_pow[15])) { snprintf(tmp, 312, "%Lf", fResult.longDoubleVal); - fResult.strVal = removeTrailing0(tmp, 312); + fResult.strVal.assign(removeTrailing0(tmp, 312)); } else { @@ -603,14 +610,15 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) if (std::isnan(exponent) || std::isnan(base)) { snprintf(tmp, 312, "%Lf", fResult.longDoubleVal); - fResult.strVal = removeTrailing0(tmp, 312); + fResult.strVal.assign(removeTrailing0(tmp, 312)); } else { snprintf(tmp, 312, "%.14Lf", base); - fResult.strVal = removeTrailing0(tmp, 312); + std::string tmpCat = removeTrailing0(tmp, 312); snprintf(tmp, 312, "e%02d", exponent); - fResult.strVal += tmp; + tmpCat += tmp; + fResult.strVal.assign(tmpCat); } // snprintf(tmp, 312, "%e", fResult.doubleVal); @@ -624,38 +632,42 @@ inline const std::string& TreeNode::getStrVal(const long timeZone) case CalpontSystemCatalog::UDECIMAL: { if (fResultType.colWidth == datatypes::MAXDECIMALWIDTH) + { // Explicit path for TSInt128 decimals with low precision - fResult.strVal = fResult.decimalVal.toString(true); + fResult.strVal = fResult.decimalVal.toNullString(true); + } else - fResult.strVal = fResult.decimalVal.toString(); + { + fResult.strVal = fResult.decimalVal.toNullString(false); + } break; } case CalpontSystemCatalog::DATE: { dataconvert::DataConvert::dateToString(fResult.intVal, tmp, 255); - fResult.strVal = std::string(tmp); + fResult.strVal.assign(std::string(tmp)); break; } case CalpontSystemCatalog::DATETIME: { dataconvert::DataConvert::datetimeToString(fResult.intVal, tmp, 255, fResultType.precision); - fResult.strVal = std::string(tmp); + fResult.strVal.assign(std::string(tmp)); break; } case CalpontSystemCatalog::TIMESTAMP: { dataconvert::DataConvert::timestampToString(fResult.intVal, tmp, 255, timeZone, fResultType.precision); - fResult.strVal = std::string(tmp); + fResult.strVal.assign(std::string(tmp)); break; } case CalpontSystemCatalog::TIME: { dataconvert::DataConvert::timeToString(fResult.intVal, tmp, 255, fResultType.precision); - fResult.strVal = std::string(tmp); + fResult.strVal.assign(std::string(tmp)); break; } @@ -676,7 +688,7 @@ inline int64_t TreeNode::getIntVal() return fResult.intVal; } datatypes::DataCondition cnverr; - literal::Converter cnv(fResult.strVal, cnverr); + literal::Converter cnv(fResult.strVal.safeString(""), cnverr); return cnv.toSInt(cnverr); } case CalpontSystemCatalog::VARCHAR: @@ -688,7 +700,7 @@ inline int64_t TreeNode::getIntVal() return fResult.intVal; datatypes::DataCondition cnverr; - literal::Converter cnv(fResult.strVal, cnverr); + literal::Converter cnv(fResult.strVal.safeString(""), cnverr); return cnv.toSInt(cnverr); } @@ -736,10 +748,10 @@ inline uint64_t TreeNode::getUintVal() case CalpontSystemCatalog::TEXT: { datatypes::DataCondition cnverr; - literal::Converter cnv(fResult.strVal, cnverr); + literal::Converter cnv(fResult.strVal.safeString(""), cnverr); if (datatypes::DataCondition::Code(cnverr) != 0) { - cerr << "error in unsigned int conversion from '" << fResult.strVal << "'"; + cerr << "error in unsigned int conversion from '" << fResult.strVal.safeString() << "'"; } return cnv.toXIntPositive(cnverr); } @@ -784,13 +796,15 @@ inline float TreeNode::getFloatVal() if (fResultType.colWidth <= 8) return atof((char*)(&fResult.origIntVal)); - return atof(fResult.strVal.c_str()); + idbassert(fResult.strVal.str()); + return atof(fResult.strVal.str()); case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) return atof((char*)(&fResult.origIntVal)); - return atof(fResult.strVal.c_str()); + idbassert(fResult.strVal.str()); + return atof(fResult.strVal.str()); // FIXME: ??? case CalpontSystemCatalog::VARBINARY: @@ -799,7 +813,8 @@ inline float TreeNode::getFloatVal() if (fResultType.colWidth <= 7) return atof((char*)(&fResult.origIntVal)); - return atof(fResult.strVal.c_str()); + idbassert(fResult.strVal.str()); + return atof(fResult.strVal.str()); case CalpontSystemCatalog::BIGINT: case CalpontSystemCatalog::TINYINT: @@ -852,13 +867,15 @@ inline double TreeNode::getDoubleVal() if (fResultType.colWidth <= 8) return strtod((char*)(&fResult.origIntVal), NULL); - return strtod(fResult.strVal.c_str(), NULL); + idbassert(fResult.strVal.str()); + return strtod(fResult.strVal.str(), NULL); case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) return strtod((char*)(&fResult.origIntVal), NULL); - return strtod(fResult.strVal.c_str(), NULL); + idbassert(fResult.strVal.str()); + return strtod(fResult.strVal.str(), NULL); // FIXME: ??? case CalpontSystemCatalog::VARBINARY: @@ -867,7 +884,8 @@ inline double TreeNode::getDoubleVal() if (fResultType.colWidth <= 7) return strtod((char*)(&fResult.origIntVal), NULL); - return strtod(fResult.strVal.c_str(), NULL); + //idbassert(fResult.strVal.str()); + return strtod(fResult.strVal.safeString("").c_str(), NULL); case CalpontSystemCatalog::BIGINT: case CalpontSystemCatalog::TINYINT: @@ -920,13 +938,15 @@ inline long double TreeNode::getLongDoubleVal() if (fResultType.colWidth <= 8) return strtold((char*)(&fResult.origIntVal), NULL); - return strtold(fResult.strVal.c_str(), NULL); + idbassert(fResult.strVal.str()); + return strtold(fResult.strVal.str(), NULL); case CalpontSystemCatalog::VARCHAR: if (fResultType.colWidth <= 7) return strtold((char*)(&fResult.origIntVal), NULL); - return strtold(fResult.strVal.c_str(), NULL); + idbassert(fResult.strVal.str()); + return strtold(fResult.strVal.str(), NULL); // FIXME: ??? case CalpontSystemCatalog::VARBINARY: @@ -935,7 +955,8 @@ inline long double TreeNode::getLongDoubleVal() if (fResultType.colWidth <= 7) return strtold((char*)(&fResult.origIntVal), NULL); - return strtold(fResult.strVal.c_str(), NULL); + idbassert(fResult.strVal.str()); + return strtold(fResult.strVal.str(), NULL); case CalpontSystemCatalog::BIGINT: case CalpontSystemCatalog::TINYINT: diff --git a/dbcon/execplan/windowfunctioncolumn.cpp b/dbcon/execplan/windowfunctioncolumn.cpp index 1efb2e746..d5ab9647f 100644 --- a/dbcon/execplan/windowfunctioncolumn.cpp +++ b/dbcon/execplan/windowfunctioncolumn.cpp @@ -522,15 +522,18 @@ void WindowFunctionColumn::evaluate(Row& row, bool& isNull) // fallthrough default: { - const auto str = row.getConstString(fInputIndex); - if (str.eq(utils::ConstString(CPNULLSTRMARK))) + const auto str = row.getStringField(fInputIndex); + if (str.isNull()) + { isNull = true; + fResult.strVal.dropString(); + } else - fResult.strVal = str.toString(); + fResult.strVal.assign(str.unsafeStringRef()); // stringColVal is padded with '\0' to colWidth so can't use str.length() - if (strlen(fResult.strVal.c_str()) == 0) - isNull = true; + //if (strlen(fResult.strVal.str()) == 0) + // isNull = true; break; } diff --git a/dbcon/execplan/windowfunctioncolumn.h b/dbcon/execplan/windowfunctioncolumn.h index a6b4b6f17..67f90e885 100644 --- a/dbcon/execplan/windowfunctioncolumn.h +++ b/dbcon/execplan/windowfunctioncolumn.h @@ -189,10 +189,13 @@ class WindowFunctionColumn : public ReturnedColumn * F&E framework * ***********************************************************/ public: - virtual const std::string& getStrVal(rowgroup::Row& row, bool& isNull) override + using TreeNode::getStrVal; + virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override { - evaluate(row, isNull); - return TreeNode::getStrVal(fTimeZone); + bool localIsNull = false; + evaluate(row, localIsNull); + isNull = isNull || localIsNull; + return localIsNull ? fResult.strVal.dropString() : TreeNode::getStrVal(fTimeZone); } virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override diff --git a/dbcon/joblist/crossenginestep.cpp b/dbcon/joblist/crossenginestep.cpp index 5f2fa3f5e..bf52df648 100644 --- a/dbcon/joblist/crossenginestep.cpp +++ b/dbcon/joblist/crossenginestep.cpp @@ -161,9 +161,9 @@ void CrossEngineStep::setField(int i, const char* value, unsigned long length, M row.getColumnWidth(i) > 8) { if (value != NULL) - row.setStringField(value, i); + row.setStringField((const uint8_t*)value, length, i); else - row.setStringField("", i); + row.setStringField(nullptr, 0, i); } else if ((colType == CalpontSystemCatalog::BLOB) || (colType == CalpontSystemCatalog::TEXT) || (colType == CalpontSystemCatalog::VARBINARY)) @@ -196,7 +196,8 @@ void CrossEngineStep::setField(int i, const char* value, unsigned long length, M ct.precision = row.getPrecision(i); } - row.setIntField(convertValueNum(value, ct), i); + int64_t v = convertValueNum(value, ct); + row.setIntField(v, i); } } @@ -223,9 +224,8 @@ T CrossEngineStep::convertValueNum(const char* str, const CalpontSystemCatalog:: T rv = 0; bool pushWarning = false; bool nullFlag = (str == NULL); - boost::any anyVal = - ct.convertColumnData((nullFlag ? "" : str), pushWarning, fTimeZone, nullFlag, true, false); - + boost::any anyVal; + anyVal = ct.convertColumnData((nullFlag ? "" : str), pushWarning, fTimeZone, nullFlag, true, false); // Out of range values are treated as NULL as discussed during design review. if (pushWarning) { @@ -302,10 +302,17 @@ T CrossEngineStep::convertValueNum(const char* str, const CalpontSystemCatalog:: case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::CLOB: { - std::string i = boost::any_cast(anyVal); - // bug 1932, pad nulls up to the size of v - i.resize(sizeof(rv), 0); - rv = *((uint64_t*)i.data()); + if (nullFlag) + { + rv = joblist::CHAR8NULL; // SZ: I hate that. + } + else + { + std::string i = boost::any_cast(anyVal); + // bug 1932, pad nulls up to the size of v + i.resize(sizeof(rv), 0); + rv = *((uint64_t*)i.data()); + } } break; diff --git a/dbcon/joblist/elementcompression.h b/dbcon/joblist/elementcompression.h index 091e9a7db..189ff1230 100644 --- a/dbcon/joblist/elementcompression.h +++ b/dbcon/joblist/elementcompression.h @@ -351,11 +351,17 @@ template /* static */ inline void ElementCompression::writeWith32Rid(const StringElementType& e, std::fstream& fFile) { uint32_t rid = e.first; - uint16_t dlen = e.second.length(); fFile.write((char*)&rid, sizeof(rid)); - fFile.write((char*)&dlen, sizeof(dlen)); - fFile.write(e.second.c_str(), dlen); + uint8_t isNull = e.second.isNull(); + fFile.write((char*)(&isNull), sizeof(isNull)); + if (!isNull) + { + idbassert(e.second.length() < 32768); + uint16_t dlen = e.second.length(); + fFile.write((char*)&dlen, sizeof(dlen)); + fFile.write(e.second.str(), dlen); + } } /* static */ inline void ElementCompression::writeWith32Rid(const RIDElementType& e, std::fstream& fFile) @@ -380,15 +386,25 @@ template /* static */ inline void ElementCompression::readWith32Rid(StringElementType& e, std::fstream& fFile) { uint32_t rid = 0; - uint16_t dlen = 0; - char d[32768]; fFile.read((char*)&rid, sizeof(rid)); - fFile.read((char*)&dlen, sizeof(dlen)); - fFile.read(d, dlen); - e.first = rid; - e.second.assign(d, dlen); + + uint8_t isNull; + fFile.read((char*)(&isNull), sizeof(isNull)); + if (isNull) + { + e.second.dropString(); + } + else + { + uint16_t dlen = 0; + char d[32768]; + fFile.read((char*)&dlen, sizeof(dlen)); + fFile.read(d, dlen); + e.second.assign((const uint8_t*)d, dlen); + } + } /* static */ inline void ElementCompression::readWith32Rid(RIDElementType& e, std::fstream& fFile) diff --git a/dbcon/joblist/elementtype.cpp b/dbcon/joblist/elementtype.cpp index 61134a83b..bc6513b82 100644 --- a/dbcon/joblist/elementtype.cpp +++ b/dbcon/joblist/elementtype.cpp @@ -64,20 +64,73 @@ ostream& operator<<(ostream& out, const ElementType& rhs) return out; } +static ostream& writeRid(std::ostream& out, const uint64_t& rhs) +{ + out.write((const char*) (&rhs), sizeof(rhs)); + return out; +} + +std::istream& operator >>(std::istream& in, utils::NullString& ns) +{ + uint8_t isNull; + in.read((char*)(&isNull), sizeof(isNull)); + if (!isNull) + { + uint16_t len; + char t[32768]; + in.read((char*)(&len), sizeof(len)); + in.read(t, len); + ns.assign((const uint8_t*)t, len); + } + else + { + ns.dropString(); + } + return in; +} + +std::ostream& operator <<(std::ostream& out, const utils::NullString& ns) +{ + uint8_t isNull = ns.isNull(); + out.write((char*)(&isNull), sizeof(isNull)); + if (!isNull) + { + idbassert(ns.length() < 32768); + uint16_t len = ns.length(); + out.write((char*)(&len), sizeof(len)); + out.write(ns.str(), ns.length()); + } + return out; +} + +// XXX: somewhat hacky. there's an operator with unknown/unneccessarily complex semantics, so I invented mine's, with +// slightly different types. +static istream& readRid(std::istream& in, uint64_t& rhs) +{ + in.read((char*)(&rhs), sizeof(rhs)); + return in; +} + ostream& operator<<(std::ostream& out, const StringElementType& rhs) { +#if 0 uint64_t r = rhs.first; int16_t dlen = rhs.second.length(); out.write((char*)&r, sizeof(r)); out.write((char*)&dlen, sizeof(dlen)); out.write(rhs.second.c_str(), dlen); +#else + writeRid(out, rhs.first); + out << rhs.second; +#endif return out; } istream& operator>>(std::istream& out, StringElementType& rhs) { +#if 0 uint64_t r; int16_t dlen; char d[32768]; // atm 32k is the largest possible val for the length of strings stored @@ -88,6 +141,10 @@ istream& operator>>(std::istream& out, StringElementType& rhs) rhs.first = r; rhs.second = string(d, dlen); +#else + readRid(out, rhs.first); + out >> rhs.second; +#endif return out; } diff --git a/dbcon/joblist/elementtype.h b/dbcon/joblist/elementtype.h index a91a1f062..944a85ad2 100644 --- a/dbcon/joblist/elementtype.h +++ b/dbcon/joblist/elementtype.h @@ -76,10 +76,10 @@ struct ElementType struct StringElementType { typedef uint64_t first_type; - typedef std::string second_type; + typedef utils::NullString second_type; uint64_t first; - std::string second; + utils::NullString second; StringElementType(); StringElementType(uint64_t f, const std::string& s); @@ -90,7 +90,7 @@ struct StringElementType { case 0: *len = sizeof(first); return (char*)&first; - case 1: *len = second.size(); return (char*)second.data(); + case 1: *len = second.length(); return (char*)second.str(); default: throw std::logic_error("StringElementType: invalid mode in getHashString()."); } diff --git a/dbcon/joblist/groupconcat.cpp b/dbcon/joblist/groupconcat.cpp index f56a22672..0535a9649 100644 --- a/dbcon/joblist/groupconcat.cpp +++ b/dbcon/joblist/groupconcat.cpp @@ -339,11 +339,6 @@ void GroupConcatAgUM::merge(const rowgroup::Row& inRow, int64_t i) fConcator->merge(gccAg->concator().get()); } -void GroupConcatAgUM::getResult(uint8_t* buff) -{ - fConcator->getResultImpl(fGroupConcat->fSeparator); -} - uint8_t* GroupConcatAgUM::getResult() { return fConcator->getResult(fGroupConcat->fSeparator); @@ -400,21 +395,22 @@ void GroupConcator::initialize(const rowgroup::SP_GroupConcat& gcc) // MCOL-901 This value comes from the Server and it is // too high(3MB) to allocate it for every instance. fGroupConcatLen = gcc->fSize; - fCurrentLength -= strlen(gcc->fSeparator.c_str()); + size_t sepSize = gcc->fSeparator.size(); + fCurrentLength -= sepSize; // XXX Yet I have to find out why spearator has c_str() as nullptr here. fTimeZone = gcc->fTimeZone; fConstCols = gcc->fConstCols; - fConstantLen = strlen(gcc->fSeparator.c_str()); + fConstantLen = sepSize; for (uint64_t i = 0; i < fConstCols.size(); i++) - fConstantLen += strlen(fConstCols[i].first.c_str()); + fConstantLen += strlen(fConstCols[i].first.str()); } void GroupConcator::outputRow(std::ostringstream& oss, const rowgroup::Row& row) { const CalpontSystemCatalog::ColDataType* types = row.getColTypes(); vector::iterator i = fConcatColumns.begin(); - vector >::iterator j = fConstCols.begin(); + auto j = fConstCols.begin(); uint64_t groupColCount = fConcatColumns.size() + fConstCols.size(); @@ -422,7 +418,7 @@ void GroupConcator::outputRow(std::ostringstream& oss, const rowgroup::Row& row) { if (j != fConstCols.end() && k == j->second) { - oss << j->first; + oss << j->first.safeString(); j++; continue; } @@ -476,7 +472,7 @@ void GroupConcator::outputRow(std::ostringstream& oss, const rowgroup::Row& row) case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::TEXT: { - oss << row.getStringField(*i).c_str(); + oss << row.getStringField(*i).str(); break; } @@ -677,7 +673,7 @@ const string GroupConcator::toString() const oss << "GroupConcat size-" << fGroupConcatLen; oss << "Concat cols: "; vector::const_iterator i = fConcatColumns.begin(); - vector >::const_iterator j = fConstCols.begin(); + auto j = fConstCols.begin(); uint64_t groupColCount = fConcatColumns.size() + fConstCols.size(); for (uint64_t k = 0; k < groupColCount; k++) @@ -725,9 +721,12 @@ void GroupConcatOrderBy::initialize(const rowgroup::SP_GroupConcat& gcc) fSessionMemLimit = gcc->fSessionMemLimit; vector >::iterator i = gcc->fGroupCols.begin(); - while (i != gcc->fGroupCols.end()) - fConcatColumns.push_back((*(i++)).second); + { + auto x = (*i).second; + fConcatColumns.push_back(x); + i++; + } IdbOrderBy::initialize(gcc->fRowGroup); } @@ -878,6 +877,7 @@ uint8_t* GroupConcatOrderBy::getResultImpl(const string& sep) size_t prevResultSize = 0; size_t rowsProcessed = 0; + bool isNull = true; while (rowStack.size() > 0) { if (addSep) @@ -888,6 +888,7 @@ uint8_t* GroupConcatOrderBy::getResultImpl(const string& sep) const OrderByRow& topRow = rowStack.top(); fRow0.setData(topRow.fData); outputRow(oss, fRow0); + isNull = false; rowStack.pop(); if (rowsProcessed >= fRowsPerRG) { @@ -903,11 +904,15 @@ uint8_t* GroupConcatOrderBy::getResultImpl(const string& sep) } } - return swapStreamWithStringAndReturnBuf(oss); + return swapStreamWithStringAndReturnBuf(oss, isNull); } -uint8_t* GroupConcator::swapStreamWithStringAndReturnBuf(ostringstream& oss) +uint8_t* GroupConcator::swapStreamWithStringAndReturnBuf(ostringstream& oss, bool isNull) { + if (isNull) { + outputBuf_.reset(); + return nullptr; + } int64_t resultSize = oss.str().size(); oss << '\0' << '\0'; outputBuf_.reset(new std::string(std::move(*oss.rdbuf()).str())); @@ -983,6 +988,7 @@ void GroupConcatNoOrder::initialize(const rowgroup::SP_GroupConcat& gcc) cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__; throw IDBExcept(fErrorCode); } + fMemSize += newSize; fData.reinit(fRowGroup, fRowsPerRG); @@ -1046,9 +1052,11 @@ uint8_t* GroupConcatNoOrder::getResultImpl(const string& sep) { ostringstream oss; bool addSep = false; + fDataQueue.push(fData); size_t prevResultSize = 0; + bool isNull = true; while (fDataQueue.size() > 0) { fRowGroup.setData(&fDataQueue.front()); @@ -1062,6 +1070,7 @@ uint8_t* GroupConcatNoOrder::getResultImpl(const string& sep) addSep = true; outputRow(oss, fRow); + isNull = false; fRow.nextRow(); } size_t sizeDiff = oss.str().size() - prevResultSize; @@ -1075,7 +1084,7 @@ uint8_t* GroupConcatNoOrder::getResultImpl(const string& sep) fDataQueue.pop(); } - return swapStreamWithStringAndReturnBuf(oss); + return swapStreamWithStringAndReturnBuf(oss, isNull); } const string GroupConcatNoOrder::toString() const diff --git a/dbcon/joblist/groupconcat.h b/dbcon/joblist/groupconcat.h index d6a972470..dce8306dc 100644 --- a/dbcon/joblist/groupconcat.h +++ b/dbcon/joblist/groupconcat.h @@ -84,7 +84,6 @@ class GroupConcatAgUM : public rowgroup::GroupConcatAg return fConcator; } - EXPORT void getResult(uint8_t*); EXPORT uint8_t* getResult(); protected: @@ -109,7 +108,7 @@ class GroupConcator virtual void merge(GroupConcator*) = 0; virtual uint8_t* getResultImpl(const std::string& sep) = 0; virtual uint8_t* getResult(const std::string& sep); - virtual uint8_t* swapStreamWithStringAndReturnBuf(ostringstream& oss); + uint8_t* swapStreamWithStringAndReturnBuf(ostringstream& oss, bool isNull); virtual const std::string toString() const; @@ -119,7 +118,7 @@ class GroupConcator virtual int64_t lengthEstimate(const rowgroup::Row&); std::vector fConcatColumns; - std::vector > fConstCols; + std::vector > fConstCols; int64_t fCurrentLength; int64_t fGroupConcatLen; int64_t fConstantLen; @@ -140,6 +139,7 @@ class GroupConcatNoOrder : public GroupConcator void merge(GroupConcator*); using GroupConcator::getResult; uint8_t* getResultImpl(const std::string& sep); + //uint8_t* getResult(const std::string& sep); const std::string toString() const; @@ -171,6 +171,7 @@ class GroupConcatOrderBy : public GroupConcator, public ordering::IdbOrderBy void merge(GroupConcator*); using GroupConcator::getResult; uint8_t* getResultImpl(const std::string& sep); + //uint8_t* getResult(const std::string& sep); const std::string toString() const; diff --git a/dbcon/joblist/jlf_execplantojoblist.cpp b/dbcon/joblist/jlf_execplantojoblist.cpp index 58b70f5ea..84f898a65 100644 --- a/dbcon/joblist/jlf_execplantojoblist.cpp +++ b/dbcon/joblist/jlf_execplantojoblist.cpp @@ -276,7 +276,7 @@ template void convertValueNum(const string& str, const CalpontSystemCatalog::ColType& ct, bool isNull, uint8_t& rf, const long timeZone, T& v) { - if (str.size() == 0 || isNull) + if (isNull) { valueNullNum(ct, timeZone, v); return; @@ -1486,7 +1486,8 @@ bool optimizeIdbPatitionSimpleFilter(SimpleFilter* sf, JobStepVector& jsv, JobIn // make sure the cc has 3 tokens vector cv; - boost::split(cv, cc->constval(), boost::is_any_of(".")); + auto str = cc->constval().safeString(""); + boost::split(cv, str, boost::is_any_of(".")); if (cv.size() != 3) return false; @@ -1555,13 +1556,13 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) else if (sc->schemaName().empty()) { // bug 3749, mark outer join table with isNull filter - if (ConstantColumn::NULLDATA == cc->type() && (opis == *sop || opisnull == *sop)) + if (cc->isNull() && (opis == *sop || opisnull == *sop)) jobInfo.tableHasIsNull.insert(getTableKey(jobInfo, tbl_oid, alias, "", view)); return doExpressionFilter(sf, jobInfo); } - string constval(cc->constval()); + utils::NullString constval(cc->constval()); CalpontSystemCatalog::OID dictOid = 0; CalpontSystemCatalog::ColType ct = sc->colType(); @@ -1577,7 +1578,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) // X //@bug 339 nulls are not stored in dictionary - if ((dictOid = isDictCol(ct)) > 0 && ConstantColumn::NULLDATA != cc->type()) + if ((dictOid = isDictCol(ct)) > 0 && !cc->isNull()) { if (jobInfo.trace) cout << "Emit pTokenByScan/pCol for SimpleColumn op ConstantColumn" << endl; @@ -1603,7 +1604,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) pds->cardinality(sc->cardinality()); // Add the filter - pds->addFilter(cop, constval); + pds->addFilter(cop, constval.safeString("")); // data list for pcolstep output AnyDataListSPtr spdl1(new AnyDataList()); @@ -1666,7 +1667,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) pds->cardinality(sc->cardinality()); // Add the filter - pds->addFilter(cop, constval); + pds->addFilter(cop, constval.safeString("")); // save for expression transformation pds->addFilter(sf); @@ -1736,7 +1737,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) jsv.push_back(sjstep); } } - else if (ConstantColumn::NULLDATA != cc->type() && (cop & COMPARE_LIKE)) // both like and not like + else if (!cc->isNull() && (cop & COMPARE_LIKE)) // both like and not like { return doExpressionFilter(sf, jobInfo); } @@ -1752,8 +1753,8 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) // throwing try { - bool isNull = ConstantColumn::NULLDATA == cc->type(); - convertValueNum(constval, ct, isNull, rf, jobInfo.timeZone, value); + bool isNull = cc->isNull(); + convertValueNum(constval.safeString(""), ct, isNull, rf, jobInfo.timeZone, value); if (ct.colDataType == CalpontSystemCatalog::FLOAT && !isNull) { @@ -1789,12 +1790,12 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) } #else - bool isNull = ConstantColumn::NULLDATA == cc->type(); + bool isNull = cc->isNull(); if (ct.isWideDecimalType()) - convertValueNum(constval, ct, isNull, rf, jobInfo.timeZone, value128); + convertValueNum(constval.safeString(""), ct, isNull, rf, jobInfo.timeZone, value128); else - convertValueNum(constval, ct, isNull, rf, jobInfo.timeZone, value); + convertValueNum(constval.safeString(""), ct, isNull, rf, jobInfo.timeZone, value); if (ct.colDataType == CalpontSystemCatalog::FLOAT && !isNull) { @@ -1810,12 +1811,12 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) #endif // @bug 2584, make "= null" to COMPARE_NIL. - if (ConstantColumn::NULLDATA == cc->type() && (opeq == *sop || opne == *sop)) + if (cc->isNull() && (opeq == *sop || opne == *sop)) cop = COMPARE_NIL; if (jobInfo.trace) cout << "doSimpleFilter Emit pCol for SimpleColumn op ConstantColumn = " << value << " (" - << cc->constval() << ')' << endl; + << cc->constval().safeString() << ')' << endl; if (sf->indexFlag() == 0) { @@ -1855,7 +1856,7 @@ const JobStepVector doSimpleFilter(SimpleFilter* sf, JobInfo& jobInfo) jobInfo.tokenOnly[ti.key] = true; } - if (ConstantColumn::NULLDATA == cc->type() && (opis == *sop || opisnull == *sop)) + if (cc->isNull() && (opis == *sop || opisnull == *sop)) jobInfo.tableHasIsNull.insert(getTableKey(jobInfo, tbl_oid, alias, sc->schemaName(), view)); } else @@ -2699,10 +2700,10 @@ const JobStepVector doConstantFilter(const ConstantFilter* cf, JobInfo& jobInfo) int8_t cop = op2num(sop); // @bug 2584, make "= null" to COMPARE_NIL. - if (ConstantColumn::NULLDATA == cc->type() && (opeq == *sop || opne == *sop)) + if (cc->isNull() && (opeq == *sop || opne == *sop)) cop = COMPARE_NIL; - string value = cc->constval(); + string value = cc->constval().safeString(""); // Because, on a filter, we want to compare ignoring trailing spaces boost::algorithm::trim_right_if(value, boost::is_any_of(" ")); @@ -2783,10 +2784,10 @@ const JobStepVector doConstantFilter(const ConstantFilter* cf, JobInfo& jobInfo) int8_t cop = op2num(sop); // @bug 2584, make "= null" to COMPARE_NIL. - if (ConstantColumn::NULLDATA == cc->type() && (opeq == *sop || opne == *sop)) + if (cc->isNull() && (opeq == *sop || opne == *sop)) cop = COMPARE_NIL; - string value = cc->constval(); + string value = cc->constval().safeString(""); // Because, on a filter, we want to compare ignoring trailing spaces boost::algorithm::trim_right_if(value, boost::is_any_of(" ")); @@ -2894,11 +2895,11 @@ const JobStepVector doConstantFilter(const ConstantFilter* cf, JobInfo& jobInfo) int8_t cop = op2num(sop); int64_t value = 0; int128_t value128 = 0; - string constval = cc->constval(); + string constval = cc->constval().safeString(""); // @bug 1151 string longer than colwidth of char/varchar. uint8_t rf = 0; - bool isNull = ConstantColumn::NULLDATA == cc->type(); + bool isNull = cc->isNull(); if (ct.isWideDecimalType()) convertValueNum(constval, ct, isNull, rf, jobInfo.timeZone, value128); @@ -2917,7 +2918,7 @@ const JobStepVector doConstantFilter(const ConstantFilter* cf, JobInfo& jobInfo) } // @bug 2584, make "= null" to COMPARE_NIL. - if (ConstantColumn::NULLDATA == cc->type() && (opeq == *sop || opne == *sop)) + if (cc->isNull() && (opeq == *sop || opne == *sop)) cop = COMPARE_NIL; if (ct.isWideDecimalType()) @@ -2982,7 +2983,8 @@ const JobStepVector doFunctionFilter(const ParseTree* n, JobInfo& jobInfo) if (cc) { vector cv; - boost::split(cv, cc->constval(), boost::is_any_of(".")); + auto str = cc->constval().safeString(""); + boost::split(cv, str, boost::is_any_of(".")); if (cv.size() == 3) { @@ -3034,7 +3036,7 @@ const JobStepVector doFunctionFilter(const ParseTree* n, JobInfo& jobInfo) if (cc) { - constParms[0].push_back(cc->constval()); + constParms[0].push_back(cc->constval().safeString("")); constParmsCount++; } } diff --git a/dbcon/joblist/jlf_subquery.cpp b/dbcon/joblist/jlf_subquery.cpp index 0ea66ac0f..f32fcaa23 100644 --- a/dbcon/joblist/jlf_subquery.cpp +++ b/dbcon/joblist/jlf_subquery.cpp @@ -155,7 +155,7 @@ void getColumnValue(ConstantColumn** cc, uint64_t i, const Row& row, const long case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::BLOB: - oss << (char*)(row.getStringField(i).c_str()); + oss << (char*)(row.getStringField(i).str()); *cc = new ConstantColumn(oss.str()); break; @@ -508,8 +508,7 @@ const SRCP doSelectSubquery(CalpontExecutionPlan* ep, SRCP& sc, JobInfo& jobInfo // Empty set or null value if (cc == NULL) { - cc = new ConstantColumn(""); - cc->type(ConstantColumn::NULLDATA); + cc = new ConstantColumn("", ConstantColumn::NULLDATA); } rc.reset(cc); diff --git a/dbcon/joblist/jsonarrayagg.cpp b/dbcon/joblist/jsonarrayagg.cpp index dd59af021..1eae3f04f 100644 --- a/dbcon/joblist/jsonarrayagg.cpp +++ b/dbcon/joblist/jsonarrayagg.cpp @@ -332,11 +332,6 @@ void JsonArrayAggregatAgUM::merge(const rowgroup::Row& inRow, int64_t i) fConcator->merge(gccAg->concator().get()); } -void JsonArrayAggregatAgUM::getResult(uint8_t* buff) -{ - fConcator->getResultImpl(fGroupConcat->fSeparator); -} - uint8_t* JsonArrayAggregatAgUM::getResult() { return fConcator->getResult(fGroupConcat->fSeparator); @@ -397,14 +392,14 @@ void JsonArrayAggregator::initialize(const rowgroup::SP_GroupConcat& gcc) fConstantLen = strlen(gcc->fSeparator.c_str()); for (uint64_t i = 0; i < fConstCols.size(); i++) - fConstantLen += strlen(fConstCols[i].first.c_str()); + fConstantLen += fConstCols[i].first.length(); } void JsonArrayAggregator::outputRow(std::ostringstream& oss, const rowgroup::Row& row) { const CalpontSystemCatalog::ColDataType* types = row.getColTypes(); vector::iterator i = fConcatColumns.begin(); - vector >::iterator j = fConstCols.begin(); + vector >::iterator j = fConstCols.begin(); uint64_t groupColCount = fConcatColumns.size() + fConstCols.size(); @@ -412,7 +407,7 @@ void JsonArrayAggregator::outputRow(std::ostringstream& oss, const rowgroup::Row { if (j != fConstCols.end() && k == j->second) { - oss << j->first; + oss << j->first.safeString(""); // XXX: NULLs??? j++; continue; } @@ -466,7 +461,7 @@ void JsonArrayAggregator::outputRow(std::ostringstream& oss, const rowgroup::Row case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::TEXT: { - std::string maybeJson = row.getStringField(*i); + std::string maybeJson = row.getStringField(*i).safeString(""); // XXX: NULL??? it is not checked anywhere. [[maybe_unused]] const auto j = json::parse(maybeJson, nullptr, false); if (j.is_discarded()) { @@ -676,7 +671,7 @@ const string JsonArrayAggregator::toString() const oss << "JsonArray size-" << fGroupConcatLen; oss << "Concat cols: "; vector::const_iterator i = fConcatColumns.begin(); - vector >::const_iterator j = fConstCols.begin(); + auto j = fConstCols.begin(); uint64_t groupColCount = fConcatColumns.size() + fConstCols.size(); for (uint64_t k = 0; k < groupColCount; k++) @@ -892,7 +887,7 @@ uint8_t* JsonArrayAggOrderBy::getResultImpl(const string&) oss << ']'; } - return swapStreamWithStringAndReturnBuf(oss); + return swapStreamWithStringAndReturnBuf(oss, false); } const string JsonArrayAggOrderBy::toString() const @@ -1035,7 +1030,7 @@ uint8_t* JsonArrayAggNoOrder::getResultImpl(const string&) } oss << ']'; } - return swapStreamWithStringAndReturnBuf(oss); + return swapStreamWithStringAndReturnBuf(oss, false); } const string JsonArrayAggNoOrder::toString() const diff --git a/dbcon/joblist/largehashjoin.cpp b/dbcon/joblist/largehashjoin.cpp deleted file mode 100644 index cad81a30f..000000000 --- a/dbcon/joblist/largehashjoin.cpp +++ /dev/null @@ -1,1147 +0,0 @@ -/* Copyright (C) 2014 InfiniDB, Inc. - Copyright (C) 2016 MariaDB Corporation - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 of - the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301, USA. */ - -// $Id: largehashjoin.cpp 9655 2013-06-25 23:08:13Z xlou $ -#include -#include -#include -#include -#include -#include -#include -using namespace std; - -#include - -#include "calpontsystemcatalog.h" -using namespace execplan; - -#include "jobstep.h" -#include "largehashjoin.h" -#include "elementtype.h" -using namespace joblist; - -#include "mcsconfig.h" - -boost::mutex fileLock_g; - -namespace -{ -void logDiskIoInfo(uint64_t stepId, const AnyDataListSPtr& spdl) -{ - boost::mutex::scoped_lock lk(fileLock_g); - string umDiskioLog = string(MCSLOGDIR) + "/trace/umdiskio.log"; - string umDiskioBak = string(MCSLOGDIR) + "/trace/umdiskio.bak"; - - ofstream umDiskIoFile(umDiskioLog.c_str(), ios_base::app); - - CalpontSystemCatalog::OID oid; - uint64_t maxBuckets = 0; - list* infoList = NULL; - string bkt("bkt"); - BucketDL* bdl = spdl->bucketDL(); - BucketDL* sbdl = spdl->stringBucketDL(); - ZDL* zdl = spdl->zonedDL(); - ZDL* szdl = spdl->stringZonedDL(); - - if (bdl != NULL) - { - maxBuckets = bdl->bucketCount(); - oid = bdl->OID(); - } - else if (zdl != NULL) - { - maxBuckets = zdl->bucketCount(); - oid = zdl->OID(); - bkt = "zdl"; - } - else if (sbdl != NULL) - { - maxBuckets = sbdl->bucketCount(); - oid = sbdl->OID(); - } - else if (szdl != NULL) - { - maxBuckets = szdl->bucketCount(); - oid = szdl->OID(); - bkt = "zdl"; - } - else - { - // not logged for now. - return; - } - - for (uint64_t i = 0; i < maxBuckets; i++) - { - if (bdl) - infoList = &(bdl->diskIoInfoList(i)); - else if (zdl) - infoList = &(zdl->diskIoInfoList(i)); - else if (sbdl) - infoList = &(sbdl->diskIoInfoList(i)); - else if (szdl) - infoList = &(szdl->diskIoInfoList(i)); - - for (list::iterator j = infoList->begin(); j != infoList->end(); j++) - { - boost::posix_time::time_duration td = j->fEnd - j->fStart; - umDiskIoFile << setfill('0') << "st" << setw(2) << stepId << "oid" << oid << bkt << setw(3) << i - << (j->fWrite ? " writes " : " reads ") << setw(7) << setfill(' ') << j->fBytes - << " bytes, at " << j->fStart << " duration " << td.total_microseconds() << " mcs @ " - << (j->fBytes / td.total_microseconds()) << "MB/s" << endl; - } - } - - streampos curPos = umDiskIoFile.tellp(); - umDiskIoFile.close(); - - // move the current file to bak when size above .5 G, so total log is 1 G - if (curPos > 0x20000000) - { - string cmd = "/bin/mv " + umDiskioLog + " " + umDiskioBak; - (void)system(cmd.c_str()); - } -} - -} // namespace - -namespace joblist -{ -const uint64_t ZDL_VEC_SIZE = 4096; -//@bug 686. Make hashjoin doing jobs in seperate thread and return to main immediately. -// So the other job steps can start. -struct HJRunner -{ - HJRunner(LargeHashJoin* p) : joiner(p) - { - } - LargeHashJoin* joiner; - void operator()() - { - try - { - joiner->doHashJoin(); - } - catch (std::exception& e) - { - ostringstream errMsg; - errMsg << "HJRunner caught: " << e.what(); - joiner->errorLogging(errMsg.str()); - joiner->unblockDatalists(logging::largeHashJoinErr); - } - catch (...) - { - string msg("HJRunner caught something not an exception!"); - joiner->errorLogging(msg); - joiner->unblockDatalists(logging::largeHashJoinErr); - } - } -}; - -struct StringHJRunner -{ - StringHJRunner(StringHashJoinStep* p) : joiner(p) - { - } - StringHashJoinStep* joiner; - void operator()() - { - try - { - joiner->doStringHashJoin(); - } - catch (std::exception& e) - { - ostringstream errMsg; - errMsg << "StringHJRunner caught: " << e.what(); - joiner->errorLogging(errMsg.str()); - joiner->unblockDatalists(logging::stringHashJoinStepErr); - } - catch (...) - { - string msg("StringHJRunner caught something not an exception!"); - joiner->errorLogging(msg); - joiner->unblockDatalists(logging::stringHashJoinStepErr); - } - } -}; - -// Thread function used by HashJoin -// -template -void* HashJoinByBucket_thr(void* arg) -{ - typename HashJoin::thrParams_t* params = (typename HashJoin::thrParams_t*)arg; - HashJoin* hjPtr = params->hjptr; - const uint32_t thrIdx = params->thrIdx; - long set1Size = 0; - long set2Size = 0; - bool sendAllHashSet = false; - bool sendAllSearchSet = false; - - try - { - for (uint32_t idx = 0, bucketIdx = params->startBucket; idx < params->numBuckets; idx++, bucketIdx++) - { -#ifdef DEBUG - cout << "\tJoinByBucket() thr " << dec << thrIdx << " bkt " << bucketIdx << "/" - << hjPtr->Set1()->bucketCount() << "/" << params->numBuckets << endl; -#endif - - JoinType joinType = hjPtr->getJoinType(); - - set1Size = hjPtr->Set1()->size(bucketIdx); - set2Size = hjPtr->Set2()->size(bucketIdx); - - if (set1Size <= 0 && set2Size <= 0) - { - continue; - } - else - { - if (set1Size > set2Size) - { - hjPtr->setSearchSet(hjPtr->Set1()->getBDL(), thrIdx); - hjPtr->setHashSet(hjPtr->Set2()->getBDL(), thrIdx); - hjPtr->setSearchResult(hjPtr->Result1(), thrIdx); - hjPtr->setHashResult(hjPtr->Result2(), thrIdx); - sendAllHashSet = (joinType == RIGHTOUTER); - sendAllSearchSet = (joinType == LEFTOUTER); - } - else - { - hjPtr->setHashSet(hjPtr->Set1()->getBDL(), thrIdx); - hjPtr->setSearchSet(hjPtr->Set2()->getBDL(), thrIdx); - hjPtr->setHashResult(hjPtr->Result1(), thrIdx); - hjPtr->setSearchResult(hjPtr->Result2(), thrIdx); - sendAllHashSet = (joinType == LEFTOUTER); - sendAllSearchSet = (joinType == RIGHTOUTER); - } // if set1Size > set2Size ... - - } // if set1Size <=0 . . . - - params->timeset.setTimer(createHashStr); - hjPtr->createHash(hjPtr->HashSet(thrIdx), hjPtr->HashTable(thrIdx), bucketIdx, sendAllHashSet, - hjPtr->HashResult(thrIdx), params->dlTimes, params->die); - params->timeset.holdTimer(createHashStr); - -#ifdef DEBUG - long hashSetTotal = 0; - long searchSetTotal = 0; - - for (uint32_t j = 0; j < hjPtr->HashSet(thrIdx)->bucketCount(); j++) - hashSetTotal += hjPtr->HashSet(thrIdx)->bucketCount(); // are bucketDL - - for (uint32_t j = 0; j < hjPtr->HashSet(thrIdx)->bucketCount(); j++) - searchSetTotal += hjPtr->SearchSet(thrIdx)->size(j); // can be any datalist - - cout << "\t\tJoinByBucket() thr " << dec << thrIdx << " bkt " << bucketIdx << " hashSize " - << hashSetTotal << " searchSize " << searchSetTotal << endl; -#endif - - bool more; - e_t e; - e_t e2; - const uint64_t InvalidRID = static_cast(-1); - int iter = hjPtr->SearchSet(thrIdx)->getIterator(bucketIdx); - - ZonedDL* zdl1 = dynamic_cast(hjPtr->SearchResult(thrIdx)); - ZonedDL* zdl2 = dynamic_cast(hjPtr->HashResult(thrIdx)); - vector vec1; - vector vec2; - - std::pair::hashIter_t, typename HashJoin::hashIter_t> hashItPair; - typename HashJoin::hashIter_t hashIt; - typename HashJoin::hash_t* ht = hjPtr->HashTable(thrIdx); - params->timeset.setTimer(hashJoinStr); - - for (more = hjPtr->SearchSet(thrIdx)->next(bucketIdx, iter, &e); more && !(*params->die); - more = hjPtr->SearchSet(thrIdx)->next(bucketIdx, iter, &e)) - { - // If sendAllSearchSet=true, keep all of the search set. If this is - // a right outer, we are dealing with a join such as - // col1 = col2 (+) - // where col1 is the SearchSet and col2 is the HashSet. We want to include - // all of col1 in this case regardless of whether there is a matching col2. - if (sendAllSearchSet) - { - if (zdl1) - { - vec1.push_back(e); - - if (vec1.size() >= ZDL_VEC_SIZE) - { - params->timeset.setTimer(insertResultsStr); - hjPtr->SearchResult(thrIdx)->insert(vec1); - vec1.clear(); - params->timeset.holdTimer(insertResultsStr); - } - } - else - hjPtr->SearchResult(thrIdx)->insert(e); - } - - hashIt = ht->find(e.second); - - if (hashIt != ht->end()) - { -#ifdef DEBUG - - if (hjPtr->SearchResult(thrIdx)->OID() >= 3000) - cout << "JoinByBucket() SearchResult add " << bucketIdx << " [" << e.first << "][" << e.second - << "]" << endl; - - uint32_t a = 0; - e_t b = e_t(); -#endif - - // If sendAllSearchSet=false, we already added the search result - // before the if condition above. - if (!sendAllSearchSet) - { - if (zdl1) - { - vec1.push_back(e); - - if (vec1.size() >= ZDL_VEC_SIZE) - { - params->timeset.setTimer(insertResultsStr); - hjPtr->SearchResult(thrIdx)->insert(vec1); - vec1.clear(); - params->timeset.holdTimer(insertResultsStr); - } - } - else - hjPtr->SearchResult(thrIdx)->insert(e); - } - - // If sendAllHashSet=false, add the hash results to the output datalist. - // If it is a left outer join then we already added all of the right side rows - // in the bucket in the createHash call earlier in this function. - if (!sendAllHashSet) - { - // If the matching pair has it's RID set to invalid, it's already been encountered, - // so no reason to add it to the output datalist or keep searching for more matching values. - if (hashIt->second != InvalidRID) - { - // If the matching pair has it's RID set to invalid, it's already been encountered, - hashItPair = ht->equal_range(e.second); - - for (hashIt = hashItPair.first; hashIt != hashItPair.second; hashIt++) - { - e2.first = hashIt->second; - e2.second = e.second; - - if (zdl2) - { - vec2.push_back(e2); - - if (vec2.size() >= ZDL_VEC_SIZE) - { - params->timeset.setTimer(insertResultsStr); - hjPtr->HashResult(thrIdx)->insert(vec2); - vec2.clear(); - params->timeset.holdTimer(insertResultsStr); - } - } - else - hjPtr->HashResult(thrIdx)->insert(e2); - -#ifdef DEBUG - a++; - b = v.second; -#endif - - // Set the RID to invalid rid now that it's been matched and added to the output datalist. - // This will keep us from duplicating it if it is matched again. - hashIt->second = InvalidRID; - } - -#ifdef DEBUG - cout << "\t\tadded " << b << " " << a << " times" << endl << endl; -#endif - } - } - - } // if hashIt != hashIt->end() - - } // for ( hjPtr... - - params->timeset.holdTimer(hashJoinStr); - - params->timeset.setTimer(insertLastResultsStr); - - if (vec1.size() != 0) - { - hjPtr->SearchResult(thrIdx)->insert(vec1); - vec1.clear(); - } - - if (vec2.size() != 0) - { - hjPtr->HashResult(thrIdx)->insert(vec2); - vec2.clear(); - } - - params->timeset.holdTimer(insertLastResultsStr); - - // typename HashJoin::hash_t* ht = hjPtr->HashTable(thrIdx); - ht->clear(); - - } // for (bucketIdx... - } // try - // We don't have to call JSA.endOfInput() for this exception, because - // the parent thread takes care of that in performThreadedJoin(). - catch (const logging::LargeDataListExcept& ex) - { - ostringstream errMsg; - - if (typeid(e_t) == typeid(StringElementType)) - { - errMsg << "HashJoinByBucket_thr: caught LDL error: " << ex.what(); - hjPtr->status(logging::stringHashJoinStepLargeDataListFileErr); - } - else - { - errMsg << "HashJoinByBucket_thr: caught LDL error: " << ex.what(); - hjPtr->status(logging::largeHashJoinLargeDataListFileErr); - } - - cerr << errMsg.str() << endl; - catchHandler(errMsg.str(), hjPtr->sessionId()); - } - catch (const exception& ex) - { - ostringstream errMsg; - - if (typeid(e_t) == typeid(StringElementType)) - { - errMsg << "HashJoinByBucket_thr: caught: " << ex.what(); - hjPtr->status(logging::stringHashJoinStepErr); - } - else - { - errMsg << "HashJoinByBucket_thr: caught: " << ex.what(); - hjPtr->status(logging::largeHashJoinErr); - } - - cerr << errMsg.str() << endl; - catchHandler(errMsg.str(), hjPtr->sessionId()); - } - catch (...) - { - ostringstream errMsg; - - if (typeid(e_t) == typeid(StringElementType)) - { - errMsg << "HashJoinByBucket_thr: caught unknown exception: "; - hjPtr->status(logging::stringHashJoinStepErr); - } - else - { - errMsg << "HashJoinByBucket_thr: caught unknown exception"; - hjPtr->status(logging::largeHashJoinErr); - } - - cerr << errMsg.str() << endl; - catchHandler(errMsg.str(), hjPtr->sessionId()); - } - - return NULL; -} // HashJoinByBucket_thr - -LargeHashJoin::LargeHashJoin(JoinType joinType, uint32_t sessionId, uint32_t txnId, uint32_t statementId, - ResourceManager* rm) - : fSessionId(sessionId) - , fTxnId(txnId) - , fStepId(0) - , fStatementId(statementId) - , fTableOID1(0) - , fTableOID2(0) - , fJoinType(joinType) - , fRm(rm) - , fAlias1() - , fAlias2() -{ - // fConfig = config::Config::makeConfig(); - // fJoinType = joinType; -} - -LargeHashJoin::~LargeHashJoin() -{ - if (traceOn()) - { - for (uint64_t i = 0; i < fInputJobStepAssociation.outSize(); i++) - logDiskIoInfo(fStepId, fInputJobStepAssociation.outAt(i)); - - for (uint64_t i = 0; i < fOutputJobStepAssociation.outSize(); i++) - logDiskIoInfo(fStepId, fOutputJobStepAssociation.outAt(i)); - } -} - -void LargeHashJoin::join() -{ - runner->join(); -} - -void LargeHashJoin::run() -{ - if (traceOn()) - { - syslogStartStep(16, // exemgr subsystem - std::string("LargeHashJoin")); // step name - } - - runner.reset(new boost::thread(HJRunner(this))); -} - -void LargeHashJoin::unblockDatalists(uint16_t status) -{ - fOutputJobStepAssociation.status(status); - fOutputJobStepAssociation.outAt(0)->dataList()->endOfInput(); - fOutputJobStepAssociation.outAt(1)->dataList()->endOfInput(); -} - -void LargeHashJoin::errorLogging(const string& msg) const -{ - ostringstream errMsg; - errMsg << "Step " << stepId() << "; " << msg; - cerr << errMsg.str() << endl; - catchHandler(errMsg.str(), sessionId()); -} - -void LargeHashJoin::doHashJoin() -{ - string val; - - idbassert(fInputJobStepAssociation.outSize() >= 2); - idbassert(fOutputJobStepAssociation.outSize() >= 2); - BucketDataList* Ap = 0; - BucketDataList* Bp = 0; - BucketDataList* tAp = 0; - BucketDataList* tBp = 0; - DataList_t* inDL1 = 0; - DataList_t* inDL2 = 0; - inDL1 = fInputJobStepAssociation.outAt(0)->dataList(); - inDL2 = fInputJobStepAssociation.outAt(1)->dataList(); - idbassert(inDL1); - idbassert(inDL2); - - HashJoin* hj = 0; - double createWorkTime = 0; - double hashWorkTime = 0; - double insertWorkTime = 0; - DataList_t* resultA = fOutputJobStepAssociation.outAt(0)->dataList(); - DataList_t* resultB = fOutputJobStepAssociation.outAt(1)->dataList(); - - if (0 < fInputJobStepAssociation.status()) - { - unblockDatalists(fInputJobStepAssociation.status()); - } - else - { - string currentAction("preparing join"); - - try - { - // If we're given BucketDL's, use them - if (typeid(*inDL1) == typeid(BucketDataList)) - { - if (typeid(*inDL2) != typeid(BucketDataList)) - { - throw logic_error("LargeHashJoin::run: expected either 0 or 2 BucketDL's!"); - } - - Ap = dynamic_cast(inDL1); - Bp = dynamic_cast(inDL2); - } - else - { - throw logic_error("HashJoin will take only BucketDLs as inputs"); - int maxBuckets = fRm.getHjMaxBuckets(); - joblist::ridtype_t maxElems = fRm.getHjMaxElems(); - - BucketDataList* tAp = new BucketDataList(maxBuckets, 1, maxElems, fRm); - BucketDataList* tBp = new BucketDataList(maxBuckets, 1, maxElems, fRm); - tAp->setHashMode(1); - tBp->setHashMode(1); - - ElementType element; - int id; - - id = inDL1->getIterator(); - - while (inDL1->next(id, &element)) - { - tAp->insert(element); - } - - tAp->endOfInput(); - - id = inDL2->getIterator(); - - while (inDL2->next(id, &element)) - { - tBp->insert(element); - } - - tBp->endOfInput(); - - Ap = tAp; - Bp = tBp; - } - - unsigned numThreads = fRm.getHjNumThreads(); - - BDLWrapper setA(Ap); - BDLWrapper setB(Bp); - - hj = new HashJoin(setA, setB, resultA, resultB, fJoinType, &dlTimes, - fOutputJobStepAssociation.statusPtr(), sessionId(), &die); - - if (fTableOID2 >= 3000) - { - ostringstream logStr2; - logStr2 << "LargeHashJoin::run: ses:" << fSessionId << " st:" << fStepId - << " input sizes: " << setA.size() << "/" << setB.size() << endl; - cout << logStr2.str(); - } - - currentAction = "performing join"; - - if (fTableOID2 >= 3000) - { - dlTimes.setFirstReadTime(); - dlTimes.setEndOfInputTime(dlTimes.FirstReadTime()); - } - - hj->performJoin(numThreads); - - } // try - catch (const logging::LargeDataListExcept& ex) - { - ostringstream errMsg; - errMsg << __FILE__ << " doHashJoin: " << currentAction << ", caught LDL error: " << ex.what(); - errorLogging(errMsg.str()); - unblockDatalists(logging::largeHashJoinLargeDataListFileErr); - } - catch (const exception& ex) - { - ostringstream errMsg; - errMsg << __FILE__ << " doHashJoin: " << currentAction << ", caught: " << ex.what(); - errorLogging(errMsg.str()); - unblockDatalists(logging::largeHashJoinErr); - } - catch (...) - { - ostringstream errMsg; - errMsg << __FILE__ << " doHashJoin: " << currentAction << ", caught unknown exception"; - errorLogging(errMsg.str()); - unblockDatalists(logging::largeHashJoinErr); - } - - if (hj) - { - //..hashWorkTime is the time to perform the hashjoin excluding the - // the output insertion time. insertWorkTime is the sum or total - // of both insert times. The end result is that createWorkTime + - // hashWorkTime + insertWorkTime roughly equates to the total work - // time. - createWorkTime = hj->getTimeSet()->totalTime(createHashStr); - hashWorkTime = hj->getTimeSet()->totalTime(hashJoinStr) - hj->getTimeSet()->totalTime(insertResultsStr); - insertWorkTime = - hj->getTimeSet()->totalTime(insertResultsStr) + hj->getTimeSet()->totalTime(insertLastResultsStr); - } - - } // (fInputJobStepAssociation.status() == 0) - - if (fTableOID2 >= 3000 && traceOn()) - { - time_t finTime = time(0); - char finTimeString[50]; - ctime_r(&finTime, finTimeString); - finTimeString[strlen(finTimeString) - 1] = '\0'; - - ostringstream logStr; - logStr << "ses:" << fSessionId << " st: " << fStepId << " finished at " << finTimeString << "; 1st read " - << dlTimes.FirstReadTimeString() << "; EOI " << dlTimes.EndOfInputTimeString() << endl - << "\tLargeHashJoin::run: output sizes: " << resultA->totalSize() << "/" << resultB->totalSize() - << " run time: " << JSTimeStamp::tsdiffstr(dlTimes.EndOfInputTime(), dlTimes.FirstReadTime()) - << fixed << setprecision(2) << "s\n\tTotal work times: create hash: " << createWorkTime - << "s, hash join: " << hashWorkTime << "s, insert results: " << insertWorkTime << "s\n" - << "\tJob completion status " << fInputJobStepAssociation.status() << endl; - logEnd(logStr.str().c_str()); - - syslogProcessingTimes(16, // exemgr subsystem - dlTimes.FirstReadTime(), // use join start time for first read time - dlTimes.EndOfInputTime(), // use join end time for last read time - dlTimes.FirstReadTime(), // use join start time for first write time - dlTimes.EndOfInputTime()); // use join end time for last write time - syslogEndStep(16, // exemgr subsystem - 0, // no blocked datalist input to report - 0); // no blocked datalist output to report - } - - delete hj; - delete tAp; - delete tBp; -} - -const string LargeHashJoin::toString() const -{ - ostringstream oss; - CalpontSystemCatalog::OID oid1 = 0; - CalpontSystemCatalog::OID oid2 = 0; - DataList_t* dl1; - DataList_t* dl2; - size_t idlsz; - - idlsz = fInputJobStepAssociation.outSize(); - idbassert(idlsz == 2); - dl1 = fInputJobStepAssociation.outAt(0)->dataList(); - - if (dl1) - oid1 = dl1->OID(); - - dl2 = fInputJobStepAssociation.outAt(1)->dataList(); - - if (dl2) - oid2 = dl2->OID(); - - oss << "LargeHashJoin ses:" << fSessionId << " st:" << fStepId; - oss << omitOidInDL; - oss << " in tb/col1:" << fTableOID1 << "/" << oid1; - oss << " " << fInputJobStepAssociation.outAt(0); - oss << " in tb/col2:" << fTableOID2 << "/" << oid2; - oss << " " << fInputJobStepAssociation.outAt(1); - - idlsz = fOutputJobStepAssociation.outSize(); - idbassert(idlsz == 2); - dl1 = fOutputJobStepAssociation.outAt(0)->dataList(); - - if (dl1) - oid1 = dl1->OID(); - - dl2 = fOutputJobStepAssociation.outAt(1)->dataList(); - - if (dl2) - oid2 = dl2->OID(); - - oss << endl << " "; - oss << " out tb/col1:" << fTableOID1 << "/" << oid1; - oss << " " << fOutputJobStepAssociation.outAt(0); - oss << " out tb/col2:" << fTableOID2 << "/" << oid2; - oss << " " << fOutputJobStepAssociation.outAt(1) << endl; - - return oss.str(); -} - -StringHashJoinStep::StringHashJoinStep(JoinType joinType, uint32_t sessionId, uint32_t txnId, - uint32_t statementId, ResourceManager* rm) - : LargeHashJoin(joinType, sessionId, txnId, statementId, rm) -{ -} - -StringHashJoinStep::~StringHashJoinStep() -{ -} - -void StringHashJoinStep::run() -{ - if (traceOn()) - { - syslogStartStep(16, // exemgr subsystem - std::string("StringHashJoinStep")); // step name - } - - runner.reset(new boost::thread(StringHJRunner(this))); -} - -void StringHashJoinStep::doStringHashJoin() -{ - string val; - - idbassert(fInputJobStepAssociation.outSize() >= 2); - idbassert(fOutputJobStepAssociation.outSize() >= 2); - DataList* inDL1 = fInputJobStepAssociation.outAt(0)->stringDataList(); - DataList* inDL2 = fInputJobStepAssociation.outAt(1)->stringDataList(); - idbassert(inDL1); - idbassert(inDL2); - - BucketDL* Ap = 0; - BucketDL* Bp = 0; - BucketDL* tAp = 0; - BucketDL* tBp = 0; - - HashJoin* hj = 0; - double createWorkTime = 0; - double hashWorkTime = 0; - double insertWorkTime = 0; - DataList_t* resultA = fOutputJobStepAssociation.outAt(0)->dataList(); - DataList_t* resultB = fOutputJobStepAssociation.outAt(1)->dataList(); - struct timeval start_time; - gettimeofday(&start_time, 0); - struct timeval end_time = start_time; - ZonedDL* bdl1 = 0; - ZonedDL* bdl2 = 0; - - // result from hashjoinstep is expected to be BandedDataList - // but the HashJoin returns StringDataList - // also, the null is reported as "_CpNuLl_" by pDictionStep - // create two StringDataList for the intermediate result BDL - // @bug 721. use zdl. - StringZonedDL* dlA = new StringZonedDL(1, fRm); - dlA->setMultipleProducers(true); - StringZonedDL* dlB = new StringZonedDL(1, fRm); - dlB->setMultipleProducers(true); - - if (0 < fInputJobStepAssociation.status()) - { - unblockDatalists(fInputJobStepAssociation.status()); - } - else - { - string currentAction("preparing join"); - - try - { - // If we're given BucketDL's, use them - if (typeid(*inDL1) == typeid(BucketDL)) - { - if (typeid(*inDL2) != typeid(BucketDL)) - { - throw logic_error("StringHashJoinStep::run: expected either 0 or 2 BucketDL's!"); - } - - Ap = dynamic_cast*>(inDL1); - Bp = dynamic_cast*>(inDL2); - } - else - { - int maxBuckets = fRm.getHjMaxBuckets(); - joblist::ridtype_t maxElems = fRm.getHjMaxElems(); - - // int maxBuckets=4; - // joblist::ridtype_t maxElems=1024*8; - // val = fConfig->getConfig("HashJoin", "MaxBuckets"); // same as HashJoin - // if (val.size() > 0) - // maxBuckets = static_cast(config::Config::fromText(val)); - // if (maxBuckets <=0) - // maxBuckets=4; - // val = fConfig->getConfig("HashJoin", "MaxElems"); // same as HashJoin - // if (val.size() >0) - // maxElems = config::Config::uFromText(val); - // if (maxElems<=0) - // maxElems=1024*8; - - tAp = new BucketDL(maxBuckets, 1, maxElems, fRm); - tBp = new BucketDL(maxBuckets, 1, maxElems, fRm); - tAp->setHashMode(1); - tBp->setHashMode(1); - - StringElementType element; - int id = inDL1->getIterator(); - - while (inDL1->next(id, &element)) - { - tAp->insert(element); - } - - tAp->endOfInput(); - - id = inDL2->getIterator(); - - while (inDL2->next(id, &element)) - { - tBp->insert(element); - } - - tBp->endOfInput(); - - Ap = tAp; - Bp = tBp; - } - - unsigned numThreads = fRm.getHjNumThreads(); - // unsigned numThreads = 0; - // val = fConfig->getConfig("HashJoin", "NumThreads"); - // if (val.size() > 0) - // numThreads = static_cast(config::Config::uFromText(val)); - // if (numThreads <= 0) - // numThreads = 4; - - BDLWrapper setA(Ap); - BDLWrapper setB(Bp); - - HashJoin* hj = - new HashJoin(setA, setB, dlA, dlB, fJoinType, &dlTimes, - fOutputJobStepAssociation.statusPtr(), sessionId(), &die); - - if ((dlA == NULL) || (dlB == NULL) || (hj == NULL)) - { - ostringstream oss; - oss << "StringHashJoinStep::run() null pointer from new -- "; - oss << "StringDataList A(0x" << hex << (ptrdiff_t)dlA << "), B(0x" << (ptrdiff_t)dlB - << "), HashJoin hj(0x" << (ptrdiff_t)hj << ")"; - throw(runtime_error(oss.str().c_str())); - } - - // leave this in - if (fTableOID2 >= 3000) - { - ostringstream logStr2; - logStr2 << "StringHashJoinStep::run: ses:" << fSessionId << " st:" << fStepId - << " input sizes: " << setA.size() << "/" << setB.size() << endl; - cout << logStr2.str(); - } - - currentAction = "performing join"; - - if (fTableOID2 >= 3000) - { - dlTimes.setFirstReadTime(); - dlTimes.setEndOfInputTime(dlTimes.FirstReadTime()); - } - - hj->performJoin(numThreads); - - currentAction = "after join"; - - // convert from StringElementType to ElementType by grabbing the rid - // take _CpNuLl_ out of the result - StringElementType se; - ElementType e; - int id = dlA->getIterator(); - - bdl1 = dynamic_cast(resultA); - bdl2 = dynamic_cast(resultB); - vector v; - v.reserve(ZDL_VEC_SIZE); - - if (bdl1) - { - while (dlA->next(id, &se)) - { - if (se.second != CPNULLSTRMARK) - { - e.first = se.first; - v.push_back(e); - - if (v.size() >= ZDL_VEC_SIZE) - { - resultA->insert(v); - v.clear(); - } - } - } - - if (v.size() > 0) - resultA->insert(v); - - resultA->endOfInput(); - } - - else - { - while (dlA->next(id, &se)) - { - if (se.second != CPNULLSTRMARK) - { - e.first = se.first; - resultA->insert(e); - } - } - - resultA->endOfInput(); - } - - id = dlB->getIterator(); - - if (bdl2) - { - v.clear(); - - while (dlB->next(id, &se)) - { - if (se.second != CPNULLSTRMARK) - { - e.first = se.first; - v.push_back(e); - - if (v.size() >= ZDL_VEC_SIZE) - { - resultB->insert(v); - v.clear(); - } - } - } - - if (v.size() > 0) - resultB->insert(v); - - resultB->endOfInput(); - } - else - { - while (dlB->next(id, &se)) - { - if (se.second != CPNULLSTRMARK) - { - e.first = se.first; - resultB->insert(e); - } - } - - resultB->endOfInput(); - } - } // try - catch (const logging::LargeDataListExcept& ex) - { - ostringstream errMsg; - errMsg << __FILE__ << " doStringHashJoin: " << currentAction << ", caught LDL error: " << ex.what(); - errorLogging(errMsg.str()); - unblockDatalists(logging::stringHashJoinStepLargeDataListFileErr); - dlA->endOfInput(); - dlB->endOfInput(); - } - catch (const exception& ex) - { - ostringstream errMsg; - errMsg << __FILE__ << " doStringHashJoin: " << currentAction << ", caught: " << ex.what(); - errorLogging(errMsg.str()); - unblockDatalists(logging::stringHashJoinStepErr); - dlA->endOfInput(); - dlB->endOfInput(); - } - catch (...) - { - ostringstream errMsg; - errMsg << __FILE__ << " doStringHashJoin: " << currentAction << ", caught unknown exception"; - errorLogging(errMsg.str()); - unblockDatalists(logging::stringHashJoinStepErr); - dlA->endOfInput(); - dlB->endOfInput(); - } - - gettimeofday(&end_time, 0); - - if (fTableOID2 >= 3000) - dlTimes.setEndOfInputTime(); - - if (hj) - { - //..hashWorkTime is the time to perform the hashjoin excluding the - // the output insertion time. insertWorkTime is the sum or total - // of both insert times. The end result is that createWorkTime + - // hashWorkTime + insertWorkTime roughly equates to the total work - // time. - createWorkTime = hj->getTimeSet()->totalTime(createHashStr); - hashWorkTime = hj->getTimeSet()->totalTime(hashJoinStr) - hj->getTimeSet()->totalTime(insertResultsStr); - insertWorkTime = - hj->getTimeSet()->totalTime(insertResultsStr) + hj->getTimeSet()->totalTime(insertLastResultsStr); - } - - } // (fInputJobStepAssociation.status() == 0) - - if (fTableOID2 >= 3000 && traceOn()) - { - time_t finTime = time(0); - char finTimeString[50]; - ctime_r(&finTime, finTimeString); - finTimeString[strlen(finTimeString) - 1] = '\0'; - - ostringstream logStr; - logStr << "ses:" << fSessionId << " st: " << fStepId << " finished at " << finTimeString << "; 1st read " - << dlTimes.FirstReadTimeString() << "; EOI " << dlTimes.EndOfInputTimeString() << endl - << "\tStringHashJoinStep::run: output sizes: " << dlA->totalSize() << "/" << dlB->totalSize() - << " ["; - - if (bdl1 && bdl2) - logStr << bdl1->totalSize() << "/" << bdl2->totalSize(); - - logStr << "] run time: " << JSTimeStamp::tsdiffstr(dlTimes.EndOfInputTime(), dlTimes.FirstReadTime()) - << fixed << setprecision(2) << "s\n\tTotal work times: create hash: " << createWorkTime - << "s, hash join: " << hashWorkTime << "s, insert results: " << insertWorkTime << "s\n" - << "\tJob completion status " << fInputJobStepAssociation.status() << endl; - logEnd(logStr.str().c_str()); - - syslogProcessingTimes(16, // exemgr subsystem - start_time, // use join start time for first read time - end_time, // use join end time for last read time - start_time, // use join start time for first write time - end_time); // use join end time for last write time - syslogEndStep(16, // exemgr subsystem - 0, // no blocked datalist input to report - 0); // no blocked datalist output to report - } - - delete hj; - delete tAp; - delete tBp; - delete dlA; - delete dlB; -} - -const string StringHashJoinStep::toString() const -{ - ostringstream oss; - CalpontSystemCatalog::OID oid1 = 0; - CalpontSystemCatalog::OID oid2 = 0; - - size_t idlsz = fInputJobStepAssociation.outSize(); - idbassert(idlsz == 2); - DataList* dl1 = fInputJobStepAssociation.outAt(0)->stringDataList(); - - if (dl1) - oid1 = dl1->OID(); - - DataList* dl2 = fInputJobStepAssociation.outAt(1)->stringDataList(); - - if (dl2) - oid2 = dl2->OID(); - - oss << "StringHashJoinStep ses:" << fSessionId << " st:" << fStepId; - oss << omitOidInDL; - oss << " in tb/col1:" << fTableOID1 << "/" << oid1; - oss << " " << fInputJobStepAssociation.outAt(0); - oss << " in tb/col2:" << fTableOID2 << "/" << oid2; - oss << " " << fInputJobStepAssociation.outAt(1); - - idlsz = fOutputJobStepAssociation.outSize(); - idbassert(idlsz == 2); - DataList_t* dl3 = fOutputJobStepAssociation.outAt(0)->dataList(); - - if (dl3) - oid1 = dl3->OID(); - - DataList_t* dl4 = fOutputJobStepAssociation.outAt(1)->dataList(); - - if (dl4) - oid2 = dl4->OID(); - - oss << endl << " "; - oss << " out tb/col1:" << fTableOID1 << "/" << oid1; - oss << " " << fOutputJobStepAssociation.outAt(0); - oss << " out tb/col2:" << fTableOID2 << "/" << oid2; - oss << " " << fOutputJobStepAssociation.outAt(1); - - return oss.str(); -} - -} // namespace joblist diff --git a/dbcon/joblist/primitivemsg.h b/dbcon/joblist/primitivemsg.h index 1aeac576e..eb0c051d1 100644 --- a/dbcon/joblist/primitivemsg.h +++ b/dbcon/joblist/primitivemsg.h @@ -72,6 +72,9 @@ class StringComparator : public datatypes::Charset if (COP & COMPARE_LIKE) return like(COP & COMPARE_NOT, str1, str2); + if (COP == COMPARE_NULLEQ) + return str1.isNull() == str2.isNull(); // XXX: TODO: I do not know the logic here, so it is temporary solution. + int cmp = strnncollsp(str1, str2); switch (COP) @@ -575,6 +578,13 @@ struct DictTokenByIndexRequestHeader // DICT_TOKEN_BY_SCAN_COMPARE struct DataValue +{ + uint8_t isnull; + uint16_t len; + char data[]; +}; + +struct NonNullDataValue { uint16_t len; char data[]; diff --git a/dbcon/joblist/tablecolumn.cpp b/dbcon/joblist/tablecolumn.cpp index be20292c8..92d14b871 100644 --- a/dbcon/joblist/tablecolumn.cpp +++ b/dbcon/joblist/tablecolumn.cpp @@ -219,12 +219,12 @@ void TableColumn::unserialize(messageqcpp::ByteStream& b) } else if (columnType == STRING) { - fStrValues.reset(new std::vector()); + fStrValues.reset(new std::vector()); fStrValues->reserve(rowCount); - std::string value; for (uint32_t i = 0; i < rowCount; i++) { + NullString value; b >> value; // cout << "UN: " << value << endl; fStrValues->push_back(value); diff --git a/dbcon/joblist/tablecolumn.h b/dbcon/joblist/tablecolumn.h index 8b052d7a3..bd1d2378a 100644 --- a/dbcon/joblist/tablecolumn.h +++ b/dbcon/joblist/tablecolumn.h @@ -31,6 +31,7 @@ #include "bytestream.h" #include "datalist.h" #include "elementtype.h" +#include "nullstring.h" //#define TC_CHECK_RIDS 1 @@ -78,7 +79,7 @@ class TableColumn return fIntValues; } - inline const boost::shared_ptr > getStrValues() + inline const boost::shared_ptr > getStrValues() { return fStrValues; } @@ -114,7 +115,7 @@ class TableColumn fIsNullColumn = fIntValues->empty(); } - inline void setStrValues(boost::shared_ptr > sv) + inline void setStrValues(boost::shared_ptr > sv) { fStrValues = sv; fIsNullColumn = fStrValues->empty(); @@ -135,7 +136,7 @@ class TableColumn private: execplan::CalpontSystemCatalog::OID fColumnOID; boost::shared_ptr > fIntValues; - boost::shared_ptr > fStrValues; + boost::shared_ptr > fStrValues; bool fIsNullColumn; supportedType fColumnType; boost::shared_ptr preserialized; diff --git a/dbcon/joblist/tdriver-agg.cpp b/dbcon/joblist/tdriver-agg.cpp index 63da5ef46..94c62c85e 100644 --- a/dbcon/joblist/tdriver-agg.cpp +++ b/dbcon/joblist/tdriver-agg.cpp @@ -49,7 +49,6 @@ #include "aggregatecolumn.h" #include "simplecolumn.h" #include "dataconvert.h" -#include "largehashjoin.h" using namespace dataconvert; diff --git a/dbcon/joblist/tdriver-hashjoin.cpp b/dbcon/joblist/tdriver-hashjoin.cpp index 8dead6ca1..86a83692b 100644 --- a/dbcon/joblist/tdriver-hashjoin.cpp +++ b/dbcon/joblist/tdriver-hashjoin.cpp @@ -40,7 +40,6 @@ #include "wsdl.h" #include "bucketdl.h" #include "bdlwrapper.h" -#include "largehashjoin.h" #include #include #include diff --git a/dbcon/joblist/tupleaggregatestep.cpp b/dbcon/joblist/tupleaggregatestep.cpp index 6890bf9b6..fa14fc809 100644 --- a/dbcon/joblist/tupleaggregatestep.cpp +++ b/dbcon/joblist/tupleaggregatestep.cpp @@ -853,7 +853,7 @@ SJSTEP TupleAggregateStep::prepAggregate(SJSTEP& step, JobInfo& jobInfo) ConstantColumn* cc = dynamic_cast(ac->constCol().get()); idbassert(cc != NULL); // @bug5261 - bool isNull = (ConstantColumn::NULLDATA == cc->type()); + bool isNull = cc->isNull(); if (ac->aggOp() == AggregateColumn::UDAF) { @@ -5883,6 +5883,10 @@ void TupleAggregateStep::pruneAuxColumns() for (uint64_t i = 1; i < rowCount; i++) { + for (uint32_t j = 0; j < row2.getColumnCount(); j++) + { + row2.setNullMark(j, row1.getNullMark(j)); + } // skip the first row row1.nextRow(); row2.nextRow(); @@ -5890,6 +5894,10 @@ void TupleAggregateStep::pruneAuxColumns() // bug4463, memmove for src, dest overlap memmove(row2.getData(), row1.getData(), row2.getSize()); } + for (uint32_t j = 0; j < row2.getColumnCount(); j++) + { + row2.setNullMark(j, row1.getNullMark(j)); + } } void TupleAggregateStep::printCalTrace() diff --git a/dbcon/joblist/tupleconstantstep.cpp b/dbcon/joblist/tupleconstantstep.cpp index 065b087df..c3265f209 100644 --- a/dbcon/joblist/tupleconstantstep.cpp +++ b/dbcon/joblist/tupleconstantstep.cpp @@ -189,12 +189,12 @@ void TupleConstantStep::constructContanstRow(const JobInfo& jobInfo) const ConstantColumn* cc = dynamic_cast(jobInfo.deliveredCols[*i].get()); const execplan::Result c = cc->result(); - if (cc->type() == ConstantColumn::NULLDATA) + if (cc->isNull()) { if (types[*i] == CalpontSystemCatalog::CHAR || types[*i] == CalpontSystemCatalog::VARCHAR || types[*i] == CalpontSystemCatalog::TEXT) { - fRowConst.setStringField("", *i); + fRowConst.setStringField(nullptr, 0, *i); } else if (isUnsigned(types[*i])) { diff --git a/dbcon/joblist/tupleunion.cpp b/dbcon/joblist/tupleunion.cpp index 895c1e954..76a94f0dc 100644 --- a/dbcon/joblist/tupleunion.cpp +++ b/dbcon/joblist/tupleunion.cpp @@ -129,14 +129,16 @@ namespace d /= exp10(in.getScale(i)); os.precision(15); os << d; - out->setStringField(os.str(), i); + utils::NullString ns(os.str()); + out->setStringField(ns, i); } void normalizeIntToStringNoScale(const Row& in, Row* out, uint32_t i) { ostringstream os; os << in.getIntField(i); - out->setStringField(os.str(), i); + utils::NullString ns(os.str()); + out->setStringField(ns, i); } void normalizeIntToXFloat(const Row& in, Row* out, uint32_t i) @@ -206,14 +208,16 @@ namespace d /= exp10(in.getScale(i)); os.precision(15); os << d; - out->setStringField(os.str(), i); + utils::NullString ns(os.str()); + out->setStringField(ns, i); } void normalizeUintToStringNoScale(const Row& in, Row* out, uint32_t i) { ostringstream os; os << in.getUintField(i); - out->setStringField(os.str(), i); + utils::NullString ns(os.str()); + out->setStringField(ns, i); } void normalizUintToXFloat(const Row& in, Row* out, uint32_t i) @@ -301,7 +305,8 @@ namespace void normalizeDateToString(const Row& in, Row* out, uint32_t i) { string d = DataConvert::dateToString(in.getUintField(i)); - out->setStringField(d, i); + utils::NullString ns(d); + out->setStringField(ns, i); } void normalizeDatetimeToDatetime(const Row& in, Row* out, uint32_t i) @@ -351,7 +356,8 @@ namespace void normalizeDatetimeToString(const Row& in, Row* out, uint32_t i) { string d = DataConvert::datetimeToString(in.getUintField(i)); - out->setStringField(d, i); + utils::NullString ns(d); + out->setStringField(ns, i); } void normalizeTimestampToTimestamp(const Row& in, Row* out, uint32_t i) @@ -405,7 +411,8 @@ namespace void normalizeTimestampToString(const Row& in, Row* out, uint32_t i, long fTimeZone) { string d = DataConvert::timestampToString(in.getUintField(i), fTimeZone); - out->setStringField(d, i); + utils::NullString ns(d); + out->setStringField(ns, i); } void normalizeTimeToTime(const Row& in, Row* out, uint32_t i) @@ -416,7 +423,8 @@ namespace void normalizeTimeToString(const Row& in, Row* out, uint32_t i) { string d = DataConvert::timeToString(in.getIntField(i)); - out->setStringField(d, i); + utils::NullString ns(d); + out->setStringField(ns, i); } void normalizeXFloatToIntWithScaleInt128(const Row& in, Row* out, uint32_t i) @@ -509,7 +517,8 @@ namespace ostringstream os; os.precision(15); // to match mysql's output os << val; - out->setStringField(os.str(), i); + utils::NullString ns(os.str()); + out->setStringField(ns, i); } void normalizeXDoubleToString(const Row& in, Row* out, uint32_t i) @@ -518,7 +527,8 @@ namespace ostringstream os; os.precision(15); // to match mysql's output os << val; - out->setStringField(os.str(), i); + utils::NullString ns(os.str()); + out->setStringField(ns, i); } void normalizeXFloatToWideXDecimal(const Row& in, Row* out, uint32_t i) @@ -593,7 +603,8 @@ namespace ostringstream os; os.precision(15); // to match mysql's output os << val; - out->setStringField(os.str(), i); + utils::NullString ns(os.str()); + out->setStringField(ns, i); } void normalizeLongDoubleToXDecimalInt128(const Row& in, Row* out, uint32_t i) @@ -675,14 +686,14 @@ namespace int128_t val128 = 0; in.getInt128Field(i, val128); datatypes::Decimal dec(0, in.getScale(i), in.getPrecision(i), val128); - out->setStringField(dec.toString(), i); + out->setStringField(dec.toNullString(), i); } void normalizeXDecimalToString(const Row& in, Row* out, uint32_t i) { int64_t val = in.getIntField(i); datatypes::Decimal dec(val, in.getScale(i), in.getPrecision(i)); - out->setStringField(dec.toString(), i); + out->setStringField(dec.toNullString(), i); } void normalizeBlobVarbinary(const Row& in, Row* out, uint32_t i) @@ -1826,7 +1837,7 @@ void TupleUnion::writeNull(Row* out, uint32_t col) case 7: case 8: out->setUintField<8>(joblist::CHAR8NULL, col); break; - default: out->setStringField(joblist::CPNULLSTRMARK, col); break; + default: out->setStringField(nullptr, 0, col); break; } break; @@ -1836,7 +1847,7 @@ void TupleUnion::writeNull(Row* out, uint32_t col) case CalpontSystemCatalog::VARBINARY: // could use below if zero length and NULL are treated the same // out->setVarBinaryField("", col); break; - out->setVarBinaryField(joblist::CPNULLSTRMARK, col); + out->setVarBinaryField(nullptr, 0, col); break; default: diff --git a/dbcon/mysql/ha_mcs_datatype.h b/dbcon/mysql/ha_mcs_datatype.h index dbbbbe1d5..5f8dc164b 100644 --- a/dbcon/mysql/ha_mcs_datatype.h +++ b/dbcon/mysql/ha_mcs_datatype.h @@ -84,6 +84,11 @@ class StoreFieldMariaDB : public StoreField int store_string(const char* str, size_t length) override { + if (!str) + { + m_field->set_null(); + return 1; + } return m_field->store(str, length, m_field->charset()); } int store_varbinary(const char* str, size_t length) override diff --git a/dbcon/mysql/ha_mcs_dml.cpp b/dbcon/mysql/ha_mcs_dml.cpp index a23e96d48..ba107c8ef 100644 --- a/dbcon/mysql/ha_mcs_dml.cpp +++ b/dbcon/mysql/ha_mcs_dml.cpp @@ -73,6 +73,8 @@ using namespace joblist; #include "ha_mcs_datatype.h" +#include "nullstring.h" + namespace { #define BATCH_INSERT_GROUP_ROWS_FOR_CACHE 100000 @@ -95,12 +97,14 @@ uint32_t buildValueList(TABLE* table, cal_connection_info& ci) int columnPos = 0; double dbval; ci.nullValuesBitset.reset(); + NullString null; + for (Field** field = table->field; *field; field++) { if ((*field)->is_null()) { - ci.tableValuesMap[columnPos].push_back(""); // currently, empty string is treated as null. + ci.tableValuesMap[columnPos].push_back(null); ci.nullValuesBitset[columnPos] = true; } else @@ -117,21 +121,23 @@ uint32_t buildValueList(TABLE* table, cal_connection_info& ci) char buf[maxlen]; memset(buf, 0, maxlen); snprintf(buf, maxlen, "%.1024f", dbval); - ci.tableValuesMap[columnPos].push_back(buf); + NullString value(buf, strlen(buf)); + ci.tableValuesMap[columnPos].push_back(value); } else { // fetch different data type (*field)->val_str(&attribute, &attribute); - if (attribute.length() == 0) - { - ci.tableValuesMap[columnPos].push_back(""); // currently, empty string is treated as null. - } - else +// if (attribute.length() == 0) +// { +// ci.tableValuesMap[columnPos].push_back(null); // currently, empty string is treated as null. +// } +// else { string val(attribute.ptr(), attribute.length()); - ci.tableValuesMap[columnPos].push_back(val); + NullString nonNull(val); + ci.tableValuesMap[columnPos].push_back(nonNull); } } } diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index d50c47549..794169477 100644 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -2078,7 +2078,7 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip) } if (udf->result_type() == STRING_RESULT) - gwip->rcWorkStack.push(new ConstantColumn(buf.ptr())); + gwip->rcWorkStack.push(new ConstantColumn(buf.ptr())); // XXX: constantcolumn from string = can it be NULL? else { gwip->rcWorkStack.push(new ConstantColumn(buf.ptr(), ConstantColumn::NUM)); @@ -2916,7 +2916,6 @@ uint32_t setAggOp(AggregateColumn* ac, Item_sum* isp) case Item_sum::SUM_BIT_FUNC: { string funcName = isp->func_name(); - if (funcName.compare("bit_and(") == 0) ac->aggOp(AggregateColumn::BIT_AND); else if (funcName.compare("bit_or(") == 0) @@ -4865,7 +4864,7 @@ static void processAggregateColumnConstArg(gp_walk_info& gwi, SRCP& parm, Aggreg return; } ConstantColumn* cc; - if ((cc = dynamic_cast(rt)) && cc->type() == ConstantColumn::NULLDATA) + if ((cc = dynamic_cast(rt)) && cc->isNull()) { // Explicit NULL or a const function that evaluated to NULL cc = new ConstantColumnNull(); @@ -5739,16 +5738,25 @@ void gp_walk(const Item* item, void* arg) if (isp->result_type() == STRING_RESULT) { String val, *str = isp->val_str(&val); - string cval; - - if (str->ptr()) + if (str) { - cval.assign(str->ptr(), str->length()); - } + string cval; - gwip->rcWorkStack.push(new ConstantColumn(cval)); - (dynamic_cast(gwip->rcWorkStack.top()))->timeZone(gwip->timeZone); - break; + if (str->ptr()) + { + cval.assign(str->ptr(), str->length()); + } + + gwip->rcWorkStack.push(new ConstantColumn(cval)); + (dynamic_cast(gwip->rcWorkStack.top()))->timeZone(gwip->timeZone); + break; + } + else + { + gwip->rcWorkStack.push(new ConstantColumn("", ConstantColumn::NULLDATA)); + (dynamic_cast(gwip->rcWorkStack.top()))->timeZone(gwip->timeZone); + break; + } } gwip->rcWorkStack.push(buildReturnedColumn(isp, *gwip, gwip->fatalParseError)); @@ -7477,7 +7485,6 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i collectAllCols(gwi, ifp); break; } - sc = buildSimpleColumn(ifp, gwi); if (sc) diff --git a/dbcon/mysql/ha_mcs_impl.cpp b/dbcon/mysql/ha_mcs_impl.cpp index 846b87cfe..a7d6da399 100644 --- a/dbcon/mysql/ha_mcs_impl.cpp +++ b/dbcon/mysql/ha_mcs_impl.cpp @@ -403,7 +403,8 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, long t colType.colDataType == CalpontSystemCatalog::VARCHAR || colType.colDataType == CalpontSystemCatalog::VARBINARY) { - (*f)->store("", 0, (*f)->charset()); + (*f)->reset(); + (*f)->set_null(); } continue; @@ -418,7 +419,6 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, long t } else { - // fetch and store data (*f)->set_notnull(); datatypes::StoreFieldMariaDB mf(*f, colType, timeZone); h->storeValueToField(row, s, &mf); @@ -739,7 +739,7 @@ vector getOnUpdateTimestampColumns(string& schema, string& tableName, in { rowGroup->getRow(i, &row); // we are only fetching a single column - returnVal.push_back(row.getStringField(0)); + returnVal.push_back(row.getStringField(0).safeString("")); } } else @@ -1009,7 +1009,7 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector& c if (constCol) { - columnAssignmentPtr->fScalarExpression = constCol->constval(); + columnAssignmentPtr->fScalarExpression = constCol->constval().safeString(""); isFromCol = false; columnAssignmentPtr->fFromCol = false; } diff --git a/dbcon/mysql/ha_mcs_impl_if.h b/dbcon/mysql/ha_mcs_impl_if.h index fa47159b6..d98a28f65 100644 --- a/dbcon/mysql/ha_mcs_impl_if.h +++ b/dbcon/mysql/ha_mcs_impl_if.h @@ -30,6 +30,8 @@ #include "idb_mysql.h" #include "ha_mcs_sysvars.h" +#include "dmlpkg.h" + struct st_ha_create_information; class ha_columnstore_select_handler; class ha_columnstore_derived_handler; @@ -92,6 +94,8 @@ enum ClauseType }; typedef std::vector JoinInfoVec; +typedef dmlpackage::ColValuesList ColValuesList; +typedef dmlpackage::TableValuesMap TableValuesMap; typedef std::map> TableMap; typedef std::tr1::unordered_map> TableOnExprList; typedef std::tr1::unordered_map TableOuterJoinMap; @@ -257,9 +261,7 @@ struct cal_group_info }; typedef std::tr1::unordered_map CalTableMap; -typedef std::vector ColValuesList; typedef std::vector ColNameList; -typedef std::map TableValuesMap; typedef std::bitset<4096> NullValuesBitset; struct cal_connection_info { diff --git a/dbcon/mysql/is_columnstore_columns.cpp b/dbcon/mysql/is_columnstore_columns.cpp index c45abdf94..31d409479 100644 --- a/dbcon/mysql/is_columnstore_columns.cpp +++ b/dbcon/mysql/is_columnstore_columns.cpp @@ -145,14 +145,14 @@ static int is_columnstore_columns_fill(THD* thd, TABLE_LIST* tables, COND* cond) table->field[8]->store(ct.colWidth); table->field[9]->store(ct.colPosition); - if (ct.defaultValue.empty()) + if (ct.defaultValue.isNull()) { table->field[10]->set_null(); } else { table->field[10]->set_notnull(); - table->field[10]->store(ct.defaultValue.c_str(), ct.defaultValue.length(), cs); + table->field[10]->store(ct.defaultValue.str(), ct.defaultValue.length(), cs); } table->field[11]->store(ct.autoincrement); diff --git a/mysql-test/columnstore/autopilot/r/mcs4156_function_CNX_MID_SM_KnownIssue.result b/mysql-test/columnstore/autopilot/r/mcs4156_function_CNX_MID_SM_KnownIssue.result index 519f86c1a..2c35f6cee 100644 --- a/mysql-test/columnstore/autopilot/r/mcs4156_function_CNX_MID_SM_KnownIssue.result +++ b/mysql-test/columnstore/autopilot/r/mcs4156_function_CNX_MID_SM_KnownIssue.result @@ -1,52 +1,52 @@ USE autopilot; select cidx, CCHAR1, MID(CCHAR1,5,2) from datatypetestm order by cidx; cidx CCHAR1 MID(CCHAR1,5,2) -1 a NULL +1 a select cidx, CCHAR1, MID(CCHAR1,9,3) from datatypetestm order by cidx; cidx CCHAR1 MID(CCHAR1,9,3) -1 a NULL +1 a select cidx, CCHAR2, MID(CCHAR2,5,2) from datatypetestm order by cidx; cidx CCHAR2 MID(CCHAR2,5,2) -1 aa NULL +1 aa select cidx, CCHAR2, MID(CCHAR2,9,3) from datatypetestm order by cidx; cidx CCHAR2 MID(CCHAR2,9,3) -1 aa NULL +1 aa select cidx, CCHAR3, MID(CCHAR3,5,2) from datatypetestm order by cidx; cidx CCHAR3 MID(CCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CCHAR3, MID(CCHAR3,9,3) from datatypetestm order by cidx; cidx CCHAR3 MID(CCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CCHAR4, MID(CCHAR4,5,2) from datatypetestm order by cidx; cidx CCHAR4 MID(CCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, MID(CCHAR4,9,3) from datatypetestm order by cidx; cidx CCHAR4 MID(CCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CCHAR5, MID(CCHAR5,5,2) from datatypetestm order by cidx; cidx CCHAR5 MID(CCHAR5,5,2) 1 aaaaa a select cidx, CCHAR5, MID(CCHAR5,9,3) from datatypetestm order by cidx; cidx CCHAR5 MID(CCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR6, MID(CCHAR6,5,2) from datatypetestm order by cidx; cidx CCHAR6 MID(CCHAR6,5,2) 1 aaaaaa aa select cidx, CCHAR6, MID(CCHAR6,9,3) from datatypetestm order by cidx; cidx CCHAR6 MID(CCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR7, MID(CCHAR7,5,2) from datatypetestm order by cidx; cidx CCHAR7 MID(CCHAR7,5,2) 1 aaaaaaa aa select cidx, CCHAR7, MID(CCHAR7,9,3) from datatypetestm order by cidx; cidx CCHAR7 MID(CCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR8, MID(CCHAR8,5,2) from datatypetestm order by cidx; cidx CCHAR8 MID(CCHAR8,5,2) 1 aaaaaaaa aa select cidx, CCHAR8, MID(CCHAR8,9,3) from datatypetestm order by cidx; cidx CCHAR8 MID(CCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR9, MID(CCHAR9,5,2) from datatypetestm order by cidx; cidx CCHAR9 MID(CCHAR9,5,2) 1 aaaaaaaaa aa @@ -61,52 +61,52 @@ cidx CCHAR255 MID(CCHAR255,9,3) 1 aaaaaaaaaa aa select cidx, CVCHAR1, MID(CVCHAR1,5,2) from datatypetestm order by cidx; cidx CVCHAR1 MID(CVCHAR1,5,2) -1 a NULL +1 a select cidx, CVCHAR1, MID(CVCHAR1,9,3) from datatypetestm order by cidx; cidx CVCHAR1 MID(CVCHAR1,9,3) -1 a NULL +1 a select cidx, CVCHAR2, MID(CVCHAR2,5,2) from datatypetestm order by cidx; cidx CVCHAR2 MID(CVCHAR2,5,2) -1 aa NULL +1 aa select cidx, CVCHAR2, MID(CVCHAR2,9,3) from datatypetestm order by cidx; cidx CVCHAR2 MID(CVCHAR2,9,3) -1 aa NULL +1 aa select cidx, CVCHAR3, MID(CVCHAR3,5,2) from datatypetestm order by cidx; cidx CVCHAR3 MID(CVCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, MID(CVCHAR3,9,3) from datatypetestm order by cidx; cidx CVCHAR3 MID(CVCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CVCHAR4, MID(CVCHAR4,5,2) from datatypetestm order by cidx; cidx CVCHAR4 MID(CVCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, MID(CVCHAR4,9,3) from datatypetestm order by cidx; cidx CVCHAR4 MID(CVCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR5, MID(CVCHAR5,5,2) from datatypetestm order by cidx; cidx CVCHAR5 MID(CVCHAR5,5,2) 1 aaaaa a select cidx, CVCHAR5, MID(CVCHAR5,9,3) from datatypetestm order by cidx; cidx CVCHAR5 MID(CVCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR6, MID(CVCHAR6,5,2) from datatypetestm order by cidx; cidx CVCHAR6 MID(CVCHAR6,5,2) 1 aaaaaa aa select cidx, CVCHAR6, MID(CVCHAR6,9,3) from datatypetestm order by cidx; cidx CVCHAR6 MID(CVCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR7, MID(CVCHAR7,5,2) from datatypetestm order by cidx; cidx CVCHAR7 MID(CVCHAR7,5,2) 1 aaaaaaa aa select cidx, CVCHAR7, MID(CVCHAR7,9,3) from datatypetestm order by cidx; cidx CVCHAR7 MID(CVCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR8, MID(CVCHAR8,5,2) from datatypetestm order by cidx; cidx CVCHAR8 MID(CVCHAR8,5,2) 1 aaaaaaaa aa select cidx, CVCHAR8, MID(CVCHAR8,9,3) from datatypetestm order by cidx; cidx CVCHAR8 MID(CVCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR255, MID(CVCHAR255,5,2) from datatypetestm order by cidx; cidx CVCHAR255 MID(CVCHAR255,5,2) 1 aaaaaaaaaa aa diff --git a/mysql-test/columnstore/autopilot/r/mcs4210_function_CNX_SUBSTRING_SM_KnownIssue.result b/mysql-test/columnstore/autopilot/r/mcs4210_function_CNX_SUBSTRING_SM_KnownIssue.result index c9b92b014..ab0fabb2d 100644 --- a/mysql-test/columnstore/autopilot/r/mcs4210_function_CNX_SUBSTRING_SM_KnownIssue.result +++ b/mysql-test/columnstore/autopilot/r/mcs4210_function_CNX_SUBSTRING_SM_KnownIssue.result @@ -4,133 +4,133 @@ cidx CCHAR1 SUBSTRING(CCHAR1,1) 1 a a select cidx, CCHAR1, SUBSTRING(CCHAR1,5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,7) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,7) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,8) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,8) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,5,2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,5,2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,9,3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,9,3) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CCHAR2, SUBSTRING(CCHAR2,1) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,1) 1 aa aa select cidx, CCHAR2, SUBSTRING(CCHAR2,5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,7) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,7) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,8) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,8) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,5,2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,5,2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,9,3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,9,3) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CCHAR3, SUBSTRING(CCHAR3,1) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,1) 1 aaa aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,7) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,7) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,8) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,8) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,5,2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,9,3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CCHAR4, SUBSTRING(CCHAR4,1) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,1) 1 aaaa aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,7) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,8) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,5,2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,9,3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,1) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,1) 1 aaaaa aaaaa @@ -139,31 +139,31 @@ cidx CCHAR5 SUBSTRING(CCHAR5,5) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5,7) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,8) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 5) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,5,2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,5,2) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5,9,3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,1) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,1) 1 aaaaaa aaaaaa @@ -172,31 +172,31 @@ cidx CCHAR6 SUBSTRING(CCHAR6,5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6,7) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,8) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,5,2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,5,2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6,9,3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7,1) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,1) 1 aaaaaaa aaaaaaa @@ -208,28 +208,28 @@ cidx CCHAR7 SUBSTRING(CCHAR7,7) 1 aaaaaaa a select cidx, CCHAR7, SUBSTRING(CCHAR7,8) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7,9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7,5,2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,5,2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTRING(CCHAR7,9,3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8,1) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -244,25 +244,25 @@ cidx CCHAR8 SUBSTRING(CCHAR8,8) 1 aaaaaaaa a select cidx, CCHAR8, SUBSTRING(CCHAR8,9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8,5,2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,5,2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTRING(CCHAR8,9,3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR9, SUBSTRING(CCHAR9,1) from datatypetestm order by cidx; cidx CCHAR9 SUBSTRING(CCHAR9,1) 1 aaaaaaaaa aaaaaaaaa @@ -334,133 +334,133 @@ cidx CVCHAR1 SUBSTRING(CVCHAR1,1) 1 a a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,7) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,7) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,8) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,8) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5,2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,5,2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9,3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,9,3) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CVCHAR2, SUBSTRING(CVCHAR2,1) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,1) 1 aa aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,7) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,7) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,8) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,8) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5,2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,5,2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9,3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,9,3) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,1) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,1) 1 aaa aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,7) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,7) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,8) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,8) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5,2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9,3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,1) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,1) 1 aaaa aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,7) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,8) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5,2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9,3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,1) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,1) 1 aaaaa aaaaa @@ -469,31 +469,31 @@ cidx CVCHAR5 SUBSTRING(CVCHAR5,5) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5,7) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,8) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 5) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,5,2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,5,2) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9,3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,1) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,1) 1 aaaaaa aaaaaa @@ -502,31 +502,31 @@ cidx CVCHAR6 SUBSTRING(CVCHAR6,5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,7) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,8) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,5,2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,5,2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9,3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,1) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,1) 1 aaaaaaa aaaaaaa @@ -538,28 +538,28 @@ cidx CVCHAR7 SUBSTRING(CVCHAR7,7) 1 aaaaaaa a select cidx, CVCHAR7, SUBSTRING(CVCHAR7,8) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,5,2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,5,2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9,3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8,1) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -574,25 +574,25 @@ cidx CVCHAR8 SUBSTRING(CVCHAR8,8) 1 aaaaaaaa a select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8,5,2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,5,2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9,3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR255, SUBSTRING(CVCHAR255,1) from datatypetestm order by cidx; cidx CVCHAR255 SUBSTRING(CVCHAR255,1) 1 aaaaaaaaaa aaaaaaaaaa diff --git a/mysql-test/columnstore/autopilot/r/mcs4211_function_CNX_SUBSTR_SM_KnownIssue.result b/mysql-test/columnstore/autopilot/r/mcs4211_function_CNX_SUBSTR_SM_KnownIssue.result index f1cbd8795..2e53c1168 100644 --- a/mysql-test/columnstore/autopilot/r/mcs4211_function_CNX_SUBSTR_SM_KnownIssue.result +++ b/mysql-test/columnstore/autopilot/r/mcs4211_function_CNX_SUBSTR_SM_KnownIssue.result @@ -4,133 +4,133 @@ cidx CCHAR1 SUBSTR(CCHAR1,1) 1 a a select cidx, CCHAR1, SUBSTR(CCHAR1,5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,7) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,7) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,8) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,8) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,5,2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,5,2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,9,3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,9,3) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CCHAR2, SUBSTR(CCHAR2,1) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,1) 1 aa aa select cidx, CCHAR2, SUBSTR(CCHAR2,5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,7) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,7) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,8) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,8) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,5,2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,5,2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,9,3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,9,3) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CCHAR3, SUBSTR(CCHAR3,1) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,1) 1 aaa aaa select cidx, CCHAR3, SUBSTR(CCHAR3,5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,7) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,7) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,8) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,8) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,5,2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,9,3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CCHAR4, SUBSTR(CCHAR4,1) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,1) 1 aaaa aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,7) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,8) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,5,2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,9,3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CCHAR5, SUBSTR(CCHAR5,1) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,1) 1 aaaaa aaaaa @@ -139,31 +139,31 @@ cidx CCHAR5 SUBSTR(CCHAR5,5) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5,7) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5,8) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5,9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 5) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5,5,2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,5,2) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5,9,3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,1) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,1) 1 aaaaaa aaaaaa @@ -172,31 +172,31 @@ cidx CCHAR6 SUBSTR(CCHAR6,5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6,7) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,8) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,5,2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,5,2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6,9,3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7,1) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,1) 1 aaaaaaa aaaaaaa @@ -208,28 +208,28 @@ cidx CCHAR7 SUBSTR(CCHAR7,7) 1 aaaaaaa a select cidx, CCHAR7, SUBSTR(CCHAR7,8) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7,9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7,5,2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,5,2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTR(CCHAR7,9,3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8,1) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -244,25 +244,25 @@ cidx CCHAR8 SUBSTR(CCHAR8,8) 1 aaaaaaaa a select cidx, CCHAR8, SUBSTR(CCHAR8,9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8,5,2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,5,2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTR(CCHAR8,9,3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR9, SUBSTR(CCHAR9,1) from datatypetestm order by cidx; cidx CCHAR9 SUBSTR(CCHAR9,1) 1 aaaaaaaaa aaaaaaaaa @@ -334,133 +334,133 @@ cidx CVCHAR1 SUBSTR(CVCHAR1,1) 1 a a select cidx, CVCHAR1, SUBSTR(CVCHAR1,5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,7) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,7) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,8) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,8) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,5,2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,5,2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,9,3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,9,3) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CVCHAR2, SUBSTR(CVCHAR2,1) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,1) 1 aa aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,7) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,7) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,8) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,8) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,5,2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,5,2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,9,3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,9,3) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CVCHAR3, SUBSTR(CVCHAR3,1) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,1) 1 aaa aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,7) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,7) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,8) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,8) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,5,2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,9,3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,1) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,1) 1 aaaa aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,7) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,8) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,5,2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,9,3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,1) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,1) 1 aaaaa aaaaa @@ -469,31 +469,31 @@ cidx CVCHAR5 SUBSTR(CVCHAR5,5) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5,7) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,8) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 5) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,5,2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,5,2) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5,9,3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,1) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,1) 1 aaaaaa aaaaaa @@ -502,31 +502,31 @@ cidx CVCHAR6 SUBSTR(CVCHAR6,5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6,7) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,8) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,5,2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,5,2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6,9,3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7,1) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,1) 1 aaaaaaa aaaaaaa @@ -538,28 +538,28 @@ cidx CVCHAR7 SUBSTR(CVCHAR7,7) 1 aaaaaaa a select cidx, CVCHAR7, SUBSTR(CVCHAR7,8) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7,9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7,5,2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,5,2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTR(CVCHAR7,9,3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8,1) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -574,25 +574,25 @@ cidx CVCHAR8 SUBSTR(CVCHAR8,8) 1 aaaaaaaa a select cidx, CVCHAR8, SUBSTR(CVCHAR8,9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8,5,2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,5,2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTR(CVCHAR8,9,3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR255, SUBSTR(CVCHAR255,1) from datatypetestm order by cidx; cidx CVCHAR255 SUBSTR(CVCHAR255,1) 1 aaaaaaaaaa aaaaaaaaaa diff --git a/mysql-test/columnstore/autopilot/r/mcs4381_function_CNXPP_MID_SM_KnownIssue.result b/mysql-test/columnstore/autopilot/r/mcs4381_function_CNXPP_MID_SM_KnownIssue.result index 64214ea15..bf94aa597 100644 --- a/mysql-test/columnstore/autopilot/r/mcs4381_function_CNXPP_MID_SM_KnownIssue.result +++ b/mysql-test/columnstore/autopilot/r/mcs4381_function_CNXPP_MID_SM_KnownIssue.result @@ -1,52 +1,52 @@ USE autopilot; select cidx, CCHAR1, MID(CCHAR1,5,2) from datatypetestm order by cidx; cidx CCHAR1 MID(CCHAR1,5,2) -1 a NULL +1 a select cidx, CCHAR1, MID(CCHAR1,9,3) from datatypetestm order by cidx; cidx CCHAR1 MID(CCHAR1,9,3) -1 a NULL +1 a select cidx, CCHAR2, MID(CCHAR2,5,2) from datatypetestm order by cidx; cidx CCHAR2 MID(CCHAR2,5,2) -1 aa NULL +1 aa select cidx, CCHAR2, MID(CCHAR2,9,3) from datatypetestm order by cidx; cidx CCHAR2 MID(CCHAR2,9,3) -1 aa NULL +1 aa select cidx, CCHAR3, MID(CCHAR3,5,2) from datatypetestm order by cidx; cidx CCHAR3 MID(CCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CCHAR3, MID(CCHAR3,9,3) from datatypetestm order by cidx; cidx CCHAR3 MID(CCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CCHAR4, MID(CCHAR4,5,2) from datatypetestm order by cidx; cidx CCHAR4 MID(CCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, MID(CCHAR4,9,3) from datatypetestm order by cidx; cidx CCHAR4 MID(CCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CCHAR5, MID(CCHAR5,5,2) from datatypetestm order by cidx; cidx CCHAR5 MID(CCHAR5,5,2) 1 aaaaa a select cidx, CCHAR5, MID(CCHAR5,9,3) from datatypetestm order by cidx; cidx CCHAR5 MID(CCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR6, MID(CCHAR6,5,2) from datatypetestm order by cidx; cidx CCHAR6 MID(CCHAR6,5,2) 1 aaaaaa aa select cidx, CCHAR6, MID(CCHAR6,9,3) from datatypetestm order by cidx; cidx CCHAR6 MID(CCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR7, MID(CCHAR7,5,2) from datatypetestm order by cidx; cidx CCHAR7 MID(CCHAR7,5,2) 1 aaaaaaa aa select cidx, CCHAR7, MID(CCHAR7,9,3) from datatypetestm order by cidx; cidx CCHAR7 MID(CCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR8, MID(CCHAR8,5,2) from datatypetestm order by cidx; cidx CCHAR8 MID(CCHAR8,5,2) 1 aaaaaaaa aa select cidx, CCHAR8, MID(CCHAR8,9,3) from datatypetestm order by cidx; cidx CCHAR8 MID(CCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR9, MID(CCHAR9,5,2) from datatypetestm order by cidx; cidx CCHAR9 MID(CCHAR9,5,2) 1 aaaaaaaaa aa @@ -61,52 +61,52 @@ cidx CCHAR255 MID(CCHAR255,9,3) 1 aaaaaaaaaa aa select cidx, CVCHAR1, MID(CVCHAR1,5,2) from datatypetestm order by cidx; cidx CVCHAR1 MID(CVCHAR1,5,2) -1 a NULL +1 a select cidx, CVCHAR1, MID(CVCHAR1,9,3) from datatypetestm order by cidx; cidx CVCHAR1 MID(CVCHAR1,9,3) -1 a NULL +1 a select cidx, CVCHAR2, MID(CVCHAR2,5,2) from datatypetestm order by cidx; cidx CVCHAR2 MID(CVCHAR2,5,2) -1 aa NULL +1 aa select cidx, CVCHAR2, MID(CVCHAR2,9,3) from datatypetestm order by cidx; cidx CVCHAR2 MID(CVCHAR2,9,3) -1 aa NULL +1 aa select cidx, CVCHAR3, MID(CVCHAR3,5,2) from datatypetestm order by cidx; cidx CVCHAR3 MID(CVCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, MID(CVCHAR3,9,3) from datatypetestm order by cidx; cidx CVCHAR3 MID(CVCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CVCHAR4, MID(CVCHAR4,5,2) from datatypetestm order by cidx; cidx CVCHAR4 MID(CVCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, MID(CVCHAR4,9,3) from datatypetestm order by cidx; cidx CVCHAR4 MID(CVCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR5, MID(CVCHAR5,5,2) from datatypetestm order by cidx; cidx CVCHAR5 MID(CVCHAR5,5,2) 1 aaaaa a select cidx, CVCHAR5, MID(CVCHAR5,9,3) from datatypetestm order by cidx; cidx CVCHAR5 MID(CVCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR6, MID(CVCHAR6,5,2) from datatypetestm order by cidx; cidx CVCHAR6 MID(CVCHAR6,5,2) 1 aaaaaa aa select cidx, CVCHAR6, MID(CVCHAR6,9,3) from datatypetestm order by cidx; cidx CVCHAR6 MID(CVCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR7, MID(CVCHAR7,5,2) from datatypetestm order by cidx; cidx CVCHAR7 MID(CVCHAR7,5,2) 1 aaaaaaa aa select cidx, CVCHAR7, MID(CVCHAR7,9,3) from datatypetestm order by cidx; cidx CVCHAR7 MID(CVCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR8, MID(CVCHAR8,5,2) from datatypetestm order by cidx; cidx CVCHAR8 MID(CVCHAR8,5,2) 1 aaaaaaaa aa select cidx, CVCHAR8, MID(CVCHAR8,9,3) from datatypetestm order by cidx; cidx CVCHAR8 MID(CVCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR255, MID(CVCHAR255,5,2) from datatypetestm order by cidx; cidx CVCHAR255 MID(CVCHAR255,5,2) 1 aaaaaaaaaa aa diff --git a/mysql-test/columnstore/autopilot/r/mcs4435_function_CNXPP_SUBSTRING_SM_KnownIssue.result b/mysql-test/columnstore/autopilot/r/mcs4435_function_CNXPP_SUBSTRING_SM_KnownIssue.result index fe5bf0fc0..5a2f83b4e 100644 --- a/mysql-test/columnstore/autopilot/r/mcs4435_function_CNXPP_SUBSTRING_SM_KnownIssue.result +++ b/mysql-test/columnstore/autopilot/r/mcs4435_function_CNXPP_SUBSTRING_SM_KnownIssue.result @@ -4,133 +4,133 @@ cidx CCHAR1 SUBSTRING(CCHAR1,1) 1 a a select cidx, CCHAR1, SUBSTRING(CCHAR1,5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,7) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,7) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,8) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,8) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,5,2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,5,2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1,9,3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1,9,3) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTRING(CCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CCHAR2, SUBSTRING(CCHAR2,1) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,1) 1 aa aa select cidx, CCHAR2, SUBSTRING(CCHAR2,5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,7) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,7) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,8) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,8) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,5,2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,5,2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2,9,3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2,9,3) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTRING(CCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CCHAR3, SUBSTRING(CCHAR3,1) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,1) 1 aaa aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,7) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,7) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,8) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,8) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,5,2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3,9,3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTRING(CCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CCHAR4, SUBSTRING(CCHAR4,1) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,1) 1 aaaa aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,7) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,8) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,5,2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4,9,3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTRING(CCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,1) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,1) 1 aaaaa aaaaa @@ -139,31 +139,31 @@ cidx CCHAR5 SUBSTRING(CCHAR5,5) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5,7) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,8) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 5) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5,5,2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,5,2) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5,9,3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTRING(CCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,1) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,1) 1 aaaaaa aaaaaa @@ -172,31 +172,31 @@ cidx CCHAR6 SUBSTRING(CCHAR6,5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6,7) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,8) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6,5,2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,5,2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6,9,3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTRING(CCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7,1) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,1) 1 aaaaaaa aaaaaaa @@ -208,28 +208,28 @@ cidx CCHAR7 SUBSTRING(CCHAR7,7) 1 aaaaaaa a select cidx, CCHAR7, SUBSTRING(CCHAR7,8) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7,9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7,5,2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,5,2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTRING(CCHAR7,9,3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTRING(CCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8,1) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -244,25 +244,25 @@ cidx CCHAR8 SUBSTRING(CCHAR8,8) 1 aaaaaaaa a select cidx, CCHAR8, SUBSTRING(CCHAR8,9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8,5,2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,5,2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTRING(CCHAR8,9,3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTRING(CCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR9, SUBSTRING(CCHAR9,1) from datatypetestm order by cidx; cidx CCHAR9 SUBSTRING(CCHAR9,1) 1 aaaaaaaaa aaaaaaaaa @@ -334,133 +334,133 @@ cidx CVCHAR1 SUBSTRING(CVCHAR1,1) 1 a a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,7) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,7) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,8) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,8) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5,2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,5,2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9,3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1,9,3) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CVCHAR2, SUBSTRING(CVCHAR2,1) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,1) 1 aa aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,7) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,7) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,8) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,8) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5,2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,5,2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9,3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2,9,3) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,1) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,1) 1 aaa aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,7) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,7) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,8) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,8) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5,2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9,3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,1) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,1) 1 aaaa aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,7) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,8) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5,2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9,3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,1) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,1) 1 aaaaa aaaaa @@ -469,31 +469,31 @@ cidx CVCHAR5 SUBSTRING(CVCHAR5,5) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5,7) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,8) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 5) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5,5,2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,5,2) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9,3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,1) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,1) 1 aaaaaa aaaaaa @@ -502,31 +502,31 @@ cidx CVCHAR6 SUBSTRING(CVCHAR6,5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,7) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,8) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,5,2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,5,2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9,3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,1) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,1) 1 aaaaaaa aaaaaaa @@ -538,28 +538,28 @@ cidx CVCHAR7 SUBSTRING(CVCHAR7,7) 1 aaaaaaa a select cidx, CVCHAR7, SUBSTRING(CVCHAR7,8) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,5,2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,5,2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9,3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8,1) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -574,25 +574,25 @@ cidx CVCHAR8 SUBSTRING(CVCHAR8,8) 1 aaaaaaaa a select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8,5,2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,5,2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9,3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR255, SUBSTRING(CVCHAR255,1) from datatypetestm order by cidx; cidx CVCHAR255 SUBSTRING(CVCHAR255,1) 1 aaaaaaaaaa aaaaaaaaaa diff --git a/mysql-test/columnstore/autopilot/r/mcs4436_function_CNXPP_SUBSTR_SM_KnownIssue.result b/mysql-test/columnstore/autopilot/r/mcs4436_function_CNXPP_SUBSTR_SM_KnownIssue.result index 194792477..b3f2d659b 100644 --- a/mysql-test/columnstore/autopilot/r/mcs4436_function_CNXPP_SUBSTR_SM_KnownIssue.result +++ b/mysql-test/columnstore/autopilot/r/mcs4436_function_CNXPP_SUBSTR_SM_KnownIssue.result @@ -4,133 +4,133 @@ cidx CCHAR1 SUBSTR(CCHAR1,1) 1 a a select cidx, CCHAR1, SUBSTR(CCHAR1,5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,7) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,7) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,8) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,8) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 5) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 9) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,5,2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,5,2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1,9,3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1,9,3) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR1 SUBSTR(CCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CCHAR2, SUBSTR(CCHAR2,1) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,1) 1 aa aa select cidx, CCHAR2, SUBSTR(CCHAR2,5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,7) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,7) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,8) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,8) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,5,2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,5,2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2,9,3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2,9,3) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR2 SUBSTR(CCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CCHAR3, SUBSTR(CCHAR3,1) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,1) 1 aaa aaa select cidx, CCHAR3, SUBSTR(CCHAR3,5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,7) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,7) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,8) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,8) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,5,2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3,9,3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR3 SUBSTR(CCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CCHAR4, SUBSTR(CCHAR4,1) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,1) 1 aaaa aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,7) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,8) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,5,2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4,9,3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR4 SUBSTR(CCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CCHAR5, SUBSTR(CCHAR5,1) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,1) 1 aaaaa aaaaa @@ -139,31 +139,31 @@ cidx CCHAR5 SUBSTR(CCHAR5,5) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5,7) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5,8) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5,9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 5) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5,5,2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,5,2) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5,9,3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR5 SUBSTR(CCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,1) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,1) 1 aaaaaa aaaaaa @@ -172,31 +172,31 @@ cidx CCHAR6 SUBSTR(CCHAR6,5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6,7) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,8) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 5) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6,5,2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,5,2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6,9,3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR6 SUBSTR(CCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7,1) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,1) 1 aaaaaaa aaaaaaa @@ -208,28 +208,28 @@ cidx CCHAR7 SUBSTR(CCHAR7,7) 1 aaaaaaa a select cidx, CCHAR7, SUBSTR(CCHAR7,8) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7,9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7,5,2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,5,2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTR(CCHAR7,9,3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR7 SUBSTR(CCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8,1) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -244,25 +244,25 @@ cidx CCHAR8 SUBSTR(CCHAR8,8) 1 aaaaaaaa a select cidx, CCHAR8, SUBSTR(CCHAR8,9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8,5,2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,5,2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTR(CCHAR8,9,3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CCHAR8 SUBSTR(CCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CCHAR9, SUBSTR(CCHAR9,1) from datatypetestm order by cidx; cidx CCHAR9 SUBSTR(CCHAR9,1) 1 aaaaaaaaa aaaaaaaaa @@ -334,133 +334,133 @@ cidx CVCHAR1 SUBSTR(CVCHAR1,1) 1 a a select cidx, CVCHAR1, SUBSTR(CVCHAR1,5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,7) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,7) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,8) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,8) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 5) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 9) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,5,2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,5,2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1,9,3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1,9,3) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 5 FOR 2) -1 a NULL +1 a select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 9 FOR 3) -1 a NULL +1 a select cidx, CVCHAR2, SUBSTR(CVCHAR2,1) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,1) 1 aa aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,7) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,7) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,8) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,8) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 5) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 9) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,5,2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,5,2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2,9,3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2,9,3) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 5 FOR 2) -1 aa NULL +1 aa select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 9 FOR 3) -1 aa NULL +1 aa select cidx, CVCHAR3, SUBSTR(CVCHAR3,1) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,1) 1 aaa aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,7) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,7) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,8) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,8) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 5) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 9) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,5,2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,5,2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3,9,3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3,9,3) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 5 FOR 2) -1 aaa NULL +1 aaa select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 9 FOR 3) -1 aaa NULL +1 aaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,1) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,1) 1 aaaa aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,7) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,7) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,8) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,8) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 5) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 9) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,5,2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,5,2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4,9,3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4,9,3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 5 FOR 2) -1 aaaa NULL +1 aaaa select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 9 FOR 3) -1 aaaa NULL +1 aaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,1) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,1) 1 aaaaa aaaaa @@ -469,31 +469,31 @@ cidx CVCHAR5 SUBSTR(CVCHAR5,5) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5,7) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,7) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,8) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,8) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 5) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 9) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5,5,2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,5,2) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5,9,3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5,9,3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 5 FOR 2) 1 aaaaa a select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 9 FOR 3) -1 aaaaa NULL +1 aaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,1) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,1) 1 aaaaaa aaaaaa @@ -502,31 +502,31 @@ cidx CVCHAR6 SUBSTR(CVCHAR6,5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6,7) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,7) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,8) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,8) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 5) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 9) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6,5,2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,5,2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6,9,3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6,9,3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 5 FOR 2) 1 aaaaaa aa select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 9 FOR 3) -1 aaaaaa NULL +1 aaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7,1) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,1) 1 aaaaaaa aaaaaaa @@ -538,28 +538,28 @@ cidx CVCHAR7 SUBSTR(CVCHAR7,7) 1 aaaaaaa a select cidx, CVCHAR7, SUBSTR(CVCHAR7,8) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,8) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7,9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 5) 1 aaaaaaa aaa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 9) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7,5,2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,5,2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTR(CVCHAR7,9,3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7,9,3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 5 FOR 2) 1 aaaaaaa aa select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 9 FOR 3) -1 aaaaaaa NULL +1 aaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8,1) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,1) 1 aaaaaaaa aaaaaaaa @@ -574,25 +574,25 @@ cidx CVCHAR8 SUBSTR(CVCHAR8,8) 1 aaaaaaaa a select cidx, CVCHAR8, SUBSTR(CVCHAR8,9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 5) 1 aaaaaaaa aaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 9) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8,5,2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,5,2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTR(CVCHAR8,9,3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8,9,3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5 FOR 2) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 5 FOR 2) 1 aaaaaaaa aa select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9 FOR 3) from datatypetestm order by cidx; cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 9 FOR 3) -1 aaaaaaaa NULL +1 aaaaaaaa select cidx, CVCHAR255, SUBSTR(CVCHAR255,1) from datatypetestm order by cidx; cidx CVCHAR255 SUBSTR(CVCHAR255,1) 1 aaaaaaaaaa aaaaaaaaaa diff --git a/mysql-test/columnstore/autopilot/r/mcs6794_function_CNX_MID_SM.result b/mysql-test/columnstore/autopilot/r/mcs6794_function_CNX_MID_SM.result index 480ab2500..03c1ede00 100644 --- a/mysql-test/columnstore/autopilot/r/mcs6794_function_CNX_MID_SM.result +++ b/mysql-test/columnstore/autopilot/r/mcs6794_function_CNX_MID_SM.result @@ -11,7 +11,7 @@ cidx CTINYTEXT MID(CTINYTEXT,5,2) 1 tinytext te select cidx, CTINYTEXT, MID(CTINYTEXT,9,3) from datatypetestm ; cidx CTINYTEXT MID(CTINYTEXT,9,3) -1 tinytext NULL +1 tinytext select cidx, CMEDIUMTEXT, MID(CMEDIUMTEXT,5,2) from datatypetestm ; cidx CMEDIUMTEXT MID(CMEDIUMTEXT,5,2) 1 mediumtestmediumtest um diff --git a/mysql-test/columnstore/autopilot/r/mcs6813_function_CNX_SUBSTRING_SM.result b/mysql-test/columnstore/autopilot/r/mcs6813_function_CNX_SUBSTRING_SM.result index 881935b38..5d40e341e 100644 --- a/mysql-test/columnstore/autopilot/r/mcs6813_function_CNX_SUBSTRING_SM.result +++ b/mysql-test/columnstore/autopilot/r/mcs6813_function_CNX_SUBSTRING_SM.result @@ -47,25 +47,25 @@ cidx CTINYTEXT SUBSTRING(CTINYTEXT,8) 1 tinytext t select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT,9) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT,9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 5) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 5) 1 tinytext text select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 9) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT,5,2) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT,5,2) 1 tinytext te select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT,9,3) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT,9,3) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 5 FOR 2) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 5 FOR 2) 1 tinytext te select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 9 FOR 3) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 9 FOR 3) -1 tinytext NULL +1 tinytext select cidx, CMEDIUMTEXT, SUBSTRING(CMEDIUMTEXT,1) from datatypetestm ; cidx CMEDIUMTEXT SUBSTRING(CMEDIUMTEXT,1) 1 mediumtestmediumtest mediumtestmediumtest diff --git a/mysql-test/columnstore/autopilot/r/mcs6814_function_CNX_SUBSTR_SM.result b/mysql-test/columnstore/autopilot/r/mcs6814_function_CNX_SUBSTR_SM.result index 165d545df..9213616e3 100644 --- a/mysql-test/columnstore/autopilot/r/mcs6814_function_CNX_SUBSTR_SM.result +++ b/mysql-test/columnstore/autopilot/r/mcs6814_function_CNX_SUBSTR_SM.result @@ -47,25 +47,25 @@ cidx CTINYTEXT SUBSTR(CTINYTEXT,8) 1 tinytext t select cidx, CTINYTEXT, SUBSTR(CTINYTEXT,9) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT,9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 5) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 5) 1 tinytext text select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 9) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTR(CTINYTEXT,5,2) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT,5,2) 1 tinytext te select cidx, CTINYTEXT, SUBSTR(CTINYTEXT,9,3) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT,9,3) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 5 FOR 2) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 5 FOR 2) 1 tinytext te select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 9 FOR 3) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 9 FOR 3) -1 tinytext NULL +1 tinytext select cidx, CMEDIUMTEXT, SUBSTR(CMEDIUMTEXT,1) from datatypetestm ; cidx CMEDIUMTEXT SUBSTR(CMEDIUMTEXT,1) 1 mediumtestmediumtest mediumtestmediumtest diff --git a/mysql-test/columnstore/autopilot/r/mcs6866_function_CNXPP_MID_SM.result b/mysql-test/columnstore/autopilot/r/mcs6866_function_CNXPP_MID_SM.result index 8980dfad7..04967180b 100644 --- a/mysql-test/columnstore/autopilot/r/mcs6866_function_CNXPP_MID_SM.result +++ b/mysql-test/columnstore/autopilot/r/mcs6866_function_CNXPP_MID_SM.result @@ -11,7 +11,7 @@ cidx CTINYTEXT MID(CTINYTEXT,5,2) 1 tinytext te select cidx, CTINYTEXT, MID(CTINYTEXT,9,3) from datatypetestm ; cidx CTINYTEXT MID(CTINYTEXT,9,3) -1 tinytext NULL +1 tinytext select cidx, CMEDIUMTEXT, MID(CMEDIUMTEXT,5,2) from datatypetestm ; cidx CMEDIUMTEXT MID(CMEDIUMTEXT,5,2) 1 mediumtestmediumtest um diff --git a/mysql-test/columnstore/autopilot/r/mcs6885_function_CNXPP_SUBSTRING_SM.result b/mysql-test/columnstore/autopilot/r/mcs6885_function_CNXPP_SUBSTRING_SM.result index cf63f8094..bc9aec4ab 100644 --- a/mysql-test/columnstore/autopilot/r/mcs6885_function_CNXPP_SUBSTRING_SM.result +++ b/mysql-test/columnstore/autopilot/r/mcs6885_function_CNXPP_SUBSTRING_SM.result @@ -47,25 +47,25 @@ cidx CTINYTEXT SUBSTRING(CTINYTEXT,8) 1 tinytext t select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT,9) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT,9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 5) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 5) 1 tinytext text select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 9) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT,5,2) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT,5,2) 1 tinytext te select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT,9,3) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT,9,3) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 5 FOR 2) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 5 FOR 2) 1 tinytext te select cidx, CTINYTEXT, SUBSTRING(CTINYTEXT FROM 9 FOR 3) from datatypetestm ; cidx CTINYTEXT SUBSTRING(CTINYTEXT FROM 9 FOR 3) -1 tinytext NULL +1 tinytext select cidx, CMEDIUMTEXT, SUBSTRING(CMEDIUMTEXT,1) from datatypetestm ; cidx CMEDIUMTEXT SUBSTRING(CMEDIUMTEXT,1) 1 mediumtestmediumtest mediumtestmediumtest diff --git a/mysql-test/columnstore/autopilot/r/mcs6886_function_CNXPP_SUBSTR_SM.result b/mysql-test/columnstore/autopilot/r/mcs6886_function_CNXPP_SUBSTR_SM.result index 8fecb07f6..0327f2c6a 100644 --- a/mysql-test/columnstore/autopilot/r/mcs6886_function_CNXPP_SUBSTR_SM.result +++ b/mysql-test/columnstore/autopilot/r/mcs6886_function_CNXPP_SUBSTR_SM.result @@ -47,25 +47,25 @@ cidx CTINYTEXT SUBSTR(CTINYTEXT,8) 1 tinytext t select cidx, CTINYTEXT, SUBSTR(CTINYTEXT,9) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT,9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 5) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 5) 1 tinytext text select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 9) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 9) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTR(CTINYTEXT,5,2) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT,5,2) 1 tinytext te select cidx, CTINYTEXT, SUBSTR(CTINYTEXT,9,3) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT,9,3) -1 tinytext NULL +1 tinytext select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 5 FOR 2) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 5 FOR 2) 1 tinytext te select cidx, CTINYTEXT, SUBSTR(CTINYTEXT FROM 9 FOR 3) from datatypetestm ; cidx CTINYTEXT SUBSTR(CTINYTEXT FROM 9 FOR 3) -1 tinytext NULL +1 tinytext select cidx, CMEDIUMTEXT, SUBSTR(CMEDIUMTEXT,1) from datatypetestm ; cidx CMEDIUMTEXT SUBSTR(CMEDIUMTEXT,1) 1 mediumtestmediumtest mediumtestmediumtest diff --git a/mysql-test/columnstore/basic/r/func_json_contains.result b/mysql-test/columnstore/basic/r/func_json_contains.result index c87df6f75..06bf099aa 100644 --- a/mysql-test/columnstore/basic/r/func_json_contains.result +++ b/mysql-test/columnstore/basic/r/func_json_contains.result @@ -24,7 +24,7 @@ FROM t1; json value path result {"k1":123, "k2":345} 123 $.k1 1 -NULL NULL $ NULL + $ NULL null null $ 1 "10" "10" $ 1 "10" 10 $ 0 diff --git a/mysql-test/columnstore/basic/r/func_json_quote.result b/mysql-test/columnstore/basic/r/func_json_quote.result index fd138a3f3..5113c2e60 100644 --- a/mysql-test/columnstore/basic/r/func_json_quote.result +++ b/mysql-test/columnstore/basic/r/func_json_quote.result @@ -106,7 +106,7 @@ CHAR_LENGTH(JSON_UNQUOTE(l)) FROM t1; JSON_UNQUOTE(l) CHAR_LENGTH(JSON_UNQUOTE(l)) -NULL 0 + 0 TRUNCATE t1; INSERT INTO t1 @@ -117,7 +117,7 @@ JSON_UNQUOTE(l) FROM t1; JSON_UNQUOTE(l) -NULL + # Inconrrect type e.g. Integer CREATE TABLE t3(i INT) ENGINE = columnstore; INSERT INTO diff --git a/mysql-test/columnstore/basic/r/func_jsonarrayagg.result b/mysql-test/columnstore/basic/r/func_jsonarrayagg.result index 9877cf6b9..9c73a3dd4 100644 --- a/mysql-test/columnstore/basic/r/func_jsonarrayagg.result +++ b/mysql-test/columnstore/basic/r/func_jsonarrayagg.result @@ -78,7 +78,7 @@ SELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY a; JSON_ARRAYAGG(a) JSON_ARRAYAGG(b) [1,1,1,1] ["Hello","World","Hello","World"] [2,2,2,2,2,2,2,2] ["This","Will","Work","!","This","Will","Work","!"] -[3,3] NULL +[3,3] # # DISTINCT and LIMIT # @@ -90,7 +90,7 @@ JSON_ARRAYAGG(b LIMIT 2) ["Hello","World","This","Will","Work","!","Hello","World","This","Will","Work","!"] SELECT JSON_ARRAYAGG(b LIMIT 1) FROM t1 GROUP BY b; JSON_ARRAYAGG(b LIMIT 1) -NULL + ["!","!"] ["Hello","Hello"] ["This","This"] @@ -99,7 +99,7 @@ NULL ["World","World"] SELECT JSON_ARRAYAGG(b LIMIT 2) FROM t1 GROUP BY a; JSON_ARRAYAGG(b LIMIT 2) -NULL + ["Hello","World","Hello","World"] ["This","Will","Work","!","This","Will","Work","!"] SELECT JSON_ARRAYAGG(DISTINCT a) FROM t1; @@ -156,7 +156,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT)ENGINE=COLUMNSTORE; SELECT JSON_ARRAYAGG(a) FROM t1; JSON_ARRAYAGG(a) -NULL + DROP TABLE t1; # # diff --git a/mysql-test/columnstore/basic/r/mcol271-empty-string-is-not-null.result b/mysql-test/columnstore/basic/r/mcol271-empty-string-is-not-null.result new file mode 100644 index 000000000..957a38243 --- /dev/null +++ b/mysql-test/columnstore/basic/r/mcol271-empty-string-is-not-null.result @@ -0,0 +1,77 @@ +DROP DATABASE IF EXISTS test_empty_strings; +CREATE DATABASE test_empty_strings; +USE test_empty_strings; +CREATE TABLE t(s text) ENGINE=COLUMNSTORE; +INSERT INTO t(s) VALUES (''), (NULL); +SELECT COUNT(*) FROM t WHERE s IS NULL; +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE s IS NOT NULL; +COUNT(*) +1 +SELECT * FROM t; +s + +NULL +DROP TABLE t; +CREATE TABLE t(s text) ENGINE=COLUMNSTORE; +INSERT INTO t(s) VALUES (''); +INSERT INTO t(s) VALUES (NULL); +SELECT * FROM t; +s + +NULL +SELECT COUNT(*) FROM t WHERE s IS NULL; +COUNT(*) +1 +DROP TABLE t; +CREATE TABLE t(s text) ENGINE=COLUMNSTORE; +INSERT INTO t(s) VALUES ('_CpNuLl_'),(''), (NULL); +SELECT * FROM t; +s +_CpNuLl_ + +NULL +SELECT COUNT(*) FROM t WHERE s IS NULL; +COUNT(*) +1 +DROP TABLE t; +CREATE TABLE t(c6 CHAR(6)) ENGINE=COLUMNSTORE; +INSERT INTO t(c6) VALUES ('a'), ('b'), ('c'); +SELECT 2, COUNT(*) FROM t WHERE (c6 <= 'b' OR c6 <= ''); +2 COUNT(*) +2 2 +SELECT 2, COUNT(*) FROM t WHERE (c6 <= 'b'); +2 COUNT(*) +2 2 +SELECT 0, COUNT(*) FROM t WHERE (c6 <= ''); +0 COUNT(*) +0 0 +SELECT 0, COUNT(*) FROM t WHERE (c6 <= ' '); +0 COUNT(*) +0 0 +SELECT 2, COUNT(*) FROM t WHERE (c6 <= 'b' OR c6 <= ' '); +2 COUNT(*) +2 2 +SELECT 0, COUNT(*) FROM t WHERE (c6 < ''); +0 COUNT(*) +0 0 +SELECT 0, COUNT(*) FROM t WHERE (c6 < ' '); +0 COUNT(*) +0 0 +DROP TABLE IF EXISTS t; +CREATE TABLE t(a CHAR(10)) ENGINE=COLUMNSTORE; +INSERT INTO t(a) VALUES (''), (NULL), (' '), (' a '); +SELECT LTRIM_ORACLE(a) FROM t; +LTRIM_ORACLE(a) +NULL +NULL +NULL +a +SELECT RTRIM_ORACLE(a) FROM t; +RTRIM_ORACLE(a) +NULL +NULL +NULL + a +DROP DATABASE test_empty_strings; diff --git a/mysql-test/columnstore/basic/r/mcs115_count_distinct.result b/mysql-test/columnstore/basic/r/mcs115_count_distinct.result index 9440b802d..44b61fb4f 100644 --- a/mysql-test/columnstore/basic/r/mcs115_count_distinct.result +++ b/mysql-test/columnstore/basic/r/mcs115_count_distinct.result @@ -11,5 +11,5 @@ COUNT(DISTINCT a) 3 SELECT COUNT(DISTINCT b) FROM t1; COUNT(DISTINCT b) -2 +3 DROP DATABASE mcs115_db; diff --git a/mysql-test/columnstore/basic/r/mcs123_window_function_cume_dist.result b/mysql-test/columnstore/basic/r/mcs123_window_function_cume_dist.result index dc6699250..6c08d21bf 100644 --- a/mysql-test/columnstore/basic/r/mcs123_window_function_cume_dist.result +++ b/mysql-test/columnstore/basic/r/mcs123_window_function_cume_dist.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs123_db; CREATE DATABASE mcs123_db; USE mcs123_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 12),('c', 1861),('c', 1991),('d', 10701),('d', 1071); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 12),('c', 1861),('c', 1991),('d', 10701),('d', 1071); SELECT a, b, CUME_DIST() OVER(ORDER BY a) cume_dist_val FROM t1; a b cume_dist_val NULL NULL 0.1250000000 diff --git a/mysql-test/columnstore/basic/r/mcs124_window_function_dense_rank.result b/mysql-test/columnstore/basic/r/mcs124_window_function_dense_rank.result index 20efb4786..a3d8f4e8a 100644 --- a/mysql-test/columnstore/basic/r/mcs124_window_function_dense_rank.result +++ b/mysql-test/columnstore/basic/r/mcs124_window_function_dense_rank.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs124_db; CREATE DATABASE mcs124_db; USE mcs124_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, DENSE_RANK() OVER(ORDER BY a) rank FROM t1; a b rank NULL NULL 1 diff --git a/mysql-test/columnstore/basic/r/mcs125_window_function_first_value.result b/mysql-test/columnstore/basic/r/mcs125_window_function_first_value.result index ca46305a2..f87a09313 100644 --- a/mysql-test/columnstore/basic/r/mcs125_window_function_first_value.result +++ b/mysql-test/columnstore/basic/r/mcs125_window_function_first_value.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs125_db; CREATE DATABASE mcs125_db; USE mcs125_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, FIRST_VALUE(b) OVER(ORDER BY a DESC) fv FROM t1; a b fv d 10701 10701 diff --git a/mysql-test/columnstore/basic/r/mcs126_window_function_lag.result b/mysql-test/columnstore/basic/r/mcs126_window_function_lag.result index 53d69c5fa..66842e5fd 100644 --- a/mysql-test/columnstore/basic/r/mcs126_window_function_lag.result +++ b/mysql-test/columnstore/basic/r/mcs126_window_function_lag.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs126_db; CREATE DATABASE mcs126_db; USE mcs126_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, LAG(a) OVER(ORDER BY a) pc FROM t1; a b pc NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs127_window_function_last_value.result b/mysql-test/columnstore/basic/r/mcs127_window_function_last_value.result index 0a98aae7b..999c12007 100644 --- a/mysql-test/columnstore/basic/r/mcs127_window_function_last_value.result +++ b/mysql-test/columnstore/basic/r/mcs127_window_function_last_value.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs127_db; CREATE DATABASE mcs127_db; USE mcs127_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, LAST_VALUE(b) OVER(ORDER BY a) last_value FROM t1; a b last_value NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs128_window_function_lead.result b/mysql-test/columnstore/basic/r/mcs128_window_function_lead.result index 04b930724..a85563d80 100644 --- a/mysql-test/columnstore/basic/r/mcs128_window_function_lead.result +++ b/mysql-test/columnstore/basic/r/mcs128_window_function_lead.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs128_db; CREATE DATABASE mcs128_db; USE mcs128_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, LEAD(a) OVER(ORDER BY a) lead_value FROM t1; a b lead_value NULL NULL a diff --git a/mysql-test/columnstore/basic/r/mcs129_window_function_nth_value.result b/mysql-test/columnstore/basic/r/mcs129_window_function_nth_value.result index ad4cfc75d..c4b57ff25 100644 --- a/mysql-test/columnstore/basic/r/mcs129_window_function_nth_value.result +++ b/mysql-test/columnstore/basic/r/mcs129_window_function_nth_value.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs129_db; CREATE DATABASE mcs129_db; USE mcs129_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, NTH_VALUE(a, 2) OVER(ORDER BY b DESC) second_value FROM t1; a b second_value d 10701 NULL diff --git a/mysql-test/columnstore/basic/r/mcs130_window_function_ntile.result b/mysql-test/columnstore/basic/r/mcs130_window_function_ntile.result index 5cc65fee2..6c055659d 100644 --- a/mysql-test/columnstore/basic/r/mcs130_window_function_ntile.result +++ b/mysql-test/columnstore/basic/r/mcs130_window_function_ntile.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs130_db; CREATE DATABASE mcs130_db; USE mcs130_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, NTILE(3) OVER(ORDER BY b DESC) ntile FROM t1; a b ntile d 10701 1 diff --git a/mysql-test/columnstore/basic/r/mcs131_window_function_percent_rank.result b/mysql-test/columnstore/basic/r/mcs131_window_function_percent_rank.result index 14344f0e4..c0d6622ac 100644 --- a/mysql-test/columnstore/basic/r/mcs131_window_function_percent_rank.result +++ b/mysql-test/columnstore/basic/r/mcs131_window_function_percent_rank.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs131_db; CREATE DATABASE mcs131_db; USE mcs131_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, PERCENT_RANK() OVER(ORDER BY a) percent_rank FROM t1; a b percent_rank NULL NULL 0.0000000000 diff --git a/mysql-test/columnstore/basic/r/mcs132_window_function_percentile_cont.result b/mysql-test/columnstore/basic/r/mcs132_window_function_percentile_cont.result index f5afdfc1c..05acf580d 100644 --- a/mysql-test/columnstore/basic/r/mcs132_window_function_percentile_cont.result +++ b/mysql-test/columnstore/basic/r/mcs132_window_function_percentile_cont.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs132_db; CREATE DATABASE mcs132_db; USE mcs132_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, PERCENTILE_CONT(1) WITHIN GROUP(ORDER BY b) OVER(PARTITION BY a DESC) pc FROM t1; a b pc NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs133_window_function_percentile_disc.result b/mysql-test/columnstore/basic/r/mcs133_window_function_percentile_disc.result index 41e857bb7..6a1e4269a 100644 --- a/mysql-test/columnstore/basic/r/mcs133_window_function_percentile_disc.result +++ b/mysql-test/columnstore/basic/r/mcs133_window_function_percentile_disc.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs133_db; CREATE DATABASE mcs133_db; USE mcs133_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, PERCENTILE_DISC(1) WITHIN GROUP(ORDER BY b) OVER(PARTITION BY a DESC) pd FROM t1; a b pd NULL NULL 2147483647 diff --git a/mysql-test/columnstore/basic/r/mcs134_window_function_rank.result b/mysql-test/columnstore/basic/r/mcs134_window_function_rank.result index 214889030..7b91648b1 100644 --- a/mysql-test/columnstore/basic/r/mcs134_window_function_rank.result +++ b/mysql-test/columnstore/basic/r/mcs134_window_function_rank.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs134_db; CREATE DATABASE mcs134_db; USE mcs134_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, RANK() OVER(ORDER BY a) rank FROM t1; a b rank NULL NULL 1 diff --git a/mysql-test/columnstore/basic/r/mcs135_window_function_row_number.result b/mysql-test/columnstore/basic/r/mcs135_window_function_row_number.result index de83deec3..45d45faf4 100644 --- a/mysql-test/columnstore/basic/r/mcs135_window_function_row_number.result +++ b/mysql-test/columnstore/basic/r/mcs135_window_function_row_number.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs135_db; CREATE DATABASE mcs135_db; USE mcs135_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 12),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 12),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, ROW_NUMBER() OVER(ORDER BY a) row_num FROM t1; a b row_num NULL NULL 1 diff --git a/mysql-test/columnstore/basic/r/mcs136_window_function_sum.result b/mysql-test/columnstore/basic/r/mcs136_window_function_sum.result index 19b59e80e..f73729dad 100644 --- a/mysql-test/columnstore/basic/r/mcs136_window_function_sum.result +++ b/mysql-test/columnstore/basic/r/mcs136_window_function_sum.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs136_db; CREATE DATABASE mcs136_db; USE mcs136_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, SUM(b) OVER(ORDER BY a) sum FROM t1; a b sum NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs137_window_function_count.result b/mysql-test/columnstore/basic/r/mcs137_window_function_count.result index e25c5856e..3cf4aa55e 100644 --- a/mysql-test/columnstore/basic/r/mcs137_window_function_count.result +++ b/mysql-test/columnstore/basic/r/mcs137_window_function_count.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs137_db; CREATE DATABASE mcs137_db; USE mcs137_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, COUNT(b) OVER(ORDER BY a) count FROM t1; a b count NULL NULL 0 diff --git a/mysql-test/columnstore/basic/r/mcs138_window_function_max.result b/mysql-test/columnstore/basic/r/mcs138_window_function_max.result index 39fb757ad..30a9dfd7e 100644 --- a/mysql-test/columnstore/basic/r/mcs138_window_function_max.result +++ b/mysql-test/columnstore/basic/r/mcs138_window_function_max.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs138_db; CREATE DATABASE mcs138_db; USE mcs138_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, MAX(b) OVER(ORDER BY a) max FROM t1; a b max NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs139_window_function_min.result b/mysql-test/columnstore/basic/r/mcs139_window_function_min.result index 2d3204592..a35e4a78d 100644 --- a/mysql-test/columnstore/basic/r/mcs139_window_function_min.result +++ b/mysql-test/columnstore/basic/r/mcs139_window_function_min.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs139_db; CREATE DATABASE mcs139_db; USE mcs139_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, MIN(b) OVER(ORDER BY a) min FROM t1; a b min NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs140_window_function_median.result b/mysql-test/columnstore/basic/r/mcs140_window_function_median.result index 5d2e58753..25007c7f0 100644 --- a/mysql-test/columnstore/basic/r/mcs140_window_function_median.result +++ b/mysql-test/columnstore/basic/r/mcs140_window_function_median.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs140_db; CREATE DATABASE mcs140_db; USE mcs140_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, MEDIAN(b) OVER(PARTITION BY b) median FROM t1; a b median NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs141_window_function_std.result b/mysql-test/columnstore/basic/r/mcs141_window_function_std.result index da4321cbf..594aabde5 100644 --- a/mysql-test/columnstore/basic/r/mcs141_window_function_std.result +++ b/mysql-test/columnstore/basic/r/mcs141_window_function_std.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs141_db; CREATE DATABASE mcs141_db; USE mcs141_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, STD(b) OVER(PARTITION BY a) pd FROM t1; a b pd NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs142_window_function_stddev.result b/mysql-test/columnstore/basic/r/mcs142_window_function_stddev.result index 83c8f19f0..8f5f9d7ef 100644 --- a/mysql-test/columnstore/basic/r/mcs142_window_function_stddev.result +++ b/mysql-test/columnstore/basic/r/mcs142_window_function_stddev.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs142_db; CREATE DATABASE mcs142_db; USE mcs142_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, STDDEV(b) OVER(PARTITION BY a) pd FROM t1; a b pd NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs143_window_function_stddev_pop.result b/mysql-test/columnstore/basic/r/mcs143_window_function_stddev_pop.result index c8eacd160..419e5f201 100644 --- a/mysql-test/columnstore/basic/r/mcs143_window_function_stddev_pop.result +++ b/mysql-test/columnstore/basic/r/mcs143_window_function_stddev_pop.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs143_db; CREATE DATABASE mcs143_db; USE mcs143_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, STDDEV_POP(b) OVER(PARTITION BY a) pd FROM t1; a b pd NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs144_window_function_stddev_samp.result b/mysql-test/columnstore/basic/r/mcs144_window_function_stddev_samp.result index e9edb1a45..b48b0ffb8 100644 --- a/mysql-test/columnstore/basic/r/mcs144_window_function_stddev_samp.result +++ b/mysql-test/columnstore/basic/r/mcs144_window_function_stddev_samp.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs144_db; CREATE DATABASE mcs144_db; USE mcs144_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, STDDEV_SAMP(b) OVER(PARTITION BY a) pd FROM t1; a b pd NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs145_window_function_variance.result b/mysql-test/columnstore/basic/r/mcs145_window_function_variance.result index 2d0e11fb1..fb81f6d43 100644 --- a/mysql-test/columnstore/basic/r/mcs145_window_function_variance.result +++ b/mysql-test/columnstore/basic/r/mcs145_window_function_variance.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs145_db; CREATE DATABASE mcs145_db; USE mcs145_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, VARIANCE(b) OVER(PARTITION BY a) variance FROM t1; a b variance NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs146_window_function_var_pop.result b/mysql-test/columnstore/basic/r/mcs146_window_function_var_pop.result index bcdcb91a4..5adfe2f73 100644 --- a/mysql-test/columnstore/basic/r/mcs146_window_function_var_pop.result +++ b/mysql-test/columnstore/basic/r/mcs146_window_function_var_pop.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs146_db; CREATE DATABASE mcs146_db; USE mcs146_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, VAR_POP(b) OVER(PARTITION BY a) var_pop FROM t1; a b var_pop NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs147_window_function_var_samp.result b/mysql-test/columnstore/basic/r/mcs147_window_function_var_samp.result index 816230b5c..3d342b9a4 100644 --- a/mysql-test/columnstore/basic/r/mcs147_window_function_var_samp.result +++ b/mysql-test/columnstore/basic/r/mcs147_window_function_var_samp.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs147_db; CREATE DATABASE mcs147_db; USE mcs147_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, VAR_SAMP(b) OVER(PARTITION BY a) var_samp FROM t1; a b var_samp NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs148_window_function_bit_or.result b/mysql-test/columnstore/basic/r/mcs148_window_function_bit_or.result index 30024d57a..f4e0af05e 100644 --- a/mysql-test/columnstore/basic/r/mcs148_window_function_bit_or.result +++ b/mysql-test/columnstore/basic/r/mcs148_window_function_bit_or.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs148_db; CREATE DATABASE mcs148_db; USE mcs148_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, BIT_OR(b) OVER(PARTITION BY a) FROM t1; ERROR HY000: Internal error: MCS-9018: Window Function 'BIT_OR' is currently not supported in Columnstore. SELECT a, b, BIT_OR(b) OVER(ORDER BY a) FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs149_window_function_bit_and.result b/mysql-test/columnstore/basic/r/mcs149_window_function_bit_and.result index 958fe2c78..54b43f170 100644 --- a/mysql-test/columnstore/basic/r/mcs149_window_function_bit_and.result +++ b/mysql-test/columnstore/basic/r/mcs149_window_function_bit_and.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs149_db; CREATE DATABASE mcs149_db; USE mcs149_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, BIT_AND(b) OVER(PARTITION BY a) FROM t1; ERROR HY000: Internal error: MCS-9018: Window Function 'BIT_AND' is currently not supported in Columnstore. SELECT a, b, BIT_AND(b) OVER(ORDER BY a) FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs150_window_function_bit_xor.result b/mysql-test/columnstore/basic/r/mcs150_window_function_bit_xor.result index 5719db2f4..f2ef719d6 100644 --- a/mysql-test/columnstore/basic/r/mcs150_window_function_bit_xor.result +++ b/mysql-test/columnstore/basic/r/mcs150_window_function_bit_xor.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs150_db; CREATE DATABASE mcs150_db; USE mcs150_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('b', 15),('b', 16),('b', 17),('b', 18),('a', 19); SELECT a, b, BIT_XOR(b) OVER(PARTITION BY a) FROM t1; ERROR HY000: Internal error: MCS-9018: Window Function 'BIT_XOR' is currently not supported in Columnstore. SELECT a, b, BIT_XOR(b) OVER(ORDER BY a) FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs151_window_function_avg.result b/mysql-test/columnstore/basic/r/mcs151_window_function_avg.result index 7654a1437..f34dae260 100644 --- a/mysql-test/columnstore/basic/r/mcs151_window_function_avg.result +++ b/mysql-test/columnstore/basic/r/mcs151_window_function_avg.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs151_db; CREATE DATABASE mcs151_db; USE mcs151_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); +INSERT INTO t1 VALUES (NULL, NULL),('a', 123),('a', 1),('b', 123),('c', 1861),('c', 1991),('d', 10701),('d', 1071),('a', 92); SELECT a, b, AVG(b) OVER(ORDER BY a) avg FROM t1; a b avg NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs152_win_frame_avg.result b/mysql-test/columnstore/basic/r/mcs152_win_frame_avg.result index ac3499edd..7e662dc3b 100644 --- a/mysql-test/columnstore/basic/r/mcs152_win_frame_avg.result +++ b/mysql-test/columnstore/basic/r/mcs152_win_frame_avg.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs152_db; CREATE DATABASE mcs152_db; USE mcs152_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, AVG(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) avg FROM t1; a b avg NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs153_win_frame_bit_and.result b/mysql-test/columnstore/basic/r/mcs153_win_frame_bit_and.result index 26587c497..465283246 100644 --- a/mysql-test/columnstore/basic/r/mcs153_win_frame_bit_and.result +++ b/mysql-test/columnstore/basic/r/mcs153_win_frame_bit_and.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs153_db; CREATE DATABASE mcs153_db; USE mcs153_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, BIT_AND(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) bit_and FROM t1; ERROR HY000: Internal error: MCS-9018: Window Function 'BIT_AND' is currently not supported in Columnstore. SELECT a, b, BIT_AND(b) OVER(ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) bit_and FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs154_win_frame_bit_or.result b/mysql-test/columnstore/basic/r/mcs154_win_frame_bit_or.result index 40d8d40ef..54da5dbf2 100644 --- a/mysql-test/columnstore/basic/r/mcs154_win_frame_bit_or.result +++ b/mysql-test/columnstore/basic/r/mcs154_win_frame_bit_or.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs154_db; CREATE DATABASE mcs154_db; USE mcs154_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, BIT_OR(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) bit_or FROM t1; ERROR HY000: Internal error: MCS-9018: Window Function 'BIT_OR' is currently not supported in Columnstore. SELECT a, b, BIT_OR(b) OVER(ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) bit_or FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs155_win_frame_bit_xor.result b/mysql-test/columnstore/basic/r/mcs155_win_frame_bit_xor.result index c30d16aa6..8e8d8022e 100644 --- a/mysql-test/columnstore/basic/r/mcs155_win_frame_bit_xor.result +++ b/mysql-test/columnstore/basic/r/mcs155_win_frame_bit_xor.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs155_db; CREATE DATABASE mcs155_db; USE mcs155_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, BIT_XOR(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) BIT_XOR FROM t1; ERROR HY000: Internal error: MCS-9018: Window Function 'BIT_XOR' is currently not supported in Columnstore. SELECT a, b, BIT_XOR(b) OVER(ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) BIT_XOR FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs156_win_frame_count.result b/mysql-test/columnstore/basic/r/mcs156_win_frame_count.result index f64fbe2e2..8074d814d 100644 --- a/mysql-test/columnstore/basic/r/mcs156_win_frame_count.result +++ b/mysql-test/columnstore/basic/r/mcs156_win_frame_count.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs156_db; CREATE DATABASE mcs156_db; USE mcs156_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, COUNT(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) count FROM t1; a b count NULL NULL 0 diff --git a/mysql-test/columnstore/basic/r/mcs157_win_frame_lead.result b/mysql-test/columnstore/basic/r/mcs157_win_frame_lead.result index 4fc130991..aa51027b0 100644 --- a/mysql-test/columnstore/basic/r/mcs157_win_frame_lead.result +++ b/mysql-test/columnstore/basic/r/mcs157_win_frame_lead.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs157_db; CREATE DATABASE mcs157_db; USE mcs157_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, LEAD(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) lead_value FROM t1; a b lead_value NULL NULL 12 diff --git a/mysql-test/columnstore/basic/r/mcs158_win_frame_max.result b/mysql-test/columnstore/basic/r/mcs158_win_frame_max.result index 1f528682d..85cd9678e 100644 --- a/mysql-test/columnstore/basic/r/mcs158_win_frame_max.result +++ b/mysql-test/columnstore/basic/r/mcs158_win_frame_max.result @@ -5,7 +5,7 @@ CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, MAX(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -16,7 +16,7 @@ b 18 18 a 19 19 SELECT a, b, MAX(b) OVER(ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) max FROM t1; a b max -NULL NULL 19 + NULL 19 a 12 19 a 13 19 b 14 19 @@ -27,7 +27,7 @@ b 18 19 a 19 19 SELECT a, b, MAX(b) OVER(ORDER BY b ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -38,7 +38,7 @@ b 18 18 a 19 19 SELECT a, b, MAX(b) OVER(ORDER BY b ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) max FROM t1; a b max -NULL NULL 12 + NULL 12 a 12 13 a 13 14 b 14 15 @@ -49,7 +49,7 @@ b 18 19 a 19 19 SELECT a, b, MAX(b) OVER(ORDER BY b ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) max FROM t1; a b max -NULL NULL 19 + NULL 19 a 12 19 a 13 19 b 14 19 @@ -68,7 +68,7 @@ c 15 19 b 14 19 a 13 19 a 12 19 -NULL NULL 19 + NULL 19 SELECT a, b, MAX(b) OVER(ORDER BY b DESC RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) max FROM t1; a b max a 19 19 @@ -79,7 +79,7 @@ c 15 15 b 14 14 a 13 13 a 12 12 -NULL NULL NULL + NULL NULL SELECT a, b, MAX(b) OVER(ORDER BY b DESC ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) max FROM t1; a b max a 19 19 @@ -90,7 +90,7 @@ c 15 16 b 14 15 a 13 14 a 12 13 -NULL NULL 12 + NULL 12 SELECT a, b, MAX(b) OVER(ORDER BY b DESC ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) max FROM t1; a b max a 19 19 @@ -101,7 +101,7 @@ c 15 16 b 14 15 a 13 14 a 12 13 -NULL NULL 12 + NULL 12 SELECT a, b, MAX(b) OVER(ORDER BY b DESC ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) max FROM t1; a b max a 19 19 @@ -112,10 +112,10 @@ c 15 16 b 14 15 a 13 14 a 12 13 -NULL NULL 12 + NULL 12 SELECT a, b, MAX(b) OVER(PARTITION BY a ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 a 19 19 @@ -126,7 +126,7 @@ d 16 16 d 17 17 SELECT a, b, MAX(b) OVER(PARTITION BY b ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -137,7 +137,7 @@ b 18 18 a 19 19 SELECT a, b, MAX(b) OVER(PARTITION BY a ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 19 a 13 19 a 19 19 @@ -148,7 +148,7 @@ d 16 17 d 17 17 SELECT a, b, MAX(b) OVER(PARTITION BY b ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -159,7 +159,7 @@ b 18 18 a 19 19 SELECT a, b, MAX(b) OVER(PARTITION BY a ORDER BY b ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 a 19 19 @@ -170,7 +170,7 @@ d 16 16 d 17 17 SELECT a, b, MAX(b) OVER(PARTITION BY b ORDER BY b ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -181,7 +181,7 @@ b 18 18 a 19 19 SELECT a, b, MAX(b) OVER(PARTITION BY a ORDER BY b ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 13 a 13 19 a 19 19 @@ -192,7 +192,7 @@ d 16 17 d 17 17 SELECT a, b, MAX(b) OVER(PARTITION BY b ORDER BY b ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -203,7 +203,7 @@ b 18 18 a 19 19 SELECT a, b, MAX(b) OVER(PARTITION BY a ORDER BY b ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 19 a 13 19 a 19 19 @@ -214,7 +214,7 @@ d 16 17 d 17 17 SELECT a, b, MAX(b) OVER(PARTITION BY b ORDER BY b ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) max FROM t1; a b max -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 diff --git a/mysql-test/columnstore/basic/r/mcs159_win_frame_min.result b/mysql-test/columnstore/basic/r/mcs159_win_frame_min.result index 4bd6a8e4a..7852adde4 100644 --- a/mysql-test/columnstore/basic/r/mcs159_win_frame_min.result +++ b/mysql-test/columnstore/basic/r/mcs159_win_frame_min.result @@ -5,7 +5,7 @@ CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, MIN(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 12 b 14 12 @@ -16,7 +16,7 @@ b 18 12 a 19 12 SELECT a, b, MIN(b) OVER(ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) min FROM t1; a b min -NULL NULL 12 + NULL 12 a 12 12 a 13 13 b 14 14 @@ -27,7 +27,7 @@ b 18 18 a 19 19 SELECT a, b, MIN(b) OVER(ORDER BY b ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 12 b 14 13 @@ -38,7 +38,7 @@ b 18 17 a 19 18 SELECT a, b, MIN(b) OVER(ORDER BY b ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) min FROM t1; a b min -NULL NULL 12 + NULL 12 a 12 12 a 13 12 b 14 13 @@ -49,7 +49,7 @@ b 18 17 a 19 18 SELECT a, b, MIN(b) OVER(ORDER BY b ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) min FROM t1; a b min -NULL NULL 12 + NULL 12 a 12 12 a 13 12 b 14 13 @@ -68,7 +68,7 @@ c 15 15 b 14 14 a 13 13 a 12 12 -NULL NULL 12 + NULL 12 SELECT a, b, MIN(b) OVER(ORDER BY b DESC RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) min FROM t1; a b min a 19 12 @@ -79,7 +79,7 @@ c 15 12 b 14 12 a 13 12 a 12 12 -NULL NULL NULL + NULL NULL SELECT a, b, MIN(b) OVER(ORDER BY b DESC ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) min FROM t1; a b min a 19 19 @@ -90,7 +90,7 @@ c 15 15 b 14 14 a 13 13 a 12 12 -NULL NULL 12 + NULL 12 SELECT a, b, MIN(b) OVER(ORDER BY b DESC ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) min FROM t1; a b min a 19 18 @@ -101,7 +101,7 @@ c 15 14 b 14 13 a 13 12 a 12 12 -NULL NULL 12 + NULL 12 SELECT a, b, MIN(b) OVER(ORDER BY b DESC ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) min FROM t1; a b min a 19 12 @@ -112,10 +112,10 @@ c 15 12 b 14 12 a 13 12 a 12 12 -NULL NULL 12 + NULL 12 SELECT a, b, MIN(b) OVER(PARTITION BY a ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 12 a 19 12 @@ -126,7 +126,7 @@ d 16 16 d 17 16 SELECT a, b, MIN(b) OVER(PARTITION BY b ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -137,7 +137,7 @@ b 18 18 a 19 19 SELECT a, b, MIN(b) OVER(PARTITION BY a ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 13 a 19 19 @@ -148,7 +148,7 @@ d 16 16 d 17 17 SELECT a, b, MIN(b) OVER(PARTITION BY b ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -159,7 +159,7 @@ b 18 18 a 19 19 SELECT a, b, MIN(b) OVER(PARTITION BY a ORDER BY b ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 12 a 19 13 @@ -170,7 +170,7 @@ d 16 16 d 17 16 SELECT a, b, MIN(b) OVER(PARTITION BY b ORDER BY b ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -181,7 +181,7 @@ b 18 18 a 19 19 SELECT a, b, MIN(b) OVER(PARTITION BY a ORDER BY b ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 12 a 19 13 @@ -192,7 +192,7 @@ d 16 16 d 17 16 SELECT a, b, MIN(b) OVER(PARTITION BY b ORDER BY b ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 @@ -203,7 +203,7 @@ b 18 18 a 19 19 SELECT a, b, MIN(b) OVER(PARTITION BY a ORDER BY b ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 12 a 19 13 @@ -214,7 +214,7 @@ d 16 16 d 17 16 SELECT a, b, MIN(b) OVER(PARTITION BY b ORDER BY b ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING) min FROM t1; a b min -NULL NULL NULL + NULL NULL a 12 12 a 13 13 b 14 14 diff --git a/mysql-test/columnstore/basic/r/mcs160_win_frame_ntile.result b/mysql-test/columnstore/basic/r/mcs160_win_frame_ntile.result index 89e5ce299..eaf230557 100644 --- a/mysql-test/columnstore/basic/r/mcs160_win_frame_ntile.result +++ b/mysql-test/columnstore/basic/r/mcs160_win_frame_ntile.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs160_db; CREATE DATABASE mcs160_db; USE mcs160_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, NTILE(3) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) lead_value FROM t1; ERROR HY000: Window frame is not allowed with 'ntile' SELECT a, b, NTILE(3) OVER(ORDER BY b RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) lead_value FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs161_win_frame_std.result b/mysql-test/columnstore/basic/r/mcs161_win_frame_std.result index f31590aec..29637fec1 100644 --- a/mysql-test/columnstore/basic/r/mcs161_win_frame_std.result +++ b/mysql-test/columnstore/basic/r/mcs161_win_frame_std.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs161_db; CREATE DATABASE mcs161_db; USE mcs161_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, STD(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) std FROM t1; a b std NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs162_win_frame_stddev.result b/mysql-test/columnstore/basic/r/mcs162_win_frame_stddev.result index 59c661e80..b98dea009 100644 --- a/mysql-test/columnstore/basic/r/mcs162_win_frame_stddev.result +++ b/mysql-test/columnstore/basic/r/mcs162_win_frame_stddev.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs162_db; CREATE DATABASE mcs162_db; USE mcs162_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, STDDEV(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) stddev FROM t1; a b stddev NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs163_win_frame_stddev_pop.result b/mysql-test/columnstore/basic/r/mcs163_win_frame_stddev_pop.result index 10c4aa803..cd97a6746 100644 --- a/mysql-test/columnstore/basic/r/mcs163_win_frame_stddev_pop.result +++ b/mysql-test/columnstore/basic/r/mcs163_win_frame_stddev_pop.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs163_db; CREATE DATABASE mcs163_db; USE mcs163_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, STDDEV_POP(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) STDDEV_POP FROM t1; a b STDDEV_POP NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs164_win_frame_stddev_samp.result b/mysql-test/columnstore/basic/r/mcs164_win_frame_stddev_samp.result index 4d71fbaae..30514b254 100644 --- a/mysql-test/columnstore/basic/r/mcs164_win_frame_stddev_samp.result +++ b/mysql-test/columnstore/basic/r/mcs164_win_frame_stddev_samp.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs164_db; CREATE DATABASE mcs164_db; USE mcs164_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, STDDEV_SAMP(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) STDDEV_SAMP FROM t1; a b STDDEV_SAMP NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs165_win_frame_sum.result b/mysql-test/columnstore/basic/r/mcs165_win_frame_sum.result index 8fcdd738e..1e7581f20 100644 --- a/mysql-test/columnstore/basic/r/mcs165_win_frame_sum.result +++ b/mysql-test/columnstore/basic/r/mcs165_win_frame_sum.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs165_db; CREATE DATABASE mcs165_db; USE mcs165_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, SUM(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) sum FROM t1; a b sum NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs166_win_frame_var_pop.result b/mysql-test/columnstore/basic/r/mcs166_win_frame_var_pop.result index c7c34cc58..1a0e83b10 100644 --- a/mysql-test/columnstore/basic/r/mcs166_win_frame_var_pop.result +++ b/mysql-test/columnstore/basic/r/mcs166_win_frame_var_pop.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs166_db; CREATE DATABASE mcs166_db; USE mcs166_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, VAR_POP(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) VAR_POP FROM t1; a b VAR_POP NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs167_win_frame_var_samp.result b/mysql-test/columnstore/basic/r/mcs167_win_frame_var_samp.result index e4f96ab36..343220918 100644 --- a/mysql-test/columnstore/basic/r/mcs167_win_frame_var_samp.result +++ b/mysql-test/columnstore/basic/r/mcs167_win_frame_var_samp.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs167_db; CREATE DATABASE mcs167_db; USE mcs167_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, VAR_SAMP(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) VAR_SAMP FROM t1; a b VAR_SAMP NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs168_win_frame_variance.result b/mysql-test/columnstore/basic/r/mcs168_win_frame_variance.result index b71df5ca1..36ec5142f 100644 --- a/mysql-test/columnstore/basic/r/mcs168_win_frame_variance.result +++ b/mysql-test/columnstore/basic/r/mcs168_win_frame_variance.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs168_db; CREATE DATABASE mcs168_db; USE mcs168_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, b, VARIANCE(b) OVER(ORDER BY b RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) VARIANCE FROM t1; a b VARIANCE NULL NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs169_bin_functions.result b/mysql-test/columnstore/basic/r/mcs169_bin_functions.result index e34fc6a84..5afd5990c 100644 --- a/mysql-test/columnstore/basic/r/mcs169_bin_functions.result +++ b/mysql-test/columnstore/basic/r/mcs169_bin_functions.result @@ -3,7 +3,7 @@ CREATE DATABASE mcs169_db; USE mcs169_db; SET default_storage_engine=Columnstore; CREATE TABLE t1 (a CHAR(1), b INT, c DATETIME, d DOUBLE); -INSERT INTO t1 VALUES ('', NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); +INSERT INTO t1 VALUES (NULL, NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/columnstore/basic/r/mcs171_null_functions.result b/mysql-test/columnstore/basic/r/mcs171_null_functions.result index a30d06e47..a20b3f728 100644 --- a/mysql-test/columnstore/basic/r/mcs171_null_functions.result +++ b/mysql-test/columnstore/basic/r/mcs171_null_functions.result @@ -3,7 +3,7 @@ CREATE DATABASE mcs171_db; USE mcs171_db; SET default_storage_engine=Columnstore; CREATE TABLE t1 (a CHAR(1), b INT, c DATETIME, d DOUBLE); -INSERT INTO t1 VALUES ('', NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); +INSERT INTO t1 VALUES (NULL, NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/columnstore/basic/r/mcs173_coalesce_function.result b/mysql-test/columnstore/basic/r/mcs173_coalesce_function.result index 7cd1f0ce2..cf2851ce4 100644 --- a/mysql-test/columnstore/basic/r/mcs173_coalesce_function.result +++ b/mysql-test/columnstore/basic/r/mcs173_coalesce_function.result @@ -3,7 +3,7 @@ CREATE DATABASE mcs173_db; USE mcs173_db; SET default_storage_engine=Columnstore; CREATE TABLE t1 (a CHAR(1), b INT, c DATETIME, d DOUBLE); -INSERT INTO t1 VALUES ('', NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); +INSERT INTO t1 VALUES (NULL, NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/columnstore/basic/r/mcs174_case_function.result b/mysql-test/columnstore/basic/r/mcs174_case_function.result index 5af7e78d4..57cfe50ef 100644 --- a/mysql-test/columnstore/basic/r/mcs174_case_function.result +++ b/mysql-test/columnstore/basic/r/mcs174_case_function.result @@ -3,7 +3,7 @@ CREATE DATABASE mcs174_db; USE mcs174_db; SET default_storage_engine=Columnstore; CREATE TABLE t1 (a CHAR(1), b INT, c DATETIME, d DOUBLE); -INSERT INTO t1 VALUES ('', NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); +INSERT INTO t1 VALUES (NULL, NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/columnstore/basic/r/mcs176_if_function.result b/mysql-test/columnstore/basic/r/mcs176_if_function.result index c469a036a..5a3d8de22 100644 --- a/mysql-test/columnstore/basic/r/mcs176_if_function.result +++ b/mysql-test/columnstore/basic/r/mcs176_if_function.result @@ -3,7 +3,7 @@ CREATE DATABASE mcs176_db; USE mcs176_db; SET default_storage_engine=Columnstore; CREATE TABLE t1 (a CHAR(1), b INT, c DATETIME, d DOUBLE); -INSERT INTO t1 VALUES ('', NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); +INSERT INTO t1 VALUES (NULL, NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/columnstore/basic/r/mcs180_ascii_function.result b/mysql-test/columnstore/basic/r/mcs180_ascii_function.result index 9d803f496..17145ddfd 100644 --- a/mysql-test/columnstore/basic/r/mcs180_ascii_function.result +++ b/mysql-test/columnstore/basic/r/mcs180_ascii_function.result @@ -3,7 +3,7 @@ CREATE DATABASE mcs180_db; USE mcs180_db; SET default_storage_engine=Columnstore; CREATE TABLE t1 (a CHAR(1), b INT); -INSERT INTO t1 VALUES ('', NULL), ('m', 6), ('N', 5), ('o', 4); +INSERT INTO t1 VALUES (NULL, NULL), ('m', 6), ('N', 5), ('o', 4); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/columnstore/basic/r/mcs182_char_length_function.result b/mysql-test/columnstore/basic/r/mcs182_char_length_function.result index fc5be2156..9ca0028aa 100644 --- a/mysql-test/columnstore/basic/r/mcs182_char_length_function.result +++ b/mysql-test/columnstore/basic/r/mcs182_char_length_function.result @@ -33,7 +33,7 @@ bbbbbbbbbb 10 cccccccccccccccccccc 20 DROP TABLE t1; CREATE TABLE t1 (a CHAR(1), b INT, c DATETIME, d DOUBLE); -INSERT INTO t1 VALUES ('', NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); +INSERT INTO t1 VALUES (NULL, NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/columnstore/basic/r/mcs188_avg_function.result b/mysql-test/columnstore/basic/r/mcs188_avg_function.result index 9380e70f6..24f54490c 100644 --- a/mysql-test/columnstore/basic/r/mcs188_avg_function.result +++ b/mysql-test/columnstore/basic/r/mcs188_avg_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs188_db; CREATE DATABASE mcs188_db; USE mcs188_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT AVG(DISTINCT a) FROM t1; AVG(DISTINCT a) 4.1667 diff --git a/mysql-test/columnstore/basic/r/mcs189_sum_function.result b/mysql-test/columnstore/basic/r/mcs189_sum_function.result index 80539810b..27c977ba5 100644 --- a/mysql-test/columnstore/basic/r/mcs189_sum_function.result +++ b/mysql-test/columnstore/basic/r/mcs189_sum_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs189_db; CREATE DATABASE mcs189_db; USE mcs189_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT SUM(DISTINCT a) FROM t1; SUM(DISTINCT a) 25 diff --git a/mysql-test/columnstore/basic/r/mcs190_max_function.result b/mysql-test/columnstore/basic/r/mcs190_max_function.result index 9c754b320..7fe5d18cc 100644 --- a/mysql-test/columnstore/basic/r/mcs190_max_function.result +++ b/mysql-test/columnstore/basic/r/mcs190_max_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs190_db; CREATE DATABASE mcs190_db; USE mcs190_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT MAX(DISTINCT a) FROM t1; MAX(DISTINCT a) 7 diff --git a/mysql-test/columnstore/basic/r/mcs191_min_function.result b/mysql-test/columnstore/basic/r/mcs191_min_function.result index eabe697a4..311e43a24 100644 --- a/mysql-test/columnstore/basic/r/mcs191_min_function.result +++ b/mysql-test/columnstore/basic/r/mcs191_min_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs191_db; CREATE DATABASE mcs191_db; USE mcs191_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT MIN(DISTINCT a) FROM t1; MIN(DISTINCT a) 1 diff --git a/mysql-test/columnstore/basic/r/mcs192_corr_function.result b/mysql-test/columnstore/basic/r/mcs192_corr_function.result index 1fa14a8fe..739aa2629 100644 --- a/mysql-test/columnstore/basic/r/mcs192_corr_function.result +++ b/mysql-test/columnstore/basic/r/mcs192_corr_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs192_db; CREATE DATABASE mcs192_db; USE mcs192_db; CREATE TABLE t1 (x INT, y MEDIUMINT, z CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, NULL, ''),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); +INSERT INTO t1 VALUES (NULL, NULL, NULL),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); SELECT CORR(y, x) FROM t1; CORR(y, x) 0.9907002406503415 diff --git a/mysql-test/columnstore/basic/r/mcs193_covar_pop_function.result b/mysql-test/columnstore/basic/r/mcs193_covar_pop_function.result index f15f5eb84..1d05dc398 100644 --- a/mysql-test/columnstore/basic/r/mcs193_covar_pop_function.result +++ b/mysql-test/columnstore/basic/r/mcs193_covar_pop_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs193_db; CREATE DATABASE mcs193_db; USE mcs193_db; CREATE TABLE t1 (x INT, y MEDIUMINT, z CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, NULL, ''),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); +INSERT INTO t1 VALUES (NULL, NULL, NULL),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); SELECT COVAR_POP(y, x) FROM t1; COVAR_POP(y, x) 40.285714285714285 diff --git a/mysql-test/columnstore/basic/r/mcs194_covar_samp_function.result b/mysql-test/columnstore/basic/r/mcs194_covar_samp_function.result index 3c6799fb5..0641f16da 100644 --- a/mysql-test/columnstore/basic/r/mcs194_covar_samp_function.result +++ b/mysql-test/columnstore/basic/r/mcs194_covar_samp_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs194_db; CREATE DATABASE mcs194_db; USE mcs194_db; CREATE TABLE t1 (x INT, y MEDIUMINT, z CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, NULL, ''),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); +INSERT INTO t1 VALUES (NULL, NULL, NULL),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); SELECT COVAR_SAMP(y, x) FROM t1; COVAR_SAMP(y, x) 47 diff --git a/mysql-test/columnstore/basic/r/mcs195_regr_avgx_avgy_function.result b/mysql-test/columnstore/basic/r/mcs195_regr_avgx_avgy_function.result index 8b4964ec2..5cfa898a5 100644 --- a/mysql-test/columnstore/basic/r/mcs195_regr_avgx_avgy_function.result +++ b/mysql-test/columnstore/basic/r/mcs195_regr_avgx_avgy_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs195_db; CREATE DATABASE mcs195_db; USE mcs195_db; CREATE TABLE t1 (x INT, y MEDIUMINT, z CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, NULL, ''),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); +INSERT INTO t1 VALUES (NULL, NULL, NULL),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); SELECT REGR_AVGX(y, x) FROM t1; REGR_AVGX(y, x) 55.5714 diff --git a/mysql-test/columnstore/basic/r/mcs196_regr_sxx_sxy_syy_functions.result b/mysql-test/columnstore/basic/r/mcs196_regr_sxx_sxy_syy_functions.result index 28bfaef4e..b05b4d0a0 100644 --- a/mysql-test/columnstore/basic/r/mcs196_regr_sxx_sxy_syy_functions.result +++ b/mysql-test/columnstore/basic/r/mcs196_regr_sxx_sxy_syy_functions.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs196_db; CREATE DATABASE mcs196_db; USE mcs196_db; CREATE TABLE t1 (x INT, y MEDIUMINT, z CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, NULL, ''),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); +INSERT INTO t1 VALUES (NULL, NULL, NULL),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); SELECT REGR_SXX(y, x) FROM t1; REGR_SXX(y, x) 2893.714285714286 diff --git a/mysql-test/columnstore/basic/r/mcs197_regr_count_function.result b/mysql-test/columnstore/basic/r/mcs197_regr_count_function.result index 4937e61be..09b5a7dc3 100644 --- a/mysql-test/columnstore/basic/r/mcs197_regr_count_function.result +++ b/mysql-test/columnstore/basic/r/mcs197_regr_count_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs197_db; CREATE DATABASE mcs197_db; USE mcs197_db; CREATE TABLE t1 (x INT, y MEDIUMINT, z CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, NULL, ''),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); +INSERT INTO t1 VALUES (NULL, NULL, NULL),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); SELECT REGR_COUNT(y, x) FROM t1; REGR_COUNT(y, x) 7 diff --git a/mysql-test/columnstore/basic/r/mcs198_regr_intercept_function.result b/mysql-test/columnstore/basic/r/mcs198_regr_intercept_function.result index 1abdb090f..10e8601a2 100644 --- a/mysql-test/columnstore/basic/r/mcs198_regr_intercept_function.result +++ b/mysql-test/columnstore/basic/r/mcs198_regr_intercept_function.result @@ -8,12 +8,12 @@ REGR_INTERCEPT(y, x) -1.415580568720379 SELECT z, REGR_INTERCEPT(y, x) FROM t1 GROUP BY z ORDER BY z; z REGR_INTERCEPT(y, x) -NULL NULL + NULL aaa -1.1792849631966351 bbb -2.3333333333333335 SELECT z, REGR_INTERCEPT(y, x) OVER (PARTITION BY z ORDER BY z) FROM t1; z REGR_INTERCEPT(y, x) OVER (PARTITION BY z ORDER BY z) -NULL NULL + NULL aaa -1.1792849631966351 aaa -1.1792849631966351 aaa -1.1792849631966351 diff --git a/mysql-test/columnstore/basic/r/mcs199_regr_r2_function.result b/mysql-test/columnstore/basic/r/mcs199_regr_r2_function.result index 1a56dc233..368154a74 100644 --- a/mysql-test/columnstore/basic/r/mcs199_regr_r2_function.result +++ b/mysql-test/columnstore/basic/r/mcs199_regr_r2_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs199_db; CREATE DATABASE mcs199_db; USE mcs199_db; CREATE TABLE t1 (x INT, y MEDIUMINT, z CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, NULL, ''),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); +INSERT INTO t1 VALUES (NULL, NULL, NULL),(20, 1, 'aaa'),(39, 2, 'aaa'),(48, 3, 'bbb'),(57, 4, 'bbb'),(66, 5, 'aaa'),(75, 6, 'aaa'),(84, 7, 'bbb'); SELECT REGR_R2(y, x) FROM t1; REGR_R2(y, x) 0.9814869668246445 diff --git a/mysql-test/columnstore/basic/r/mcs200_regr_slope_function.result b/mysql-test/columnstore/basic/r/mcs200_regr_slope_function.result index abf35e1db..cc1127436 100644 --- a/mysql-test/columnstore/basic/r/mcs200_regr_slope_function.result +++ b/mysql-test/columnstore/basic/r/mcs200_regr_slope_function.result @@ -8,12 +8,12 @@ REGR_SLOPE(y, x) 0.09745260663507109 SELECT z, REGR_SLOPE(y, x) FROM t1 GROUP BY z ORDER BY z; z REGR_SLOPE(y, x) -NULL NULL + NULL aaa 0.0935856992639327 bbb 0.1111111111111111 SELECT z, REGR_SLOPE(y, x) OVER (PARTITION BY z ORDER BY z) FROM t1; z REGR_SLOPE(y, x) OVER (PARTITION BY z ORDER BY z) -NULL NULL + NULL aaa 0.0935856992639327 aaa 0.0935856992639327 aaa 0.0935856992639327 diff --git a/mysql-test/columnstore/basic/r/mcs205_inet_aton_function.result b/mysql-test/columnstore/basic/r/mcs205_inet_aton_function.result index efa27d89b..229f958e2 100644 --- a/mysql-test/columnstore/basic/r/mcs205_inet_aton_function.result +++ b/mysql-test/columnstore/basic/r/mcs205_inet_aton_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs205_db; CREATE DATABASE mcs205_db; USE mcs205_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT a, INET_ATON(a) FROM t1 ORDER BY a; a INET_ATON(a) NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs206_inet_ntoa_function.result b/mysql-test/columnstore/basic/r/mcs206_inet_ntoa_function.result index 913cd3610..85480588d 100644 --- a/mysql-test/columnstore/basic/r/mcs206_inet_ntoa_function.result +++ b/mysql-test/columnstore/basic/r/mcs206_inet_ntoa_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs206_db; CREATE DATABASE mcs206_db; USE mcs206_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT a, INET_NTOA(a) FROM t1 ORDER BY a; a INET_NTOA(a) NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs218_md5_function.result b/mysql-test/columnstore/basic/r/mcs218_md5_function.result index 74dd0d44f..0fd5b9c6a 100644 --- a/mysql-test/columnstore/basic/r/mcs218_md5_function.result +++ b/mysql-test/columnstore/basic/r/mcs218_md5_function.result @@ -11,7 +11,7 @@ t1_TEXT TEXT, t1_CHAR_1 CHAR(1), t1_DATETIME DATETIME )ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL, NULL, NULL, '', '', '', '0-0-0'); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL, '0-0-0'); INSERT INTO t1 VALUES(203685477580676, -3.797693231E+108, -7.402866E+18, repeat('b',10), repeat('b',10), 'b', '2387-11-08 11:22:30.123'); SELECT t1_BIGINT, MD5(t1_BIGINT) FROM t1 ORDER BY t1_BIGINT; t1_BIGINT MD5(t1_BIGINT) diff --git a/mysql-test/columnstore/basic/r/mcs219_mid_function.result b/mysql-test/columnstore/basic/r/mcs219_mid_function.result index 6aaf1e4fb..8ba5a9ebe 100644 --- a/mysql-test/columnstore/basic/r/mcs219_mid_function.result +++ b/mysql-test/columnstore/basic/r/mcs219_mid_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs219_db; CREATE DATABASE mcs219_db; USE mcs219_db; CREATE TABLE t1 (a INT, b CHAR(35))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'columnstore engine'),(2, 'mariadb database'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'columnstore engine'),(2, 'mariadb database'); SELECT b, MID(b,4,5) FROM t1; b MID(b,4,5) NULL NULL @@ -56,21 +56,21 @@ mariadb database ariadb database SELECT b, MID(b,0,0) FROM t1; b MID(b,0,0) NULL NULL -columnstore engine NULL -mariadb database NULL +columnstore engine +mariadb database SELECT b, MID(b,1,0) FROM t1; b MID(b,1,0) NULL NULL -columnstore engine NULL -mariadb database NULL +columnstore engine +mariadb database SELECT b, MID(b,0,1) FROM t1; b MID(b,0,1) NULL NULL -columnstore engine NULL -mariadb database NULL +columnstore engine +mariadb database SELECT b, MID(b,-1,0) FROM t1; b MID(b,-1,0) NULL NULL -columnstore engine NULL -mariadb database NULL +columnstore engine +mariadb database DROP DATABASE mcs219_db; diff --git a/mysql-test/columnstore/basic/r/mcs21_insert_all_charset_collation.result b/mysql-test/columnstore/basic/r/mcs21_insert_all_charset_collation.result index d0f36384d..22385fd03 100644 --- a/mysql-test/columnstore/basic/r/mcs21_insert_all_charset_collation.result +++ b/mysql-test/columnstore/basic/r/mcs21_insert_all_charset_collation.result @@ -28,10 +28,10 @@ CREATE TABLE t_binary(name VARCHAR(20)) CHARSET binary ENGINE=Columnstore; INSERT INTO t_binary VALUES(0x61000162FF),(0x61000163FF),(0x61000164FF),(0x61000165FF); SELECT hex(name) FROM t_binary; hex(name) -61 -61 -61 -61 +61000162FF +61000163FF +61000164FF +61000165FF SET NAMES cp1250; CREATE TABLE t_cp1250(name VARCHAR(20)) CHARSET cp1250 ENGINE=Columnstore; INSERT INTO t_cp1250 VALUES('aaaa'),('bbbbb'); @@ -97,7 +97,7 @@ CREATE TABLE t_latin1(name VARCHAR(20)) CHARSET latin1 ENGINE=Columnstore; INSERT INTO t_latin1 VALUES(0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); SELECT hex(name) FROM t_latin1; hex(name) -NULL +00 01 02 03 diff --git a/mysql-test/columnstore/basic/r/mcs222_position_function.result b/mysql-test/columnstore/basic/r/mcs222_position_function.result index fed09ca77..64b9d6bac 100644 --- a/mysql-test/columnstore/basic/r/mcs222_position_function.result +++ b/mysql-test/columnstore/basic/r/mcs222_position_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs222_db; CREATE DATABASE mcs222_db; USE mcs222_db; CREATE TABLE t1 (a INT, b CHAR(15))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'a'),(2, 'aqaaqq'),(3, 'cqcqqcq'),(4, 'qdqdqqdq'),(5, 'aaaqq'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'a'),(2, 'aqaaqq'),(3, 'cqcqqcq'),(4, 'qdqdqqdq'),(5, 'aaaqq'); SELECT POSITION('zz' IN 'aazazazapq'); POSITION('zz' IN 'aazazazapq') 0 diff --git a/mysql-test/columnstore/basic/r/mcs224_repeat_function.result b/mysql-test/columnstore/basic/r/mcs224_repeat_function.result index 3575f539d..4442be43f 100644 --- a/mysql-test/columnstore/basic/r/mcs224_repeat_function.result +++ b/mysql-test/columnstore/basic/r/mcs224_repeat_function.result @@ -10,7 +10,7 @@ t1_TEXT TEXT, t1_CHAR_1 CHAR(1), t1_DATETIME DATETIME )ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL, NULL, NULL, '', '', NULL); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO t1 VALUES(25, -3.797, -7.402866, 'abcd', 'p', '2020-10-18 11:22:33'); SELECT t1_INT, REPEAT(t1_INT, 2) FROM t1 ORDER BY 1; t1_INT REPEAT(t1_INT, 2) diff --git a/mysql-test/columnstore/basic/r/mcs225_replace_function.result b/mysql-test/columnstore/basic/r/mcs225_replace_function.result index 4cdea177f..a54be7340 100644 --- a/mysql-test/columnstore/basic/r/mcs225_replace_function.result +++ b/mysql-test/columnstore/basic/r/mcs225_replace_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs225_db; CREATE DATABASE mcs225_db; USE mcs225_db; CREATE TABLE t1 (a INT, b CHAR(20))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'abcabc'),(3, 'cccbba'),(4, 'dddd'),(5, 'pqrs'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'abcabc'),(3, 'cccbba'),(4, 'dddd'),(5, 'pqrs'); SELECT REPLACE('abbcccb', 'b', 'z'); REPLACE('abbcccb', 'b', 'z') azzcccz diff --git a/mysql-test/columnstore/basic/r/mcs22_insert_ignore.result b/mysql-test/columnstore/basic/r/mcs22_insert_ignore.result index d50bbb1df..0a7668314 100644 --- a/mysql-test/columnstore/basic/r/mcs22_insert_ignore.result +++ b/mysql-test/columnstore/basic/r/mcs22_insert_ignore.result @@ -16,16 +16,30 @@ hello hi INSERT INTO t1 (c1) VALUES ('hello'); ERROR HY000: Field 'c2' doesn't have a default value INSERT IGNORE INTO t1 (c1) VALUES ('hello'); -ERROR HY000: Internal error: CAL0001: Insert Failed: MCS-4015: Column 'c2' cannot be null. +Warnings: +Warning 1364 Field 'c2' doesn't have a default value SELECT * FROM t1; c1 c2 hello hi +hello +CREATE TABLE t1i( +c1 CHAR(5), +c2 CHAR(10) NOT NULL +) ENGINE=InnoDB; +INSERT IGNORE INTO t1i (c1) VALUES ('hello'); +Warnings: +Warning 1364 Field 'c2' doesn't have a default value +SELECT * FROM t1i; +c1 c2 +hello +DROP TABLE t1i; INSERT INTO t1 VALUES ('123', 'abc'); INSERT INTO t1 VALUES ('123', 'abc'); INSERT IGNORE INTO t1 VALUES ('123', 'abc'); SELECT * FROM t1; c1 c2 hello hi +hello 123 abc 123 abc 123 abc diff --git a/mysql-test/columnstore/basic/r/mcs259_instr_function.result b/mysql-test/columnstore/basic/r/mcs259_instr_function.result index b2c3d7c3c..8cf14e134 100644 --- a/mysql-test/columnstore/basic/r/mcs259_instr_function.result +++ b/mysql-test/columnstore/basic/r/mcs259_instr_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs259_db; CREATE DATABASE mcs259_db; USE mcs259_db; CREATE TABLE t1 (a INT, b VARCHAR(30))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'mariadb'),(2, 'columnstore'),(3, 'mariadb columnstore'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'mariadb'),(2, 'columnstore'),(3, 'mariadb columnstore'); SELECT INSTR('abcdefghi', 'i') FROM t1 LIMIT 1; INSTR('abcdefghi', 'i') 9 diff --git a/mysql-test/columnstore/basic/r/mcs260_space_function.result b/mysql-test/columnstore/basic/r/mcs260_space_function.result index 246c28a7e..3cc6a9a04 100644 --- a/mysql-test/columnstore/basic/r/mcs260_space_function.result +++ b/mysql-test/columnstore/basic/r/mcs260_space_function.result @@ -5,13 +5,13 @@ CREATE TABLE t1 (a INT, b DECIMAL(3,2), c CHAR(5))ENGINE=Columnstore; INSERT INTO t1 VALUES (NULL, NULL, ''),(1, 1.11, 'a'),(2, 2.22, 'b'),(3, 3.33, 'c'); SELECT SPACE(-1) FROM t1 LIMIT 1; SPACE(-1) -NULL + SELECT SPACE(0) FROM t1 LIMIT 1; SPACE(0) -NULL + SELECT SPACE(0.49) FROM t1 LIMIT 1; SPACE(0.49) -NULL + SELECT SPACE(0.5) FROM t1 LIMIT 1; SPACE(0.5) @@ -20,7 +20,7 @@ SPACE(1) SELECT SPACE('@') FROM t1 LIMIT 1; SPACE('@') -NULL + Warnings: Warning 1292 Truncated incorrect INTEGER value: '@' Warning 1292 Truncated incorrect INTEGER value: '@' @@ -38,7 +38,7 @@ NULL NULL 3.33 SELECT c, SPACE(c) FROM t1 ORDER BY 1; c SPACE(c) -NULL NULL + NULL a NULL b NULL c NULL diff --git a/mysql-test/columnstore/basic/r/mcs271_substring_index_function.result b/mysql-test/columnstore/basic/r/mcs271_substring_index_function.result index f6a7e28e6..f6a7927da 100644 --- a/mysql-test/columnstore/basic/r/mcs271_substring_index_function.result +++ b/mysql-test/columnstore/basic/r/mcs271_substring_index_function.result @@ -23,7 +23,7 @@ SUBSTRING_INDEX('pqr stu vwz', ' ', -1) vwz SELECT SUBSTRING_INDEX('pqr stu vwz', ' ', 0) FROM t1 LIMIT 1; SUBSTRING_INDEX('pqr stu vwz', ' ', 0) -NULL + SELECT SUBSTRING_INDEX('11:12:13', ':', 4) FROM t1 LIMIT 1; SUBSTRING_INDEX('11:12:13', ':', 4) 11:12:13 diff --git a/mysql-test/columnstore/basic/r/mcs285_right_function.result b/mysql-test/columnstore/basic/r/mcs285_right_function.result index ecfd0198a..91f4ff640 100644 --- a/mysql-test/columnstore/basic/r/mcs285_right_function.result +++ b/mysql-test/columnstore/basic/r/mcs285_right_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs285_db; CREATE DATABASE mcs285_db; USE mcs285_db; CREATE TABLE t1 (a INT, b CHAR(15))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'mariadb'),(2, 'columnstore'),(3, 'Innodb'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'mariadb'),(2, 'columnstore'),(3, 'Innodb'); SELECT RIGHT('mariadb cs', 2) FROM t1 LIMIT 1; RIGHT('mariadb cs', 2) cs @@ -15,9 +15,9 @@ b cs SELECT b, RIGHT(b, 0) FROM t1 ORDER BY 1; b RIGHT(b, 0) NULL NULL -columnstore NULL -Innodb NULL -mariadb NULL +columnstore +Innodb +mariadb SELECT b, RIGHT(b, -1) FROM t1 ORDER BY 1; b RIGHT(b, -1) NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs286_left_function.result b/mysql-test/columnstore/basic/r/mcs286_left_function.result index 4d7aa06d3..6a5b5bcb8 100644 --- a/mysql-test/columnstore/basic/r/mcs286_left_function.result +++ b/mysql-test/columnstore/basic/r/mcs286_left_function.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs286_db; CREATE DATABASE mcs286_db; USE mcs286_db; CREATE TABLE t1 (a INT, b CHAR(15))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'mariadb'),(2, 'columnstore'),(3, 'Innodb'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'mariadb'),(2, 'columnstore'),(3, 'Innodb'); SELECT LEFT('mariadb cs', 7) FROM t1 LIMIT 1; LEFT('mariadb cs', 7) mariadb @@ -15,9 +15,9 @@ mariadb c SELECT b, LEFT(b, 0) FROM t1 ORDER BY 1; b LEFT(b, 0) NULL NULL -columnstore NULL -Innodb NULL -mariadb NULL +columnstore +Innodb +mariadb SELECT b, LEFT(b, -1) FROM t1 ORDER BY 1; b LEFT(b, -1) NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs37_select_distinct.result b/mysql-test/columnstore/basic/r/mcs37_select_distinct.result index f2e00547f..47866fe43 100644 --- a/mysql-test/columnstore/basic/r/mcs37_select_distinct.result +++ b/mysql-test/columnstore/basic/r/mcs37_select_distinct.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs37_db; CREATE DATABASE mcs37_db; USE mcs37_db; CREATE TABLE t1(col1 INT, col2 CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL,''),(1,'a'),(1,'b'),(1,'c'),(2,'dd'),(3,'eee'); +INSERT INTO t1 VALUES(NULL, NULL),(1,'a'),(1,'b'),(1,'c'),(2,'dd'),(3,'eee'); SELECT COUNT(DISTINCT col1) FROM t1; COUNT(DISTINCT col1) 3 diff --git a/mysql-test/columnstore/basic/r/mcs44_select_crossengine_join.result b/mysql-test/columnstore/basic/r/mcs44_select_crossengine_join.result index 863afb638..1caf3eb4e 100644 --- a/mysql-test/columnstore/basic/r/mcs44_select_crossengine_join.result +++ b/mysql-test/columnstore/basic/r/mcs44_select_crossengine_join.result @@ -32,13 +32,13 @@ t1_int t1_char t2_int t2_char 3 ccc 3 iii 5 eee 5 jjj 7 ggggg 7 kkkk -NULL NULL NULL NULL +NULL NULL NULL 2 bbb NULL NULL 4 ddd NULL NULL 6 ffff NULL NULL SELECT * FROM t1 RIGHT JOIN t2 ON t1.t1_int = t2.t2_int; t1_int t1_char t2_int t2_char -NULL NULL NULL NULL +NULL NULL NULL 1 aaa 1 hhhh 3 ccc 3 iii 5 eee 5 jjj @@ -58,7 +58,7 @@ NULL 7 ggggg SELECT * FROM t2; t2_int t2_char -NULL NULL +NULL 1 hhhh 3 iii 5 jjj diff --git a/mysql-test/columnstore/basic/r/mcs45_write_crossengine_join.result b/mysql-test/columnstore/basic/r/mcs45_write_crossengine_join.result index 7edeb4c85..ddc2511b5 100644 --- a/mysql-test/columnstore/basic/r/mcs45_write_crossengine_join.result +++ b/mysql-test/columnstore/basic/r/mcs45_write_crossengine_join.result @@ -58,7 +58,7 @@ NULL 7 t SELECT * FROM t2; t2_int t2_char -NULL NULL +NULL 1 sssss 3 sssss 5 sssss @@ -79,7 +79,7 @@ NULL 7 t SELECT * FROM t2; t2_int t2_char -NULL NULL +NULL 1 sssss 3 sssss 5 sssss diff --git a/mysql-test/columnstore/basic/r/mcs57_autoincrement.result b/mysql-test/columnstore/basic/r/mcs57_autoincrement.result index 60434e677..cc037f1be 100644 --- a/mysql-test/columnstore/basic/r/mcs57_autoincrement.result +++ b/mysql-test/columnstore/basic/r/mcs57_autoincrement.result @@ -15,7 +15,7 @@ INSERT INTO t2(t2_varchar) VALUES('bb'),('ccc'),('dddd'),('eeeee'); SELECT * FROM t2; t2_int t2_varchar 1 a -2 a +2 3 bb 4 ccc 5 dddd diff --git a/mysql-test/columnstore/basic/r/mcs63_crossengine_views.result b/mysql-test/columnstore/basic/r/mcs63_crossengine_views.result index 6491a30b9..dc438b162 100644 --- a/mysql-test/columnstore/basic/r/mcs63_crossengine_views.result +++ b/mysql-test/columnstore/basic/r/mcs63_crossengine_views.result @@ -38,7 +38,7 @@ t1_int t1_char t2_int t2_char 3 ccc 3 iii 5 eee 5 jjj 7 gggg 7 llll -NULL NULL NULL NULL +NULL NULL NULL 2 bbb NULL NULL 4 ddd NULL NULL 6 fff NULL NULL @@ -63,7 +63,7 @@ select `mcs63_db`.`t1`.`t1_int` AS `t1_int`,`mcs63_db`.`t1`.`t1_char` AS `t1_cha SELECT * FROM v4; t1_int t1_char t2_int t2_char 1 aaa 1 hhh -NULL NULL NULL NULL +NULL NULL NULL 2 bbb NULL NULL 3 ccc NULL NULL 4 ddd NULL NULL @@ -76,7 +76,7 @@ VIEW_DEFINITION select `mcs63_db`.`t1`.`t1_int` AS `t1_int`,`mcs63_db`.`t1`.`t1_char` AS `t1_char`,`mcs63_db`.`t2`.`t2_int` AS `t2_int`,`mcs63_db`.`t2`.`t2_char` AS `t2_char` from (`mcs63_db`.`t2` left join `mcs63_db`.`t1` on(`mcs63_db`.`t1`.`t1_int` = `mcs63_db`.`t2`.`t2_int`)) SELECT * FROM v5; t1_int t1_char t2_int t2_char -NULL NULL NULL NULL +NULL NULL NULL 1 aaa 1 hhh 3 ccc 3 iii 5 eee 5 jjj @@ -90,7 +90,7 @@ VIEW_DEFINITION select `mcs63_db`.`t1`.`t1_char` AS `t1_char`,`mcs63_db`.`t2`.`t2_char` AS `t2_char` from (`mcs63_db`.`t2` left join `mcs63_db`.`t1` on(`mcs63_db`.`t1`.`t1_int` = `mcs63_db`.`t2`.`t2_int`)) SELECT * FROM v6; t1_char t2_char -NULL NULL +NULL aaa hhh ccc iii eee jjj @@ -104,7 +104,7 @@ VIEW_DEFINITION select `mcs63_db`.`t1`.`t1_int` AS `t1_int`,`mcs63_db`.`t1`.`t1_char` AS `t1_char`,`mcs63_db`.`t2`.`t2_int` AS `t2_int`,`mcs63_db`.`t2`.`t2_char` AS `t2_char` from (`mcs63_db`.`t2` left join `mcs63_db`.`t1` on(`mcs63_db`.`t1`.`t1_int` = `mcs63_db`.`t2`.`t2_int` and `mcs63_db`.`t2`.`t2_int` = 5)) SELECT * FROM v7; t1_int t1_char t2_int t2_char -NULL NULL NULL NULL +NULL NULL NULL NULL NULL 1 hhh NULL NULL 3 iii 5 eee 5 jjj diff --git a/mysql-test/columnstore/basic/r/mcs65_crossengine_order_by.result b/mysql-test/columnstore/basic/r/mcs65_crossengine_order_by.result index 7fe51405e..dca8a9ec3 100644 --- a/mysql-test/columnstore/basic/r/mcs65_crossengine_order_by.result +++ b/mysql-test/columnstore/basic/r/mcs65_crossengine_order_by.result @@ -6,8 +6,8 @@ GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost'; FLUSH PRIVILEGES; CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Innodb; CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL,''),(1,'ddd'),(2,'bbb'),(3,'fffff'),(4,'eee'),(5,'a'),(6,'ccc'),(7,'ggg'); -INSERT INTO t2 VALUES (NULL,''),(1,'ooo'),(3,'iii'),(5,'hhh'),(7,'nnnnn'),(9,'kkkk'),(11,'mm'),(13,'j'); +INSERT INTO t1 VALUES (NULL,NULL),(1,'ddd'),(2,'bbb'),(3,'fffff'),(4,'eee'),(5,'a'),(6,'ccc'),(7,'ggg'); +INSERT INTO t2 VALUES (NULL,NULL),(1,'ooo'),(3,'iii'),(5,'hhh'),(7,'nnnnn'),(9,'kkkk'),(11,'mm'),(13,'j'); SELECT * FROM t1, t2 WHERE t1.t1_int = t2.t2_int ORDER BY 1; t1_int t1_char t2_int t2_char 1 ddd 1 ooo diff --git a/mysql-test/columnstore/basic/r/mcs69_cast_data_types.result b/mysql-test/columnstore/basic/r/mcs69_cast_data_types.result index a1f780e99..a40715596 100644 --- a/mysql-test/columnstore/basic/r/mcs69_cast_data_types.result +++ b/mysql-test/columnstore/basic/r/mcs69_cast_data_types.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs69_db; CREATE DATABASE mcs69_db; USE mcs69_db; CREATE TABLE t1(t1_int INT, t1_decimal DECIMAL(5,3), t1_char CHAR(10), t1_text TEXT, t1_varchar VARCHAR(50))ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL, NULL, '', '', ''); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL); INSERT INTO t1 VALUES(512762, 86.722, 'A', repeat('a',50), repeat('b',50)); INSERT INTO t1 VALUES(-512762, -86.722, '123456', repeat('1',50), repeat('2',50)); SELECT * FROM t1; diff --git a/mysql-test/columnstore/basic/r/mcs74_check_constraint.result b/mysql-test/columnstore/basic/r/mcs74_check_constraint.result index f92523d6b..ee0910af0 100644 --- a/mysql-test/columnstore/basic/r/mcs74_check_constraint.result +++ b/mysql-test/columnstore/basic/r/mcs74_check_constraint.result @@ -9,7 +9,7 @@ t1 CREATE TABLE `t1` ( `t1_char` char(5) DEFAULT NULL, CONSTRAINT `CONSTRAINT_1` CHECK (`t1_int` > 0) ) ENGINE=Columnstore DEFAULT CHARSET=latin1 -INSERT INTO t1 VALUES(NULL, ''); +INSERT INTO t1 VALUES(NULL, NULL); INSERT INTO t1 VALUES(1, 'a'); INSERT INTO t1 VALUES(0, 'b'); ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `mcs74_db`.`t1` @@ -33,7 +33,7 @@ ERROR 23000: CONSTRAINT `c1` failed for `mcs74_db`.`t2` SELECT * FROM t2; t1_char NULL -NULL + CREATE TABLE t3( t3_decimal DECIMAL(5,2), t3_blob BLOB, diff --git a/mysql-test/columnstore/basic/r/mcs77_where_conditions.result b/mysql-test/columnstore/basic/r/mcs77_where_conditions.result index 2262c4857..26e206517 100644 --- a/mysql-test/columnstore/basic/r/mcs77_where_conditions.result +++ b/mysql-test/columnstore/basic/r/mcs77_where_conditions.result @@ -13,7 +13,7 @@ t1_varchar VARCHAR(255) DEFAULT 'hello world!', t1_datetime DATETIME )ENGINE=Columnstore; INSERT INTO t1 VALUES(); -INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO t1 VALUES(1, 123456, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-11 11:11:11'); INSERT INTO t1 VALUES(0, 1023456, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-11 11:11:11'); INSERT INTO t1 VALUES(1, -123456, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-11 11:11:11'); diff --git a/mysql-test/columnstore/basic/r/mcs78_aliases.result b/mysql-test/columnstore/basic/r/mcs78_aliases.result index d54a22931..f13659f29 100644 --- a/mysql-test/columnstore/basic/r/mcs78_aliases.result +++ b/mysql-test/columnstore/basic/r/mcs78_aliases.result @@ -12,7 +12,7 @@ t1_char CHAR(5), t1_varchar VARCHAR(255) DEFAULT 'hello world!', t1_datetime DATETIME )ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO t1 VALUES(1, 11, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-09 11:11:11'); INSERT INTO t1 VALUES(0, 12, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-11 11:11:12'); INSERT INTO t1 VALUES(1, -12, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-10 11:11:10'); diff --git a/mysql-test/columnstore/basic/r/mcs79_exists.result b/mysql-test/columnstore/basic/r/mcs79_exists.result index 75459cf1a..ad9e6893d 100644 --- a/mysql-test/columnstore/basic/r/mcs79_exists.result +++ b/mysql-test/columnstore/basic/r/mcs79_exists.result @@ -8,8 +8,8 @@ CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t3 (t3_int INT, t3_char CHAR(5))ENGINE=Innodb; CREATE TABLE t4 (t4_int INT, t4_char CHAR(5))ENGINE=Myisam; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, ''),(7, 'eee'); -INSERT INTO t2 VALUES (NULL, ''),(1, 'eee'),(3, 'ccc'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'eee'),(11, 'nnn'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, ''),(7, 'eee'); +INSERT INTO t2 VALUES (NULL, NULL),(1, 'eee'),(3, 'ccc'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'eee'),(11, 'nnn'); INSERT INTO t3 SELECT * FROM t2; INSERT INTO t4 SELECT * FROM t1; SELECT t1_int FROM t1 WHERE EXISTS (SELECT t2_int FROM t2 WHERE t1.t1_int = t2.t2_int) ORDER BY 1; @@ -29,7 +29,7 @@ t2_int t2_char 1 eee 3 ccc 5 jjj -6 NULL +6 7 lll SELECT t1_char FROM t1 WHERE NOT EXISTS (SELECT t2_int FROM t2 WHERE t1.t1_int = t2.t2_int) ORDER BY t1_char; t1_char @@ -39,7 +39,7 @@ ddd SELECT t1_char FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2_int IS NULL) ORDER BY 1; t1_char NULL -NULL + aaa aaa aaa @@ -48,7 +48,7 @@ ddd eee SELECT t1_char, t1_int FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2_int IS NULL) AND t1_int > 5 ORDER BY 1; t1_char t1_int -NULL 6 + 6 eee 7 SELECT t1_int FROM t1 WHERE EXISTS (SELECT t3_int FROM t3 WHERE t1.t1_int = t3.t3_int); t1_int diff --git a/mysql-test/columnstore/basic/r/mcs81_self_join.result b/mysql-test/columnstore/basic/r/mcs81_self_join.result index f257472a7..509a27720 100644 --- a/mysql-test/columnstore/basic/r/mcs81_self_join.result +++ b/mysql-test/columnstore/basic/r/mcs81_self_join.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs81_db; CREATE DATABASE mcs81_db; USE mcs81_db; CREATE TABLE t1 (t1_col1 INT, t1_col2 TEXT)ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''); +INSERT INTO t1 VALUES (NULL, NULL); INSERT INTO t1 VALUES (1, repeat('a', 20)),(3, repeat('c', 20)),(5, repeat('a', 20)),(7, repeat('c', 20)),(9, repeat('a', 20)); SELECT * FROM t1 AS a, t1 AS b WHERE a.t1_col1 = b.t1_col1; t1_col1 t1_col2 t1_col1 t1_col2 diff --git a/mysql-test/columnstore/basic/r/mcs82_update_join.result b/mysql-test/columnstore/basic/r/mcs82_update_join.result index 393c54a23..e25d07729 100644 --- a/mysql-test/columnstore/basic/r/mcs82_update_join.result +++ b/mysql-test/columnstore/basic/r/mcs82_update_join.result @@ -3,8 +3,8 @@ CREATE DATABASE mcs82_db; USE mcs82_db; CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); -INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); +INSERT INTO t2 VALUES (NULL, NULL),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); SELECT * FROM t1 ORDER BY t1_int; t1_int t1_char NULL NULL @@ -13,7 +13,7 @@ NULL NULL 3 ccc 4 ddd 5 aa -6 NULL +6 7 aaaaa UPDATE t1 JOIN t2 on t1.t1_int=t2.t2_int SET t1.t1_char='sssss'; SELECT * FROM t1 ORDER BY t1_int; @@ -44,7 +44,7 @@ NULL NULL 1 hhhh 3 iii 5 jjj -6 NULL +6 7 lll 9 m 11 nnn diff --git a/mysql-test/columnstore/basic/r/mcs83_delete_join.result b/mysql-test/columnstore/basic/r/mcs83_delete_join.result index 365b7aaaa..32e7cb26b 100644 --- a/mysql-test/columnstore/basic/r/mcs83_delete_join.result +++ b/mysql-test/columnstore/basic/r/mcs83_delete_join.result @@ -3,8 +3,8 @@ CREATE DATABASE mcs83_db; USE mcs83_db; CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); -INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); +INSERT INTO t2 VALUES (NULL, NULL),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); SELECT * FROM t1 ORDER BY t1_int; t1_int t1_char NULL NULL @@ -13,7 +13,7 @@ NULL NULL 3 ccc 4 ddd 5 aa -6 NULL +6 7 aaaaa SELECT * FROM t2 ORDER BY t2_int; t2_int t2_char @@ -21,7 +21,7 @@ NULL NULL 1 hhhh 3 iii 5 jjj -6 NULL +6 7 lll 9 m 11 nnn @@ -32,14 +32,14 @@ NULL NULL 2 bbb 3 ccc 4 ddd -6 NULL +6 DELETE t2 FROM t2 LEFT JOIN t1 ON t1.t1_int=t2.t2_int WHERE t2.t2_int IS NULL; SELECT * FROM t2 ORDER BY t2_int; t2_int t2_char 1 hhhh 3 iii 5 jjj -6 NULL +6 7 lll 9 m 11 nnn diff --git a/mysql-test/columnstore/basic/r/mcs90_aggregate_functions.result b/mysql-test/columnstore/basic/r/mcs90_aggregate_functions.result index 3ed8dcdb3..f4bd9bed1 100644 --- a/mysql-test/columnstore/basic/r/mcs90_aggregate_functions.result +++ b/mysql-test/columnstore/basic/r/mcs90_aggregate_functions.result @@ -5,7 +5,7 @@ CREATE USER IF NOT EXISTS 'cejuser'@'localhost' IDENTIFIED BY 'Vagrant1|0000001' GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost'; FLUSH PRIVILEGES; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT * FROM t1; a b NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs91_comparison_functions.result b/mysql-test/columnstore/basic/r/mcs91_comparison_functions.result index 1e93397ff..1b47100c3 100644 --- a/mysql-test/columnstore/basic/r/mcs91_comparison_functions.result +++ b/mysql-test/columnstore/basic/r/mcs91_comparison_functions.result @@ -9,33 +9,33 @@ t1_text TEXT, t1_char CHAR(1), t1_datetime DATETIME )ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL, NULL, '', '', '0000-00-00'); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '0000-00-00'); INSERT INTO t1 VALUES(123456, 111.11, repeat('a',10), 'a', '1111-11-11 11:11:11'); INSERT INTO t1 VALUES(NULL, 222.22, '', 'b', '2222-12-22 22:22:22'); SELECT *, COALESCE(t1_int, 'No Value') FROM t1 ORDER BY t1_int; t1_int t1_decimal t1_text t1_char t1_datetime COALESCE(t1_int, 'No Value') NULL NULL NULL NULL 0000-00-00 00:00:00 No Value -NULL 222.22 NULL b 2222-12-22 22:22:22 No Value +NULL 222.22 b 2222-12-22 22:22:22 No Value 123456 111.11 aaaaaaaaaa a 1111-11-11 11:11:11 123456 SELECT *, COALESCE(t1_decimal, 'No Value') FROM t1 ORDER BY t1_int; t1_int t1_decimal t1_text t1_char t1_datetime COALESCE(t1_decimal, 'No Value') NULL NULL NULL NULL 0000-00-00 00:00:00 No Value -NULL 222.22 NULL b 2222-12-22 22:22:22 222.22 +NULL 222.22 b 2222-12-22 22:22:22 222.22 123456 111.11 aaaaaaaaaa a 1111-11-11 11:11:11 111.11 SELECT *, COALESCE(t1_text, 'No Value') FROM t1 ORDER BY t1_int; t1_int t1_decimal t1_text t1_char t1_datetime COALESCE(t1_text, 'No Value') NULL NULL NULL NULL 0000-00-00 00:00:00 No Value -NULL 222.22 NULL b 2222-12-22 22:22:22 No Value +NULL 222.22 b 2222-12-22 22:22:22 123456 111.11 aaaaaaaaaa a 1111-11-11 11:11:11 aaaaaaaaaa SELECT *, COALESCE(t1_datetime, 'No Value') FROM t1 ORDER BY t1_int; t1_int t1_decimal t1_text t1_char t1_datetime COALESCE(t1_datetime, 'No Value') NULL NULL NULL NULL 0000-00-00 00:00:00 0000-00-00 00:00:00 -NULL 222.22 NULL b 2222-12-22 22:22:22 2222-12-22 22:22:22 +NULL 222.22 b 2222-12-22 22:22:22 2222-12-22 22:22:22 123456 111.11 aaaaaaaaaa a 1111-11-11 11:11:11 1111-11-11 11:11:11 SELECT t1_int, t1_decimal, COALESCE(t1_text, LEFT(t1_char,10)) FROM t1 ORDER BY t1_int; t1_int t1_decimal COALESCE(t1_text, LEFT(t1_char,10)) NULL NULL NULL -NULL 222.22 b +NULL 222.22 123456 111.11 aaaaaaaaaa SELECT t1_int, LEAST(t1_int, t1_decimal) FROM t1 ORDER BY 1; t1_int LEAST(t1_int, t1_decimal) @@ -77,14 +77,13 @@ NULL 0 6.256546477863076e17 SELECT * FROM t1 WHERE ISNULL(t1_int) ORDER BY t1_decimal; t1_int t1_decimal t1_text t1_char t1_datetime NULL NULL NULL NULL 0000-00-00 00:00:00 -NULL 222.22 NULL b 2222-12-22 22:22:22 +NULL 222.22 b 2222-12-22 22:22:22 SELECT * FROM t1 WHERE ISNULL(t1_decimal) ORDER BY t1_decimal; t1_int t1_decimal t1_text t1_char t1_datetime NULL NULL NULL NULL 0000-00-00 00:00:00 SELECT * FROM t1 WHERE ISNULL(t1_text) ORDER BY t1_decimal; t1_int t1_decimal t1_text t1_char t1_datetime NULL NULL NULL NULL 0000-00-00 00:00:00 -NULL 222.22 NULL b 2222-12-22 22:22:22 SELECT * FROM t1 WHERE ISNULL(t1_datetime) ORDER BY t1_decimal; t1_int t1_decimal t1_text t1_char t1_datetime DROP DATABASE mcs91_db; diff --git a/mysql-test/columnstore/basic/r/mcs93_string_functions.result b/mysql-test/columnstore/basic/r/mcs93_string_functions.result index 59e887f93..da70785ba 100644 --- a/mysql-test/columnstore/basic/r/mcs93_string_functions.result +++ b/mysql-test/columnstore/basic/r/mcs93_string_functions.result @@ -2,6 +2,7 @@ DROP DATABASE IF EXISTS mcs93_db; CREATE DATABASE mcs93_db; USE mcs93_db; CREATE TABLE t1(col1 VARCHAR(40), col2 TEXT)ENGINE=Columnstore; +INSERT INTO t1 VALUES(NULL, NULL); INSERT INTO t1 VALUES('', ''); INSERT INTO t1 VALUES(' aaa', repeat('z',10)); INSERT INTO t1 VALUES('klm, nopqrst', 'abcdefghijklmno, pqrsuvwxyz '); @@ -9,6 +10,7 @@ INSERT INTO t1 VALUES('MariaDB, Columnstore', 'mariadb, COLUMNSTORE'); SELECT col1 FROM t1; col1 NULL + aaa klm, nopqrst MariaDB, Columnstore @@ -16,12 +18,14 @@ UPDATE t1 SET col1 = LTRIM(col1); SELECT col1 FROM t1; col1 NULL + aaa klm, nopqrst MariaDB, Columnstore SELECT col2 FROM t1; col2 NULL + zzzzzzzzzz abcdefghijklmno, pqrsuvwxyz mariadb, COLUMNSTORE @@ -29,6 +33,7 @@ UPDATE t1 SET col2 = RTRIM(col2); SELECT col2 FROM t1; col2 NULL + zzzzzzzzzz abcdefghijklmno, pqrsuvwxyz mariadb, COLUMNSTORE @@ -36,6 +41,7 @@ INSERT INTO t1 VALUES(' Columnstore Engine ', ' COLUMNSTORE ENGINE '); SELECT TRIM(TRAILING FROM col1), TRIM(LEADING FROM col1) FROM t1; TRIM(TRAILING FROM col1) TRIM(LEADING FROM col1) NULL NULL + aaa aaa klm, nopqrst klm, nopqrst MariaDB, Columnstore MariaDB, Columnstore @@ -43,6 +49,7 @@ MariaDB, Columnstore MariaDB, Columnstore SELECT TRIM(TRAILING FROM col2), TRIM(LEADING FROM col2) FROM t1; TRIM(TRAILING FROM col2) TRIM(LEADING FROM col2) NULL NULL + zzzzzzzzzz zzzzzzzzzz abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz mariadb, COLUMNSTORE mariadb, COLUMNSTORE @@ -50,6 +57,7 @@ mariadb, COLUMNSTORE mariadb, COLUMNSTORE SELECT * FROM t1; col1 col2 NULL NULL + aaa zzzzzzzzzz klm, nopqrst abcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore mariadb, COLUMNSTORE @@ -59,6 +67,7 @@ UPDATE t1 SET col2 = TRIM(col2); SELECT * FROM t1; col1 col2 NULL NULL + aaa zzzzzzzzzz klm, nopqrst abcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore mariadb, COLUMNSTORE @@ -66,6 +75,7 @@ Columnstore Engine COLUMNSTORE ENGINE SELECT col1, col2, CONCAT(col1,col2) FROM t1; col1 col2 CONCAT(col1,col2) NULL NULL NULL + aaa zzzzzzzzzz aaazzzzzzzzzz klm, nopqrst abcdefghijklmno, pqrsuvwxyz klm, nopqrstabcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore mariadb, COLUMNSTORE MariaDB, Columnstoremariadb, COLUMNSTORE @@ -73,6 +83,7 @@ Columnstore Engine COLUMNSTORE ENGINE Columnstore EngineCOLUMNSTORE ENGINE SELECT col1, col2, CONCAT(col1, ' ', col2) FROM t1; col1 col2 CONCAT(col1, ' ', col2) NULL NULL NULL + aaa zzzzzzzzzz aaa zzzzzzzzzz klm, nopqrst abcdefghijklmno, pqrsuvwxyz klm, nopqrst abcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore mariadb, COLUMNSTORE MariaDB, Columnstore mariadb, COLUMNSTORE @@ -80,6 +91,7 @@ Columnstore Engine COLUMNSTORE ENGINE Columnstore Engine COLUMNSTORE ENGINE SELECT col1, col2, CONCAT('Concat', col1, ' ', col2) FROM t1; col1 col2 CONCAT('Concat', col1, ' ', col2) NULL NULL NULL + Concat aaa zzzzzzzzzz Concataaa zzzzzzzzzz klm, nopqrst abcdefghijklmno, pqrsuvwxyz Concatklm, nopqrst abcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore mariadb, COLUMNSTORE ConcatMariaDB, Columnstore mariadb, COLUMNSTORE @@ -87,6 +99,7 @@ Columnstore Engine COLUMNSTORE ENGINE ConcatColumnstore Engine COLUMNSTORE ENGIN SELECT col1, col2, CONCAT(col2, ' string123# ', col1) FROM t1; col1 col2 CONCAT(col2, ' string123# ', col1) NULL NULL NULL + string123# aaa zzzzzzzzzz zzzzzzzzzz string123# aaa klm, nopqrst abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz string123# klm, nopqrst MariaDB, Columnstore mariadb, COLUMNSTORE mariadb, COLUMNSTORE string123# MariaDB, Columnstore @@ -94,6 +107,7 @@ Columnstore Engine COLUMNSTORE ENGINE COLUMNSTORE ENGINE string123# Columnstore SELECT col1, col2, CONCAT_WS(',', col2, col1) FROM t1; col1 col2 CONCAT_WS(',', col2, col1) NULL NULL NULL + , aaa zzzzzzzzzz zzzzzzzzzz,aaa klm, nopqrst abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz,klm, nopqrst MariaDB, Columnstore mariadb, COLUMNSTORE mariadb, COLUMNSTORE,MariaDB, Columnstore @@ -101,6 +115,7 @@ Columnstore Engine COLUMNSTORE ENGINE COLUMNSTORE ENGINE,Columnstore Engine SELECT col1, col2, CONCAT_WS('....', col2, col1) FROM t1; col1 col2 CONCAT_WS('....', col2, col1) NULL NULL NULL + .... aaa zzzzzzzzzz zzzzzzzzzz....aaa klm, nopqrst abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz....klm, nopqrst MariaDB, Columnstore mariadb, COLUMNSTORE mariadb, COLUMNSTORE....MariaDB, Columnstore @@ -108,6 +123,7 @@ Columnstore Engine COLUMNSTORE ENGINE COLUMNSTORE ENGINE....Columnstore Engine SELECT col1, col2, CONCAT_WS(' string123# ', col2, col1) FROM t1; col1 col2 CONCAT_WS(' string123# ', col2, col1) NULL NULL NULL + string123# aaa zzzzzzzzzz zzzzzzzzzz string123# aaa klm, nopqrst abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz string123# klm, nopqrst MariaDB, Columnstore mariadb, COLUMNSTORE mariadb, COLUMNSTORE string123# MariaDB, Columnstore @@ -115,6 +131,7 @@ Columnstore Engine COLUMNSTORE ENGINE COLUMNSTORE ENGINE string123# Columnstore SELECT col1, col2, INSTR(col1, 'o') FROM t1; col1 col2 INSTR(col1, 'o') NULL NULL NULL + 0 aaa zzzzzzzzzz 0 klm, nopqrst abcdefghijklmno, pqrsuvwxyz 7 MariaDB, Columnstore mariadb, COLUMNSTORE 11 @@ -122,6 +139,7 @@ Columnstore Engine COLUMNSTORE ENGINE 2 SELECT col1, LENGTH(col1), col2, LENGTH(col2) FROM t1; col1 LENGTH(col1) col2 LENGTH(col2) NULL NULL NULL NULL + 0 0 aaa 3 zzzzzzzzzz 10 klm, nopqrst 12 abcdefghijklmno, pqrsuvwxyz 27 MariaDB, Columnstore 20 mariadb, COLUMNSTORE 20 @@ -129,6 +147,7 @@ Columnstore Engine 18 COLUMNSTORE ENGINE 18 SELECT col1, CHAR_LENGTH(col1), col2, CHAR_LENGTH(col2) FROM t1; col1 CHAR_LENGTH(col1) col2 CHAR_LENGTH(col2) NULL NULL NULL NULL + 0 0 aaa 3 zzzzzzzzzz 10 klm, nopqrst 12 abcdefghijklmno, pqrsuvwxyz 27 MariaDB, Columnstore 20 mariadb, COLUMNSTORE 20 @@ -140,6 +159,7 @@ CHAR_LENGTH(@s) LENGTH(@s) SELECT col1, LEFT(col1, 1), col2, LEFT(col2, 2) FROM t1; col1 LEFT(col1, 1) col2 LEFT(col2, 2) NULL NULL NULL NULL + aaa a zzzzzzzzzz zz klm, nopqrst k abcdefghijklmno, pqrsuvwxyz ab MariaDB, Columnstore M mariadb, COLUMNSTORE ma @@ -147,6 +167,7 @@ Columnstore Engine C COLUMNSTORE ENGINE CO SELECT col1, LEFT(col1,100), col2, LEFT(col2, 100) FROM t1; col1 LEFT(col1,100) col2 LEFT(col2, 100) NULL NULL NULL NULL + aaa aaa zzzzzzzzzz zzzzzzzzzz klm, nopqrst klm, nopqrst abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore MariaDB, Columnstore mariadb, COLUMNSTORE mariadb, COLUMNSTORE @@ -154,6 +175,7 @@ Columnstore Engine Columnstore Engine COLUMNSTORE ENGINE COLUMNSTORE ENGINE SELECT col1, RIGHT(col1, 2), col2, RIGHT(col2, 2) FROM t1; col1 RIGHT(col1, 2) col2 RIGHT(col2, 2) NULL NULL NULL NULL + aaa aa zzzzzzzzzz zz klm, nopqrst st abcdefghijklmno, pqrsuvwxyz yz MariaDB, Columnstore re mariadb, COLUMNSTORE RE @@ -161,6 +183,7 @@ Columnstore Engine ne COLUMNSTORE ENGINE NE SELECT col1, RIGHT(col1, 11), col2, RIGHT(col2, 11) FROM t1; col1 RIGHT(col1, 11) col2 RIGHT(col2, 11) NULL NULL NULL NULL + aaa aaa zzzzzzzzzz zzzzzzzzzz klm, nopqrst lm, nopqrst abcdefghijklmno, pqrsuvwxyz pqrsuvwxyz MariaDB, Columnstore Columnstore mariadb, COLUMNSTORE COLUMNSTORE @@ -168,6 +191,7 @@ Columnstore Engine tore Engine COLUMNSTORE ENGINE TORE ENGINE SELECT LOWER(col1), LOWER(col2) FROM t1; LOWER(col1) LOWER(col2) NULL NULL + aaa zzzzzzzzzz klm, nopqrst abcdefghijklmno, pqrsuvwxyz mariadb, columnstore mariadb, columnstore @@ -175,6 +199,7 @@ columnstore engine columnstore engine SELECT LCASE(col1), LCASE(col2) FROM t1; LCASE(col1) LCASE(col2) NULL NULL + aaa zzzzzzzzzz klm, nopqrst abcdefghijklmno, pqrsuvwxyz mariadb, columnstore mariadb, columnstore @@ -182,6 +207,7 @@ columnstore engine columnstore engine SELECT UPPER(col1), UPPER(col2) FROM t1; UPPER(col1) UPPER(col2) NULL NULL + AAA ZZZZZZZZZZ KLM, NOPQRST ABCDEFGHIJKLMNO, PQRSUVWXYZ MARIADB, COLUMNSTORE MARIADB, COLUMNSTORE @@ -189,6 +215,7 @@ COLUMNSTORE ENGINE COLUMNSTORE ENGINE SELECT UCASE(col1), UCASE(col2) FROM t1; UCASE(col1) UCASE(col2) NULL NULL + AAA ZZZZZZZZZZ KLM, NOPQRST ABCDEFGHIJKLMNO, PQRSUVWXYZ MARIADB, COLUMNSTORE MARIADB, COLUMNSTORE @@ -196,34 +223,39 @@ COLUMNSTORE ENGINE COLUMNSTORE ENGINE SELECT col1, SUBSTRING(col1, 5), col2, SUBSTRING(col2, 8) FROM t1; col1 SUBSTRING(col1, 5) col2 SUBSTRING(col2, 8) NULL NULL NULL NULL -aaa NULL zzzzzzzzzz zzz + +aaa zzzzzzzzzz zzz klm, nopqrst nopqrst abcdefghijklmno, pqrsuvwxyz hijklmno, pqrsuvwxyz MariaDB, Columnstore aDB, Columnstore mariadb, COLUMNSTORE , COLUMNSTORE Columnstore Engine mnstore Engine COLUMNSTORE ENGINE TORE ENGINE SELECT col1, SUBSTRING(col1, 5, 4), col2, SUBSTRING(col2, 8, 3) FROM t1; col1 SUBSTRING(col1, 5, 4) col2 SUBSTRING(col2, 8, 3) NULL NULL NULL NULL -aaa NULL zzzzzzzzzz zzz + +aaa zzzzzzzzzz zzz klm, nopqrst nop abcdefghijklmno, pqrsuvwxyz hij MariaDB, Columnstore aDB, mariadb, COLUMNSTORE , C Columnstore Engine mnst COLUMNSTORE ENGINE TOR SELECT col1, SUBSTRING(col1, -5), col2, SUBSTRING(col2, -8) FROM t1; col1 SUBSTRING(col1, -5) col2 SUBSTRING(col2, -8) NULL NULL NULL NULL -aaa NULL zzzzzzzzzz zzzzzzzz + +aaa zzzzzzzzzz zzzzzzzz klm, nopqrst pqrst abcdefghijklmno, pqrsuvwxyz rsuvwxyz MariaDB, Columnstore store mariadb, COLUMNSTORE UMNSTORE Columnstore Engine ngine COLUMNSTORE ENGINE E ENGINE SELECT col1, SUBSTRING(col1, -5, 4), col2, SUBSTRING(col2, -8, 3) FROM t1; col1 SUBSTRING(col1, -5, 4) col2 SUBSTRING(col2, -8, 3) NULL NULL NULL NULL -aaa NULL zzzzzzzzzz zzz + +aaa zzzzzzzzzz zzz klm, nopqrst pqrs abcdefghijklmno, pqrsuvwxyz rsu MariaDB, Columnstore stor mariadb, COLUMNSTORE UMN Columnstore Engine ngin COLUMNSTORE ENGINE E E SELECT col1, SUBSTRING_INDEX(col1, 'o', 2), col2, SUBSTRING_INDEX(col2, 'o', 2) FROM t1; col1 SUBSTRING_INDEX(col1, 'o', 2) col2 SUBSTRING_INDEX(col2, 'o', 2) NULL NULL NULL NULL + aaa aaa zzzzzzzzzz zzzzzzzzzz klm, nopqrst klm, nopqrst abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore MariaDB, Columnst mariadb, COLUMNSTORE mariadb, COLUMNSTORE @@ -231,6 +263,7 @@ Columnstore Engine Columnst COLUMNSTORE ENGINE COLUMNSTORE ENGINE SELECT col1, SUBSTRING_INDEX(col1, 'O', 2), col2, SUBSTRING_INDEX(col2, 'O', 2) FROM t1; col1 SUBSTRING_INDEX(col1, 'O', 2) col2 SUBSTRING_INDEX(col2, 'O', 2) NULL NULL NULL NULL + aaa aaa zzzzzzzzzz zzzzzzzzzz klm, nopqrst klm, nopqrst abcdefghijklmno, pqrsuvwxyz abcdefghijklmno, pqrsuvwxyz MariaDB, Columnstore MariaDB, Columnstore mariadb, COLUMNSTORE mariadb, COLUMNST @@ -238,6 +271,7 @@ Columnstore Engine Columnstore Engine COLUMNSTORE ENGINE COLUMNST SELECT col1, FIND_IN_SET('mariadb', col1), col2, FIND_IN_SET('mariadb', col2) FROM t1; col1 FIND_IN_SET('mariadb', col1) col2 FIND_IN_SET('mariadb', col2) NULL NULL NULL NULL + 0 0 aaa 0 zzzzzzzzzz 0 klm, nopqrst 0 abcdefghijklmno, pqrsuvwxyz 0 MariaDB, Columnstore 1 mariadb, COLUMNSTORE 1 diff --git a/mysql-test/columnstore/basic/r/mcs95_variance_functions.result b/mysql-test/columnstore/basic/r/mcs95_variance_functions.result index e73a73915..06bb96fa8 100644 --- a/mysql-test/columnstore/basic/r/mcs95_variance_functions.result +++ b/mysql-test/columnstore/basic/r/mcs95_variance_functions.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs95_db; CREATE DATABASE mcs95_db; USE mcs95_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, VARIANCE(b) FROM t1 GROUP BY a ORDER BY a; a VARIANCE(b) NULL NULL diff --git a/mysql-test/columnstore/basic/r/mcs96_std_deviation_functions.result b/mysql-test/columnstore/basic/r/mcs96_std_deviation_functions.result index a3fc91490..87aa54441 100644 --- a/mysql-test/columnstore/basic/r/mcs96_std_deviation_functions.result +++ b/mysql-test/columnstore/basic/r/mcs96_std_deviation_functions.result @@ -5,28 +5,28 @@ CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, STD(b) FROM t1 GROUP BY a ORDER BY a; a STD(b) -NULL NULL + NULL a 3.0912 b 2.0000 c 0.0000 d 0.5000 SELECT a, STDDEV(b) FROM t1 GROUP BY a ORDER BY a; a STDDEV(b) -NULL NULL + NULL a 3.0912 b 2.0000 c 0.0000 d 0.5000 SELECT a, STDDEV_POP(b) FROM t1 GROUP BY a ORDER BY a; a STDDEV_POP(b) -NULL NULL + NULL a 3.0912 b 2.0000 c 0.0000 d 0.5000 SELECT a, STDDEV_SAMP(b) FROM t1 GROUP BY a ORDER BY a; a STDDEV_SAMP(b) -NULL NULL + NULL a 3.7859 b 2.8284 c NULL diff --git a/mysql-test/columnstore/basic/r/mcs97_group_concat.result b/mysql-test/columnstore/basic/r/mcs97_group_concat.result index 651a2a9c3..cf80e82d9 100644 --- a/mysql-test/columnstore/basic/r/mcs97_group_concat.result +++ b/mysql-test/columnstore/basic/r/mcs97_group_concat.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS mcs97_db; CREATE DATABASE mcs97_db; USE mcs97_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT GROUP_CONCAT(a) FROM t1; GROUP_CONCAT(a) 1,2,3,4,5,6,7 diff --git a/mysql-test/columnstore/basic/r/regr-fe-conv.result b/mysql-test/columnstore/basic/r/regr-fe-conv.result new file mode 100644 index 000000000..8c21cba6a --- /dev/null +++ b/mysql-test/columnstore/basic/r/regr-fe-conv.result @@ -0,0 +1,527 @@ +DROP DATABASE IF EXISTS regr_fe_conv; +CREATE DATABASE regr_fe_conv; +USE regr_fe_conv; +Warnings: +Note 1265 Data truncated for column 'dt' at row 1 +Warning 1265 Data truncated for column 'c1' at row 1 +Warning 1265 Data truncated for column 'c2' at row 1 +Warning 1265 Data truncated for column 'c3' at row 1 +Warning 1265 Data truncated for column 'c4' at row 1 +Warning 1265 Data truncated for column 'c5' at row 1 +Warning 1265 Data truncated for column 'c6' at row 1 +Warning 1265 Data truncated for column 'c7' at row 1 +Warning 1265 Data truncated for column 'vc1' at row 1 +Warning 1265 Data truncated for column 'vc2' at row 1 +Warning 1265 Data truncated for column 'vc3' at row 1 +Warning 1265 Data truncated for column 'vc4' at row 1 +Warning 1265 Data truncated for column 'vc5' at row 1 +Warning 1265 Data truncated for column 'vc6' at row 1 +Warning 1265 Data truncated for column 'vc7' at row 1 +Note 1265 Data truncated for column 'd1' at row 1 +Warning 1264 Out of range value for column 'd2' at row 1 +Note 1265 Data truncated for column 'd3' at row 1 +Note 1265 Data truncated for column 'd4' at row 1 +Warning 1264 Out of range value for column 'd5' at row 1 +Note 1265 Data truncated for column 'd6' at row 1 +Note 1265 Data truncated for column 'd7' at row 1 +Note 1265 Data truncated for column 'd8' at row 1 +Warning 1264 Out of range value for column 'd9' at row 1 +Note 1265 Data truncated for column 'd10' at row 1 +Note 1265 Data truncated for column 'd11' at row 1 +Note 1265 Data truncated for column 'd12' at row 1 +Note 1265 Data truncated for column 'd13' at row 1 +Warning 1264 Out of range value for column 'd14' at row 1 +Note 1265 Data truncated for column 'd15' at row 1 +Note 1265 Data truncated for column 'd16' at row 1 +Note 1265 Data truncated for column 'd17' at row 1 +Note 1265 Data truncated for column 'd18' at row 1 +Note 1265 Data truncated for column 'd19' at row 1 +Warning 1264 Out of range value for column 'd20' at row 1 +Note 1265 Data truncated for column 'd21' at row 1 +Note 1265 Data truncated for column 'd22' at row 1 +Note 1265 Data truncated for column 'd23' at row 1 +Note 1265 Data truncated for column 'd24' at row 1 +Note 1265 Data truncated for column 'd25' at row 1 +Warning 1264 Out of range value for column 'd27' at row 1 +Note 1265 Data truncated for column 'd28' at row 1 +Note 1265 Data truncated for column 'd29' at row 1 +Note 1265 Data truncated for column 'd30' at row 1 +Note 1265 Data truncated for column 'd31' at row 1 +Note 1265 Data truncated for column 'd32' at row 1 +Warning 1264 Out of range value for column 'd35' at row 1 +Note 1265 Data truncated for column 'd36' at row 1 +Note 1265 Data truncated for column 'd37' at row 1 +Note 1265 Data truncated for column 'd38' at row 1 +Note 1265 Data truncated for column 'd39' at row 1 +Note 1265 Data truncated for column 'd40' at row 1 +Warning 1264 Out of range value for column 'd44' at row 1 +Note 1265 Data truncated for column 'd45' at row 1 +Note 1265 Data truncated for column 'd46' at row 1 +Note 1265 Data truncated for column 'd47' at row 1 +Note 1265 Data truncated for column 'd48' at row 1 +Note 1265 Data truncated for column 'd49' at row 1 +Warning 1264 Out of range value for column 'd54' at row 1 +Note 1265 Data truncated for column 'd55' at row 1 +Note 1265 Data truncated for column 'd56' at row 1 +Note 1265 Data truncated for column 'd57' at row 1 +Note 1265 Data truncated for column 'd58' at row 1 +Note 1265 Data truncated for column 'd59' at row 1 +select conv(dt, -10, -8) from dtypes where conv(dt, -10, -8) > 3731; +conv(dt, -10, -8) +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +3732 +select dtm from dtypes where conv(dtm, -10, -8) > 3731 order by dtm, conv(dtm, 10, 8); +dtm +2010-01-04 07:35:22 +2010-01-11 07:36:22 +2010-01-18 07:37:22 +2010-01-25 07:38:22 +2010-02-01 07:39:22 +2010-02-08 07:40:22 +2010-02-15 07:41:22 +2010-02-22 07:42:22 +2010-03-01 07:43:22 +2010-03-08 07:44:22 +2010-03-15 07:45:22 +2010-03-22 07:46:22 +2010-03-29 07:47:22 +2010-04-05 07:48:22 +2010-04-12 07:49:22 +2010-04-19 07:50:22 +2010-04-26 07:51:22 +2010-05-03 07:52:22 +2010-05-10 07:53:22 +2010-05-17 07:54:22 +2010-05-24 07:55:22 +2010-05-31 07:56:22 +2010-06-07 07:57:22 +2010-06-14 07:58:22 +2010-06-21 07:59:22 +2010-06-28 08:00:22 +2010-07-05 08:01:22 +2010-07-12 08:02:22 +2010-07-19 08:03:22 +2010-07-26 08:04:22 +2010-08-02 08:05:22 +2010-08-09 08:06:22 +2010-08-16 08:07:22 +2010-08-23 08:08:22 +2010-08-30 08:09:22 +2010-09-06 08:10:22 +2010-09-13 08:11:22 +2010-09-20 08:12:22 +2010-09-27 08:13:22 +2010-10-04 08:14:22 +2010-10-11 08:15:22 +2010-10-18 08:16:22 +2010-10-25 08:17:22 +2010-11-01 08:18:22 +2010-11-08 08:19:22 +select conv(db, 10, 16), conv(ti, 8,16), conv(si, 16, 8), conv(i, 4, 8), conv(bi, 10, 8) from dtypes; +conv(db, 10, 16) conv(ti, 8,16) conv(si, 16, 8) conv(i, 4, 8) conv(bi, 10, 8) +FFFFFFFFFFFFFFF8 0 1777777777777777777767 0 1777777777777777777767 +1 1 1 1 1 +0 1 1 1 1 +0 1 1 1 1 +0 0 0 0 0 +0 FFFFFFFFFFFFFFFF 1777777777777777777777 1777777777777777777777 1777777777777777777777 +0 0 0 0 0 +FFFFFFFFFFFFFFF9 0 1777777777777777777770 0 1777777777777777777770 +4 5 5 0 5 +0 0 0 0 0 +4A00A6 57 623547 0 22400246 +FFFFFFFFFFFFFFFA FFFFFFFFFFFFFFF9 1777777777777777777771 0 1777777777777777777771 +9 0 11 0 11 +0 1 1 1 1 +28799A 57 623547 2 12074633 +FFFFFFFFFFFFFFFB FFFFFFFFFFFFFFFA 1777777777777777777772 0 1777777777777777777772 +10 F 27 1 21 +1 1 1 1 1 +392FA 57 623547 13 711372 +2 2 2 2 2 +0 0 0 0 0 +EA 57 1064 13 352 +3 3 3 3 3 +5B7F 57 432043 13 55577 +8 0 10 0 10 +9 8 20 4 12 +4 4 4 0 4 +FFFFFFFFFFFFF747 FFFFFFFFFFFFFFAA 1777777777777777756715 1777777777777777777521 1777777777777777773507 +FFFFFFFFFFFFFFD4 FFFFFFFFFFFFFFDC 1777777777777777777674 0 1777777777777777777724 +1 1 1 1 1 +2C 25 105 0 55 +FFFFFFFFFFFFFFE9 FFFFFFFFFFFFFFEC 1777777777777777777734 1777777777777777777776 1777777777777777777750 +378 57 4210 0 1570 +1 1 1 1 1 +0 1 1 1 1 +32AEEC 57 623547 371 14527354 +FFFFFFFFFFFFFFFC FFFFFFFFFFFFFFFC 1777777777777777777774 0 1777777777777777777774 +19 16 46 2 32 +0 1 1 1 1 +3D400A 57 623547 0 17240012 +FFFFFFFFFFFFFFFD FFFFFFFFFFFFFFFD 1777777777777777777775 1777777777777777777775 1777777777777777777775 +24 1E 66 3 44 +0 1 1 1 1 +FFFFFFFFFFFFFFFE FFFFFFFFFFFFFFFD 1777777777777777777775 1777777777777777777775 1777777777777777777775 +31 28 120 0 62 +0 1 1 1 1 +FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF 1777777777777777777777 1777777777777777777777 1777777777777777777777 +40 35 145 0 101 +0 0 0 0 0 +0 FFFFFFFFFFFFFFFF 1777777777777777777777 1777777777777777777777 1777777777777777777777 +51 0 201 0 121 +0 1 1 1 1 +189CA0 57 623547 1 6116241 +2C 24 104 0 54 +FFFFFFFFFFFFFFD4 FFFFFFFFFFFFFFDC 1777777777777777777674 0 1777777777777777777724 +0 1 1 1 1 +64 41 401 21 145 +0 1 1 1 1 +1 2 2 2 2 +79 52 442 32 172 +0 0 0 0 0 +7CA42 57 623547 0 1745102 +2 2 2 2 2 +90 57 505 1 221 +0 0 0 0 0 +3 3 3 3 3 +A9 57 551 1 251 +0 0 0 0 0 +3CB450 57 623547 3 17132121 +4 5 5 0 5 +C4 57 627 1 305 +0 0 0 0 0 +471882 57 623547 0 21614202 +5 5 5 0 5 +E1 57 1046 12 342 +0 0 0 0 0 +45420A 57 623547 0 21241013 +6 7 7 0 7 +100 57 1126 2 400 +0 0 0 0 0 +23C8BE 57 623547 13 10744277 +7 7 7 0 7 +121 57 1220 2 442 +0 1 1 1 1 +3983FC 57 623547 3 16301775 +8 0 11 0 11 +144 57 1445 16 505 +0 1 1 1 1 +596CA8 57 623547 0 26266251 +9 0 11 0 11 +169 57 1541 3 551 +0 1 1 1 1 +182DEC 57 623547 1 6026755 +A 9 21 5 13 +190 57 2000 0 620 +0 0 0 0 0 +1245D0 57 623547 5 4442720 +184 57 1610 3 604 +FFFFFFFFFFFFFF18 FFFFFFFFFFFFFFAB 1777777777777777776716 1777777777777777777722 1777777777777777777430 +0 0 0 0 0 +select conv (c1, 5, 10), conv(substr(c8,2,4), 8, 10), conv(concat(vc1, vc2), 10,8) from dtypes; +conv (c1, 5, 10) conv(substr(c8,2,4), 8, 10) conv(concat(vc1, vc2), 10,8) +0 0 0 +1 0 13 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 7 0 +4 0 54 +0 0 0 +4 0 700 +0 6 0 +0 0 143 +0 0 0 +2 3413 342 +0 5 0 +1 6 164 +1 NULL 13 +2 1811 337 +2 NULL 26 +0 0 0 +2 28 337 +3 NULL 41 +2 1811 337 +0 0 130 +0 0 143 +4 0 54 +0 1179 0 +0 36 0 +1 0 13 +4 4 674 +0 19 0 +0 0 1570 +1 0 13 +0 0 0 +3 1677 515 +0 4 0 +2 5 341 +0 0 0 +4 96 670 +0 3 0 +3 6 520 +0 0 0 +0 2 0 +4 0 701 +0 0 0 +0 1 0 +0 4 1230 +0 0 0 +0 0 0 +0 1 1561 +0 0 0 +1 394 164 +4 4 674 +0 36 0 +0 0 0 +1 0 156 +0 0 0 +1 0 13 +1 17 160 +0 0 0 +0 555 1047 +2 0 26 +1 36 162 +0 0 0 +3 0 41 +1 6 164 +0 0 0 +3 0 523 +4 0 54 +1 0 167 +0 0 0 +4 53 676 +0 0 67 +2 21 336 +0 0 0 +4 43 675 +0 0 102 +2 46 341 +0 0 0 +2 1833 337 +0 0 115 +2 0 344 +0 0 0 +3 62 521 +0 0 130 +3 20 514 +0 0 0 +0 0 1056 +0 0 143 +3 49 520 +0 0 0 +1 5 163 +1 0 156 +4 0 670 +0 0 0 +1 1 157 +3 0 522 +0 154 0 +0 0 0 +select substr(vc255,2,3), conv(substr(vc255,2,3),16,10) from dtypes where id < 50 ; +substr(vc255,2,3) conv(substr(vc255,2,3),16,10) +8.7 8 +.29 0 +.84 0 +.9 0 +.2 0 +0.9 0 +0.2 0 +7.8 7 +.81 0 +.17 0 +849 2121 +6.6 6 +.49 0 +.91 0 +652 1618 +5.7 5 +6.6 6 + NULL +342 834 + NULL +0.0 0 +34 52 + NULL +342 834 +.23 0 +.88 0 +.23 0 +223 547 +44 68 +.23 0 +4.8 4 +23. 35 +88 136 +.23 0 +.57 0 +321 801 +4.4 4 +5.5 5 +.85 0 +014 20 +3.3 3 +6.0 6 +.72 0 +2.7 2 +9.6 9 +.89 0 +1.0 1 +4.9 4 +.37 0 +select conv (c1, 5, 2), conv(substr(c8,2,4), 8, 2), conv(concat(vc1, vc2), 10, 2) from dtypes; +conv (c1, 5, 2) conv(substr(c8,2,4), 8, 2) conv(concat(vc1, vc2), 10, 2) +0 0 0 +1 0 1011 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 111 0 +100 0 101100 +0 0 0 +100 0 111000000 +0 110 0 +0 0 1100011 +0 0 0 +10 110101010101 11100010 +0 101 0 +1 110 1110100 +1 NULL 1011 +10 11100010011 11011111 +10 NULL 10110 +0 0 0 +10 11100 11011111 +11 NULL 100001 +10 11100010011 11011111 +0 0 1011000 +0 0 1100011 +100 0 101100 +0 10010011011 0 +0 100100 0 +1 0 1011 +100 100 110111100 +0 10011 0 +0 0 1101111000 +1 0 1011 +0 0 0 +11 11010001101 101001101 +0 100 0 +10 101 11100001 +0 0 0 +100 1100000 110111000 +0 11 0 +11 110 101010000 +0 0 0 +0 10 0 +100 0 111000001 +0 0 0 +0 1 0 +0 100 1010011000 +0 0 0 +0 0 0 +0 1 1101110001 +0 0 0 +1 110001010 1110100 +100 100 110111100 +0 100100 0 +0 0 0 +1 0 1101110 +0 0 0 +1 0 1011 +1 10001 1110000 +0 0 0 +0 1000101011 1000100111 +10 0 10110 +1 100100 1110010 +0 0 0 +11 0 100001 +1 110 1110100 +0 0 0 +11 0 101010011 +100 0 101100 +1 0 1110111 +0 0 0 +100 110101 110111110 +0 0 110111 +10 10101 11011110 +0 0 0 +100 101011 110111101 +0 0 1000010 +10 101110 11100001 +0 0 0 +10 11100101001 11011111 +0 0 1001101 +10 0 11100100 +0 0 0 +11 111110 101010001 +0 0 1011000 +11 10100 101001100 +0 0 0 +0 0 1000101110 +0 0 1100011 +11 110001 101010000 +0 0 0 +1 101 1110011 +1 0 1101110 +100 0 110111000 +0 0 0 +1 1 1101111 +11 0 101010010 +0 10011010 0 +0 0 0 +drop table if exists bug3509; +create table bug3509 (cookie varchar(32), d_datekey date) engine=columnstore; +insert into bug3509 values ('f48d2dce907ce3c54a9c12855754c0b5', 19980404); +select conv(substr(cookie,1,12),16,10), conv(substr(cookie,1,16),16,10), conv(substr(cookie,1,16),18,10) from bug3509; +conv(substr(cookie,1,12),16,10) conv(substr(cookie,1,16),16,10) conv(substr(cookie,1,16),18,10) +268887196078204 17621791282181235653 18446744073709551615 +drop table bug3509; +DROP DATABASE regr_fe_conv; diff --git a/mysql-test/columnstore/basic/r/regr-fe-substr.result b/mysql-test/columnstore/basic/r/regr-fe-substr.result new file mode 100644 index 000000000..c0bc28b25 --- /dev/null +++ b/mysql-test/columnstore/basic/r/regr-fe-substr.result @@ -0,0 +1,2749 @@ +DROP DATABASE IF EXISTS regr_fe_substr; +CREATE DATABASE regr_fe_substr; +USE regr_fe_substr; +Warnings: +Note 1051 Unknown table 'regr_fe_substr.datatypetestm' +select cidx, CCHAR1, SUBSTR(CCHAR1,1) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1,1) +1 a a +2 a a +3 a a +4 a a +5 a a +6 z z +7 z z +8 z z +9 z z +10 z z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1,5) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1,5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1,7) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1,7) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1,8) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1,8) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1,9) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1,9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1 FROM 5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1 FROM 9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1,5,2) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1,5,2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1,9,3) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1,9,3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1 FROM 5 FOR 2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR1 SUBSTR(CCHAR1 FROM 9 FOR 3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2,1) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2,1) +1 aa aa +2 b b +3 bb bb +4 bb bb +5 bb bb +6 yy yy +7 yy yy +8 yy yy +9 yy yy +10 zz zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2,5) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2,5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2,7) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2,7) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2,8) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2,8) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2,9) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2,9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2 FROM 5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2 FROM 9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2,5,2) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2,5,2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2,9,3) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2,9,3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2 FROM 5 FOR 2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR2 SUBSTR(CCHAR2 FROM 9 FOR 3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3,1) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3,1) +1 aaa aaa +2 c c +3 cc cc +4 ccc ccc +5 ccc ccc +6 xxx xxx +7 xxx xxx +8 xxx xxx +9 xxx xxx +10 zzz zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3,5) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3,5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3,7) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3,7) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3,8) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3,8) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3,9) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3,9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3 FROM 5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3 FROM 9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3,5,2) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3,5,2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3,9,3) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3,9,3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3 FROM 5 FOR 2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR3 SUBSTR(CCHAR3 FROM 9 FOR 3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4,1) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4,1) +1 aaaa aaaa +2 d d +3 dd dd +4 ddd ddd +5 dddd dddd +6 wwww wwww +7 wwww wwww +8 wwww wwww +9 wwww wwww +10 zzzz zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4,5) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4,5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4,7) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4,7) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4,8) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4,8) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4,9) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4,9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4 FROM 5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4 FROM 9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4,5,2) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4,5,2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4,9,3) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4,9,3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4 FROM 5 FOR 2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR4 SUBSTR(CCHAR4 FROM 9 FOR 3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5,1) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5,1) +1 aaaaa aaaaa +2 e e +3 ee ee +4 eee eee +5 eeee eeee +6 vvvvv vvvvv +7 vvvvv vvvvv +8 vvvvv vvvvv +9 vvvvv vvvvv +10 zzzzz zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5,5) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5,5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5,7) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5,7) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5,8) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5,8) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5,9) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5,9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5 FROM 5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5 FROM 9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5,5,2) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5,5,2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5,9,3) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5,9,3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5 FROM 5 FOR 2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR5 SUBSTR(CCHAR5 FROM 9 FOR 3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6,1) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6,1) +1 aaaaaa aaaaaa +2 f f +3 ff ff +4 fff fff +5 ffff ffff +6 uuuuuu uuuuuu +7 uuuuuu uuuuuu +8 uuuuuu uuuuuu +9 uuuuuu uuuuuu +10 zzzzzz zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6,5) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6,5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6,7) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6,7) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6,8) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6,8) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6,9) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6,9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6 FROM 5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6 FROM 9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6,5,2) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6,5,2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6,9,3) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6,9,3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6 FROM 5 FOR 2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR6 SUBSTR(CCHAR6 FROM 9 FOR 3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7,1) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7,1) +1 aaaaaaa aaaaaaa +2 g g +3 gg gg +4 ggg ggg +5 gggg gggg +6 ttttttt ttttttt +7 ttttttt ttttttt +8 ttttttt ttttttt +9 ttttttt ttttttt +10 zzzzzzz zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7,5) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7,5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7,7) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7,7) +1 aaaaaaa a +2 g +3 gg +4 ggg +5 gggg +6 ttttttt t +7 ttttttt t +8 ttttttt t +9 ttttttt t +10 zzzzzzz z +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7,8) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7,8) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7,9) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7,9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7 FROM 5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7 FROM 9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7,5,2) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7,5,2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7,9,3) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7,9,3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7 FROM 5 FOR 2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR7 SUBSTR(CCHAR7 FROM 9 FOR 3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8,1) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8,1) +1 aaaaaaaa aaaaaaaa +2 h h +3 hh hh +4 hhh hhh +5 hhhh hhhh +6 sssssss sssssss +7 ssssssss ssssssss +8 ssssssss ssssssss +9 ssssssss ssssssss +10 zzzzzzzz zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8,5) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8,5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8,7) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8,7) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss s +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8,8) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8,8) +1 aaaaaaaa a +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss s +8 ssssssss s +9 ssssssss s +10 zzzzzzzz z +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8,9) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8,9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8 FROM 5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8 FROM 9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8,5,2) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8,5,2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8,9,3) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8,9,3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8 FROM 5 FOR 2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR8 SUBSTR(CCHAR8 FROM 9 FOR 3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9,1) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9,1) +1 aaaaaaaaa aaaaaaaaa +2 i i +3 ii ii +4 iii iii +5 iiii iiii +6 rrrrrrr rrrrrrr +7 rrrrrrrr rrrrrrrr +8 rrrrrrrrr rrrrrrrrr +9 rrrrrrrrr rrrrrrrrr +10 zzzzzzzzz zzzzzzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9,5) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9,5) +1 aaaaaaaaa aaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rrr +7 rrrrrrrr rrrr +8 rrrrrrrrr rrrrr +9 rrrrrrrrr rrrrr +10 zzzzzzzzz zzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9,7) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9,7) +1 aaaaaaaaa aaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr r +7 rrrrrrrr rr +8 rrrrrrrrr rrr +9 rrrrrrrrr rrr +10 zzzzzzzzz zzz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9,8) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9,8) +1 aaaaaaaaa aa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr r +8 rrrrrrrrr rr +9 rrrrrrrrr rr +10 zzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9,9) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9,9) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 5) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9 FROM 5) +1 aaaaaaaaa aaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rrr +7 rrrrrrrr rrrr +8 rrrrrrrrr rrrrr +9 rrrrrrrrr rrrrr +10 zzzzzzzzz zzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 9) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9 FROM 9) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9,5,2) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9,5,2) +1 aaaaaaaaa aa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rr +7 rrrrrrrr rr +8 rrrrrrrrr rr +9 rrrrrrrrr rr +10 zzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9,9,3) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9,9,3) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9 FROM 5 FOR 2) +1 aaaaaaaaa aa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rr +7 rrrrrrrr rr +8 rrrrrrrrr rr +9 rrrrrrrrr rr +10 zzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR9 SUBSTR(CCHAR9 FROM 9 FOR 3) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255,1) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255,1) +1 aaaaaaaaaa aaaaaaaaaa +2 j j +3 jj jj +4 jjj jjj +5 jjjj jjjj +6 qqqqqqq qqqqqqq +7 qqqqqqqq qqqqqqqq +8 qqqqqqqqq qqqqqqqqq +9 qqqqqqqqqq qqqqqqqqqq +10 zzzzzzzzzz zzzzzzzzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255,5) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255,5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255,7) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255,7) +1 aaaaaaaaaa aaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq q +7 qqqqqqqq qq +8 qqqqqqqqq qqq +9 qqqqqqqqqq qqqq +10 zzzzzzzzzz zzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255,8) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255,8) +1 aaaaaaaaaa aaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq q +8 qqqqqqqqq qq +9 qqqqqqqqqq qqq +10 zzzzzzzzzz zzz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255,9) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255,9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 5) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255 FROM 5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 9) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255 FROM 9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255,5,2) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255,5,2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255,9,3) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255,9,3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255 FROM 5 FOR 2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR255 SUBSTR(CCHAR255 FROM 9 FOR 3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1,1) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1,1) +1 a a +2 a a +3 a a +4 a a +5 a a +6 z z +7 z z +8 z z +9 z z +10 z z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1,5) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1,5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1,7) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1,7) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1,8) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1,8) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1,9) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1,9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1,5,2) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1,5,2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1,9,3) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1,9,3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 5 FOR 2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR1 SUBSTR(CVCHAR1 FROM 9 FOR 3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2,1) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2,1) +1 aa aa +2 b b +3 bb bb +4 bb bb +5 bb bb +6 yy yy +7 yy yy +8 yy yy +9 yy yy +10 zz zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2,5) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2,5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2,7) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2,7) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2,8) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2,8) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2,9) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2,9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2,5,2) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2,5,2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2,9,3) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2,9,3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 5 FOR 2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR2 SUBSTR(CVCHAR2 FROM 9 FOR 3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3,1) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3,1) +1 aaa aaa +2 c c +3 cc cc +4 ccc ccc +5 ccc ccc +6 xxx xxx +7 xxx xxx +8 xxx xxx +9 xxx xxx +10 zzz zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3,5) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3,5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3,7) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3,7) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3,8) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3,8) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3,9) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3,9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3,5,2) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3,5,2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3,9,3) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3,9,3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 5 FOR 2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR3 SUBSTR(CVCHAR3 FROM 9 FOR 3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4,1) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4,1) +1 aaaa aaaa +2 d d +3 dd dd +4 ddd ddd +5 dddd dddd +6 wwww wwww +7 wwww wwww +8 wwww wwww +9 wwww wwww +10 zzzz zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4,5) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4,5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4,7) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4,7) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4,8) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4,8) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4,9) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4,9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4,5,2) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4,5,2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4,9,3) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4,9,3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 5 FOR 2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR4 SUBSTR(CVCHAR4 FROM 9 FOR 3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5,1) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5,1) +1 aaaaa aaaaa +2 e e +3 ee ee +4 eee eee +5 eeee eeee +6 vvvvv vvvvv +7 vvvvv vvvvv +8 vvvvv vvvvv +9 vvvvv vvvvv +10 zzzzz zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5,5) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5,5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5,7) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5,7) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5,8) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5,8) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5,9) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5,9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5,5,2) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5,5,2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5,9,3) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5,9,3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 5 FOR 2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR5 SUBSTR(CVCHAR5 FROM 9 FOR 3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6,1) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6,1) +1 aaaaaa aaaaaa +2 f f +3 ff ff +4 fff fff +5 ffff ffff +6 uuuuuu uuuuuu +7 uuuuuu uuuuuu +8 uuuuuu uuuuuu +9 uuuuuu uuuuuu +10 zzzzzz zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6,5) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6,5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6,7) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6,7) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6,8) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6,8) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6,9) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6,9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6,5,2) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6,5,2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6,9,3) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6,9,3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 5 FOR 2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR6 SUBSTR(CVCHAR6 FROM 9 FOR 3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7,1) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7,1) +1 aaaaaaa aaaaaaa +2 g g +3 gg gg +4 ggg ggg +5 gggg gggg +6 ttttttt ttttttt +7 ttttttt ttttttt +8 ttttttt ttttttt +9 ttttttt ttttttt +10 zzzzzzz zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7,5) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7,5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7,7) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7,7) +1 aaaaaaa a +2 g +3 gg +4 ggg +5 gggg +6 ttttttt t +7 ttttttt t +8 ttttttt t +9 ttttttt t +10 zzzzzzz z +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7,8) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7,8) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7,9) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7,9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7,5,2) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7,5,2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7,9,3) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7,9,3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 5 FOR 2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR7 SUBSTR(CVCHAR7 FROM 9 FOR 3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8,1) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8,1) +1 aaaaaaaa aaaaaaaa +2 h h +3 hh hh +4 hhh hhh +5 hhhh hhhh +6 sssssss sssssss +7 ssssssss ssssssss +8 ssssssss ssssssss +9 ssssssss ssssssss +10 zzzzzzzz zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8,5) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8,5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8,7) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8,7) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss s +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8,8) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8,8) +1 aaaaaaaa a +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss s +8 ssssssss s +9 ssssssss s +10 zzzzzzzz z +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8,9) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8,9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8,5,2) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8,5,2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8,9,3) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8,9,3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 5 FOR 2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR8 SUBSTR(CVCHAR8 FROM 9 FOR 3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255,1) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255,1) +1 aaaaaaaaaa aaaaaaaaaa +2 j j +3 jj jj +4 jjj jjj +5 jjjj jjjj +6 qqqqqqq qqqqqqq +7 qqqqqqqq qqqqqqqq +8 qqqqqqqqq qqqqqqqqq +9 qqqqqqqqqq qqqqqqqqqq +10 zzzzzzzzzz zzzzzzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255,5) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255,5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255,7) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255,7) +1 aaaaaaaaaa aaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq q +7 qqqqqqqq qq +8 qqqqqqqqq qqq +9 qqqqqqqqqq qqqq +10 zzzzzzzzzz zzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255,8) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255,8) +1 aaaaaaaaaa aaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq q +8 qqqqqqqqq qq +9 qqqqqqqqqq qqq +10 zzzzzzzzzz zzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255,9) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255,9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 5) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255 FROM 5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 9) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255 FROM 9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255,5,2) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255,5,2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255,9,3) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255,9,3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255 FROM 5 FOR 2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR255 SUBSTR(CVCHAR255 FROM 9 FOR 3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR1 from datatypetestm where SUBSTR(CCHAR1,1) <> CCHAR1; +cidx CCHAR1 +select cidx, CCHAR1 from datatypetestm where SUBSTR(CCHAR1,5) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTR(CCHAR1,7) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +DROP DATABASE regr_fe_substr; diff --git a/mysql-test/columnstore/basic/r/regr-fe-substring.result b/mysql-test/columnstore/basic/r/regr-fe-substring.result new file mode 100644 index 000000000..b8cbbfccf --- /dev/null +++ b/mysql-test/columnstore/basic/r/regr-fe-substring.result @@ -0,0 +1,5041 @@ +DROP DATABASE IF EXISTS regr_fe_substr; +CREATE DATABASE regr_fe_substr; +USE regr_fe_substr; +Warnings: +Note 1051 Unknown table 'regr_fe_substr.datatypetestm' +select cidx, CCHAR1, SUBSTRING(CCHAR1,1) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1,1) +1 a a +2 a a +3 a a +4 a a +5 a a +6 z z +7 z z +8 z z +9 z z +10 z z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1,5) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1,5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1,7) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1,7) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1,8) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1,8) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1,9) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1,9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1 FROM 5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1 FROM 9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1,5,2) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1,5,2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1,9,3) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1,9,3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1 FROM 5 FOR 2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR1 SUBSTRING(CCHAR1 FROM 9 FOR 3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2,1) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2,1) +1 aa aa +2 b b +3 bb bb +4 bb bb +5 bb bb +6 yy yy +7 yy yy +8 yy yy +9 yy yy +10 zz zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2,5) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2,5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2,7) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2,7) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2,8) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2,8) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2,9) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2,9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2 FROM 5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2 FROM 9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2,5,2) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2,5,2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2,9,3) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2,9,3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2 FROM 5 FOR 2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR2 SUBSTRING(CCHAR2 FROM 9 FOR 3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3,1) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3,1) +1 aaa aaa +2 c c +3 cc cc +4 ccc ccc +5 ccc ccc +6 xxx xxx +7 xxx xxx +8 xxx xxx +9 xxx xxx +10 zzz zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3,5) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3,5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3,7) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3,7) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3,8) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3,8) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3,9) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3,9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3 FROM 5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3 FROM 9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3,5,2) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3,5,2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3,9,3) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3,9,3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3 FROM 5 FOR 2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR3 SUBSTRING(CCHAR3 FROM 9 FOR 3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4,1) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4,1) +1 aaaa aaaa +2 d d +3 dd dd +4 ddd ddd +5 dddd dddd +6 wwww wwww +7 wwww wwww +8 wwww wwww +9 wwww wwww +10 zzzz zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4,5) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4,5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4,7) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4,7) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4,8) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4,8) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4,9) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4,9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4 FROM 5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4 FROM 9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4,5,2) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4,5,2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4,9,3) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4,9,3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4 FROM 5 FOR 2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR4 SUBSTRING(CCHAR4 FROM 9 FOR 3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5,1) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5,1) +1 aaaaa aaaaa +2 e e +3 ee ee +4 eee eee +5 eeee eeee +6 vvvvv vvvvv +7 vvvvv vvvvv +8 vvvvv vvvvv +9 vvvvv vvvvv +10 zzzzz zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5,5) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5,5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5,7) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5,7) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5,8) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5,8) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5,9) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5,9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5 FROM 5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5 FROM 9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5,5,2) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5,5,2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5,9,3) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5,9,3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5 FROM 5 FOR 2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR5 SUBSTRING(CCHAR5 FROM 9 FOR 3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6,1) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6,1) +1 aaaaaa aaaaaa +2 f f +3 ff ff +4 fff fff +5 ffff ffff +6 uuuuuu uuuuuu +7 uuuuuu uuuuuu +8 uuuuuu uuuuuu +9 uuuuuu uuuuuu +10 zzzzzz zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6,5) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6,5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6,7) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6,7) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6,8) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6,8) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6,9) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6,9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6 FROM 5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6 FROM 9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6,5,2) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6,5,2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6,9,3) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6,9,3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6 FROM 5 FOR 2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR6 SUBSTRING(CCHAR6 FROM 9 FOR 3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7,1) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7,1) +1 aaaaaaa aaaaaaa +2 g g +3 gg gg +4 ggg ggg +5 gggg gggg +6 ttttttt ttttttt +7 ttttttt ttttttt +8 ttttttt ttttttt +9 ttttttt ttttttt +10 zzzzzzz zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7,5) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7,5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7,7) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7,7) +1 aaaaaaa a +2 g +3 gg +4 ggg +5 gggg +6 ttttttt t +7 ttttttt t +8 ttttttt t +9 ttttttt t +10 zzzzzzz z +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7,8) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7,8) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7,9) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7,9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7 FROM 5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7 FROM 9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7,5,2) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7,5,2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7,9,3) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7,9,3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7 FROM 5 FOR 2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR7 SUBSTRING(CCHAR7 FROM 9 FOR 3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8,1) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8,1) +1 aaaaaaaa aaaaaaaa +2 h h +3 hh hh +4 hhh hhh +5 hhhh hhhh +6 sssssss sssssss +7 ssssssss ssssssss +8 ssssssss ssssssss +9 ssssssss ssssssss +10 zzzzzzzz zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8,5) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8,5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8,7) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8,7) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss s +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8,8) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8,8) +1 aaaaaaaa a +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss s +8 ssssssss s +9 ssssssss s +10 zzzzzzzz z +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8,9) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8,9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8 FROM 5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8 FROM 9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8,5,2) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8,5,2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8,9,3) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8,9,3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8 FROM 5 FOR 2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR8 SUBSTRING(CCHAR8 FROM 9 FOR 3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9,1) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9,1) +1 aaaaaaaaa aaaaaaaaa +2 i i +3 ii ii +4 iii iii +5 iiii iiii +6 rrrrrrr rrrrrrr +7 rrrrrrrr rrrrrrrr +8 rrrrrrrrr rrrrrrrrr +9 rrrrrrrrr rrrrrrrrr +10 zzzzzzzzz zzzzzzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9,5) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9,5) +1 aaaaaaaaa aaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rrr +7 rrrrrrrr rrrr +8 rrrrrrrrr rrrrr +9 rrrrrrrrr rrrrr +10 zzzzzzzzz zzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9,7) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9,7) +1 aaaaaaaaa aaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr r +7 rrrrrrrr rr +8 rrrrrrrrr rrr +9 rrrrrrrrr rrr +10 zzzzzzzzz zzz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9,8) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9,8) +1 aaaaaaaaa aa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr r +8 rrrrrrrrr rr +9 rrrrrrrrr rr +10 zzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9,9) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9,9) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 5) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9 FROM 5) +1 aaaaaaaaa aaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rrr +7 rrrrrrrr rrrr +8 rrrrrrrrr rrrrr +9 rrrrrrrrr rrrrr +10 zzzzzzzzz zzzzz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 9) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9 FROM 9) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9,5,2) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9,5,2) +1 aaaaaaaaa aa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rr +7 rrrrrrrr rr +8 rrrrrrrrr rr +9 rrrrrrrrr rr +10 zzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9,9,3) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9,9,3) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9 FROM 5 FOR 2) +1 aaaaaaaaa aa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr rr +7 rrrrrrrr rr +8 rrrrrrrrr rr +9 rrrrrrrrr rr +10 zzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR9 SUBSTRING(CCHAR9 FROM 9 FOR 3) +1 aaaaaaaaa a +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr r +9 rrrrrrrrr r +10 zzzzzzzzz z +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255,1) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255,1) +1 aaaaaaaaaa aaaaaaaaaa +2 j j +3 jj jj +4 jjj jjj +5 jjjj jjjj +6 qqqqqqq qqqqqqq +7 qqqqqqqq qqqqqqqq +8 qqqqqqqqq qqqqqqqqq +9 qqqqqqqqqq qqqqqqqqqq +10 zzzzzzzzzz zzzzzzzzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255,5) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255,5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255,7) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255,7) +1 aaaaaaaaaa aaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq q +7 qqqqqqqq qq +8 qqqqqqqqq qqq +9 qqqqqqqqqq qqqq +10 zzzzzzzzzz zzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255,8) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255,8) +1 aaaaaaaaaa aaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq q +8 qqqqqqqqq qq +9 qqqqqqqqqq qqq +10 zzzzzzzzzz zzz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255,9) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255,9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 5) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255 FROM 5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 9) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255 FROM 9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255,5,2) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255,5,2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255,9,3) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255,9,3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 5 FOR 2) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255 FROM 5 FOR 2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 9 FOR 3) from datatypetestm; +cidx CCHAR255 SUBSTRING(CCHAR255 FROM 9 FOR 3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,1) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1,1) +1 a a +2 a a +3 a a +4 a a +5 a a +6 z z +7 z z +8 z z +9 z z +10 z z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1,5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,7) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1,7) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,8) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1,8) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1,9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 5) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 9) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5,2) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1,5,2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9,3) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1,9,3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 5 FOR 2) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR1 SUBSTRING(CVCHAR1 FROM 9 FOR 3) +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,1) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2,1) +1 aa aa +2 b b +3 bb bb +4 bb bb +5 bb bb +6 yy yy +7 yy yy +8 yy yy +9 yy yy +10 zz zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2,5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,7) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2,7) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,8) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2,8) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2,9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 5) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 9) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5,2) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2,5,2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9,3) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2,9,3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 5 FOR 2) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR2 SUBSTRING(CVCHAR2 FROM 9 FOR 3) +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,1) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3,1) +1 aaa aaa +2 c c +3 cc cc +4 ccc ccc +5 ccc ccc +6 xxx xxx +7 xxx xxx +8 xxx xxx +9 xxx xxx +10 zzz zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3,5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,7) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3,7) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,8) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3,8) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3,9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 5) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 9) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5,2) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3,5,2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9,3) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3,9,3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 5 FOR 2) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR3 SUBSTRING(CVCHAR3 FROM 9 FOR 3) +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,1) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4,1) +1 aaaa aaaa +2 d d +3 dd dd +4 ddd ddd +5 dddd dddd +6 wwww wwww +7 wwww wwww +8 wwww wwww +9 wwww wwww +10 zzzz zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4,5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,7) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4,7) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,8) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4,8) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4,9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 5) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 9) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5,2) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4,5,2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9,3) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4,9,3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 5 FOR 2) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR4 SUBSTRING(CVCHAR4 FROM 9 FOR 3) +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,1) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5,1) +1 aaaaa aaaaa +2 e e +3 ee ee +4 eee eee +5 eeee eeee +6 vvvvv vvvvv +7 vvvvv vvvvv +8 vvvvv vvvvv +9 vvvvv vvvvv +10 zzzzz zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,5) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5,5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,7) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5,7) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,8) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5,8) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5,9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 5) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 9) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,5,2) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5,5,2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9,3) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5,9,3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 5 FOR 2) +1 aaaaa a +2 e +3 ee +4 eee +5 eeee +6 vvvvv v +7 vvvvv v +8 vvvvv v +9 vvvvv v +10 zzzzz z +11 NULL NULL +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR5 SUBSTRING(CVCHAR5 FROM 9 FOR 3) +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,1) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6,1) +1 aaaaaa aaaaaa +2 f f +3 ff ff +4 fff fff +5 ffff ffff +6 uuuuuu uuuuuu +7 uuuuuu uuuuuu +8 uuuuuu uuuuuu +9 uuuuuu uuuuuu +10 zzzzzz zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,5) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6,5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,7) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6,7) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,8) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6,8) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6,9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 5) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 9) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,5,2) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6,5,2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9,3) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6,9,3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 5 FOR 2) +1 aaaaaa aa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu uu +7 uuuuuu uu +8 uuuuuu uu +9 uuuuuu uu +10 zzzzzz zz +11 NULL NULL +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR6 SUBSTRING(CVCHAR6 FROM 9 FOR 3) +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,1) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7,1) +1 aaaaaaa aaaaaaa +2 g g +3 gg gg +4 ggg ggg +5 gggg gggg +6 ttttttt ttttttt +7 ttttttt ttttttt +8 ttttttt ttttttt +9 ttttttt ttttttt +10 zzzzzzz zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,5) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7,5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,7) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7,7) +1 aaaaaaa a +2 g +3 gg +4 ggg +5 gggg +6 ttttttt t +7 ttttttt t +8 ttttttt t +9 ttttttt t +10 zzzzzzz z +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,8) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7,8) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7,9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 5) +1 aaaaaaa aaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt ttt +7 ttttttt ttt +8 ttttttt ttt +9 ttttttt ttt +10 zzzzzzz zzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 9) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,5,2) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7,5,2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9,3) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7,9,3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 5 FOR 2) +1 aaaaaaa aa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt tt +7 ttttttt tt +8 ttttttt tt +9 ttttttt tt +10 zzzzzzz zz +11 NULL NULL +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR7 SUBSTRING(CVCHAR7 FROM 9 FOR 3) +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,1) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8,1) +1 aaaaaaaa aaaaaaaa +2 h h +3 hh hh +4 hhh hhh +5 hhhh hhhh +6 sssssss sssssss +7 ssssssss ssssssss +8 ssssssss ssssssss +9 ssssssss ssssssss +10 zzzzzzzz zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,5) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8,5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,7) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8,7) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss s +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,8) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8,8) +1 aaaaaaaa a +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss s +8 ssssssss s +9 ssssssss s +10 zzzzzzzz z +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8,9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 5) +1 aaaaaaaa aaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss sss +7 ssssssss ssss +8 ssssssss ssss +9 ssssssss ssss +10 zzzzzzzz zzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 9) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,5,2) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8,5,2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9,3) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8,9,3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 5 FOR 2) +1 aaaaaaaa aa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss ss +7 ssssssss ss +8 ssssssss ss +9 ssssssss ss +10 zzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR8 SUBSTRING(CVCHAR8 FROM 9 FOR 3) +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,1) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255,1) +1 aaaaaaaaaa aaaaaaaaaa +2 j j +3 jj jj +4 jjj jjj +5 jjjj jjjj +6 qqqqqqq qqqqqqq +7 qqqqqqqq qqqqqqqq +8 qqqqqqqqq qqqqqqqqq +9 qqqqqqqqqq qqqqqqqqqq +10 zzzzzzzzzz zzzzzzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,5) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255,5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,7) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255,7) +1 aaaaaaaaaa aaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq q +7 qqqqqqqq qq +8 qqqqqqqqq qqq +9 qqqqqqqqqq qqqq +10 zzzzzzzzzz zzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,8) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255,8) +1 aaaaaaaaaa aaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq q +8 qqqqqqqqq qq +9 qqqqqqqqqq qqq +10 zzzzzzzzzz zzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,9) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255,9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 5) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255 FROM 5) +1 aaaaaaaaaa aaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qqq +7 qqqqqqqq qqqq +8 qqqqqqqqq qqqqq +9 qqqqqqqqqq qqqqqq +10 zzzzzzzzzz zzzzzz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 9) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255 FROM 9) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,5,2) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255,5,2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,9,3) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255,9,3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 5 FOR 2) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255 FROM 5 FOR 2) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq qq +7 qqqqqqqq qq +8 qqqqqqqqq qq +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 9 FOR 3) from datatypetestm; +cidx CVCHAR255 SUBSTRING(CVCHAR255 FROM 9 FOR 3) +1 aaaaaaaaaa aa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq q +9 qqqqqqqqqq qq +10 zzzzzzzzzz zz +11 NULL NULL +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,1) <> CCHAR1; +cidx CCHAR1 +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,5) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,7) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,8) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,9) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 5) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 9) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,5,2) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,9,3) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 5 FOR 2) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 9 FOR 3) <> CCHAR1; +cidx CCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,1) <> CCHAR2; +cidx CCHAR2 +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,5) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,7) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,8) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,9) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 5) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 9) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,5,2) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,9,3) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 5 FOR 2) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 9 FOR 3) <> CCHAR2; +cidx CCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,1) <> CCHAR3; +cidx CCHAR3 +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,5) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,7) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,8) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,9) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 5) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 9) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,5,2) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,9,3) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 5 FOR 2) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 9 FOR 3) <> CCHAR3; +cidx CCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,1) <> CCHAR4; +cidx CCHAR4 +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,5) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,7) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,8) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,9) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 5) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 9) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,5,2) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,9,3) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 5 FOR 2) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 9 FOR 3) <> CCHAR4; +cidx CCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,1) <> CCHAR5; +cidx CCHAR5 +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,5) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,7) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,8) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,9) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 5) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 9) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,5,2) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,9,3) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 5 FOR 2) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 9 FOR 3) <> CCHAR5; +cidx CCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,1) <> CCHAR6; +cidx CCHAR6 +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,5) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,7) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,8) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,9) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 5) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 9) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,5,2) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,9,3) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 5 FOR 2) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 9 FOR 3) <> CCHAR6; +cidx CCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,1) <> CCHAR7; +cidx CCHAR7 +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,5) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,7) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,8) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,9) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 5) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 9) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,5,2) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,9,3) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 5 FOR 2) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 9 FOR 3) <> CCHAR7; +cidx CCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,1) <> CCHAR8; +cidx CCHAR8 +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,5) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,7) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,8) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,9) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 5) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 9) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,5,2) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,9,3) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 5 FOR 2) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 9 FOR 3) <> CCHAR8; +cidx CCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,1) <> CCHAR9; +cidx CCHAR9 +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,5) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,7) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,8) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,9) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 5) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 9) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,5,2) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,9,3) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 5 FOR 2) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 9 FOR 3) <> CCHAR9; +cidx CCHAR9 +1 aaaaaaaaa +2 i +3 ii +4 iii +5 iiii +6 rrrrrrr +7 rrrrrrrr +8 rrrrrrrrr +9 rrrrrrrrr +10 zzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,1) <> CCHAR255; +cidx CCHAR255 +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,5) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,7) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,8) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,9) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 5) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 9) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,5,2) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,9,3) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 5 FOR 2) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 9 FOR 3) <> CCHAR255; +cidx CCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,1) <> CVCHAR1; +cidx CVCHAR1 +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,5) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,7) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,8) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,9) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 5) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 9) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,5,2) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,9,3) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 5 FOR 2) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 9 FOR 3) <> CVCHAR1; +cidx CVCHAR1 +1 a +2 a +3 a +4 a +5 a +6 z +7 z +8 z +9 z +10 z +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,1) <> CVCHAR2; +cidx CVCHAR2 +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,5) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,7) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,8) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,9) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 5) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 9) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,5,2) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,9,3) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 5 FOR 2) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 9 FOR 3) <> CVCHAR2; +cidx CVCHAR2 +1 aa +2 b +3 bb +4 bb +5 bb +6 yy +7 yy +8 yy +9 yy +10 zz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,1) <> CVCHAR3; +cidx CVCHAR3 +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,5) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,7) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,8) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,9) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 5) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 9) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,5,2) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,9,3) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 5 FOR 2) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 9 FOR 3) <> CVCHAR3; +cidx CVCHAR3 +1 aaa +2 c +3 cc +4 ccc +5 ccc +6 xxx +7 xxx +8 xxx +9 xxx +10 zzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,1) <> CVCHAR4; +cidx CVCHAR4 +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,5) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,7) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,8) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,9) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 5) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 9) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,5,2) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,9,3) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 5 FOR 2) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 9 FOR 3) <> CVCHAR4; +cidx CVCHAR4 +1 aaaa +2 d +3 dd +4 ddd +5 dddd +6 wwww +7 wwww +8 wwww +9 wwww +10 zzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,1) <> CVCHAR5; +cidx CVCHAR5 +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,5) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,7) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,8) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,9) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 5) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 9) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,5,2) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,9,3) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 5 FOR 2) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 9 FOR 3) <> CVCHAR5; +cidx CVCHAR5 +1 aaaaa +2 e +3 ee +4 eee +5 eeee +6 vvvvv +7 vvvvv +8 vvvvv +9 vvvvv +10 zzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,1) <> CVCHAR6; +cidx CVCHAR6 +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,5) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,7) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,8) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,9) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 5) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 9) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,5,2) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,9,3) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 5 FOR 2) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 9 FOR 3) <> CVCHAR6; +cidx CVCHAR6 +1 aaaaaa +2 f +3 ff +4 fff +5 ffff +6 uuuuuu +7 uuuuuu +8 uuuuuu +9 uuuuuu +10 zzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,1) <> CVCHAR7; +cidx CVCHAR7 +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,5) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,7) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,8) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,9) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 5) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 9) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,5,2) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,9,3) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 5 FOR 2) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 9 FOR 3) <> CVCHAR7; +cidx CVCHAR7 +1 aaaaaaa +2 g +3 gg +4 ggg +5 gggg +6 ttttttt +7 ttttttt +8 ttttttt +9 ttttttt +10 zzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,1) <> CVCHAR8; +cidx CVCHAR8 +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,5) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,7) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,8) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,9) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 5) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 9) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,5,2) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,9,3) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 5 FOR 2) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 9 FOR 3) <> CVCHAR8; +cidx CVCHAR8 +1 aaaaaaaa +2 h +3 hh +4 hhh +5 hhhh +6 sssssss +7 ssssssss +8 ssssssss +9 ssssssss +10 zzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,1) <> CVCHAR255; +cidx CVCHAR255 +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,5) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,7) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,8) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,9) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 5) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 9) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,5,2) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,9,3) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 5 FOR 2) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 9 FOR 3) <> CVCHAR255; +cidx CVCHAR255 +1 aaaaaaaaaa +2 j +3 jj +4 jjj +5 jjjj +6 qqqqqqq +7 qqqqqqqq +8 qqqqqqqqq +9 qqqqqqqqqq +10 zzzzzzzzzz +DROP DATABASE regr_fe_substr; diff --git a/mysql-test/columnstore/basic/r/type_string.result b/mysql-test/columnstore/basic/r/type_string.result index 06cdc3bd4..8a19dc56e 100644 --- a/mysql-test/columnstore/basic/r/type_string.result +++ b/mysql-test/columnstore/basic/r/type_string.result @@ -1,5 +1,6 @@ DROP DATABASE IF EXISTS mcs_type_string; CREATE DATABASE mcs_type_string; +USE mcs_type_string; # # MCOL-4823 WHERE char_col 0))ENGINE=Columnstore; --replace_regex /( COLLATE=latin1_swedish_ci)// SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES(NULL, ''); +INSERT INTO t1 VALUES(NULL, NULL); INSERT INTO t1 VALUES(1, 'a'); --error ER_CONSTRAINT_FAILED INSERT INTO t1 VALUES(0, 'b'); diff --git a/mysql-test/columnstore/basic/t/mcs77_where_conditions.test b/mysql-test/columnstore/basic/t/mcs77_where_conditions.test index e84821300..919b5c051 100644 --- a/mysql-test/columnstore/basic/t/mcs77_where_conditions.test +++ b/mysql-test/columnstore/basic/t/mcs77_where_conditions.test @@ -23,7 +23,7 @@ CREATE TABLE t1 t1_datetime DATETIME )ENGINE=Columnstore; INSERT INTO t1 VALUES(); -INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO t1 VALUES(1, 123456, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-11 11:11:11'); INSERT INTO t1 VALUES(0, 1023456, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-11 11:11:11'); INSERT INTO t1 VALUES(1, -123456, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-11 11:11:11'); diff --git a/mysql-test/columnstore/basic/t/mcs78_aliases.test b/mysql-test/columnstore/basic/t/mcs78_aliases.test index 9926f002a..5839ff587 100644 --- a/mysql-test/columnstore/basic/t/mcs78_aliases.test +++ b/mysql-test/columnstore/basic/t/mcs78_aliases.test @@ -22,7 +22,7 @@ CREATE TABLE t1 t1_varchar VARCHAR(255) DEFAULT 'hello world!', t1_datetime DATETIME )ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '', '', '', NULL); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); INSERT INTO t1 VALUES(1, 11, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-09 11:11:11'); INSERT INTO t1 VALUES(0, 12, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-11 11:11:12'); INSERT INTO t1 VALUES(1, -12, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-10 11:11:10'); diff --git a/mysql-test/columnstore/basic/t/mcs79_exists.test b/mysql-test/columnstore/basic/t/mcs79_exists.test index 0b857c511..a4b33ab95 100644 --- a/mysql-test/columnstore/basic/t/mcs79_exists.test +++ b/mysql-test/columnstore/basic/t/mcs79_exists.test @@ -39,8 +39,8 @@ CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t3 (t3_int INT, t3_char CHAR(5))ENGINE=Innodb; CREATE TABLE t4 (t4_int INT, t4_char CHAR(5))ENGINE=Myisam; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, ''),(7, 'eee'); -INSERT INTO t2 VALUES (NULL, ''),(1, 'eee'),(3, 'ccc'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'eee'),(11, 'nnn'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, ''),(7, 'eee'); +INSERT INTO t2 VALUES (NULL, NULL),(1, 'eee'),(3, 'ccc'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'eee'),(11, 'nnn'); INSERT INTO t3 SELECT * FROM t2; INSERT INTO t4 SELECT * FROM t1; diff --git a/mysql-test/columnstore/basic/t/mcs81_self_join.test b/mysql-test/columnstore/basic/t/mcs81_self_join.test index 798f64982..73b77b6c3 100644 --- a/mysql-test/columnstore/basic/t/mcs81_self_join.test +++ b/mysql-test/columnstore/basic/t/mcs81_self_join.test @@ -12,7 +12,7 @@ CREATE DATABASE mcs81_db; USE mcs81_db; CREATE TABLE t1 (t1_col1 INT, t1_col2 TEXT)ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''); +INSERT INTO t1 VALUES (NULL, NULL); INSERT INTO t1 VALUES (1, repeat('a', 20)),(3, repeat('c', 20)),(5, repeat('a', 20)),(7, repeat('c', 20)),(9, repeat('a', 20)); --sorted_result diff --git a/mysql-test/columnstore/basic/t/mcs82_update_join.test b/mysql-test/columnstore/basic/t/mcs82_update_join.test index 745815e11..52f1e44c4 100644 --- a/mysql-test/columnstore/basic/t/mcs82_update_join.test +++ b/mysql-test/columnstore/basic/t/mcs82_update_join.test @@ -13,8 +13,8 @@ USE mcs82_db; CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); -INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); +INSERT INTO t2 VALUES (NULL, NULL),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); SELECT * FROM t1 ORDER BY t1_int; UPDATE t1 JOIN t2 on t1.t1_int=t2.t2_int SET t1.t1_char='sssss'; diff --git a/mysql-test/columnstore/basic/t/mcs83_delete_join.test b/mysql-test/columnstore/basic/t/mcs83_delete_join.test index 6d1bb58c3..0eb33bed8 100644 --- a/mysql-test/columnstore/basic/t/mcs83_delete_join.test +++ b/mysql-test/columnstore/basic/t/mcs83_delete_join.test @@ -13,8 +13,8 @@ USE mcs83_db; CREATE TABLE t1 (t1_int INT, t1_char CHAR(5))ENGINE=Columnstore; CREATE TABLE t2 (t2_int INT, t2_char CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); -INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa'); +INSERT INTO t2 VALUES (NULL, NULL),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn'); SELECT * FROM t1 ORDER BY t1_int; SELECT * FROM t2 ORDER BY t2_int; diff --git a/mysql-test/columnstore/basic/t/mcs90_aggregate_functions.test b/mysql-test/columnstore/basic/t/mcs90_aggregate_functions.test index b88307acc..09e545cd9 100644 --- a/mysql-test/columnstore/basic/t/mcs90_aggregate_functions.test +++ b/mysql-test/columnstore/basic/t/mcs90_aggregate_functions.test @@ -36,7 +36,7 @@ GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost'; FLUSH PRIVILEGES; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT * FROM t1; SELECT b, SUM(a) FROM t1 GROUP BY b ORDER BY b; diff --git a/mysql-test/columnstore/basic/t/mcs91_comparison_functions.test b/mysql-test/columnstore/basic/t/mcs91_comparison_functions.test index 44e59d542..853877e03 100644 --- a/mysql-test/columnstore/basic/t/mcs91_comparison_functions.test +++ b/mysql-test/columnstore/basic/t/mcs91_comparison_functions.test @@ -19,7 +19,7 @@ CREATE TABLE t1 t1_char CHAR(1), t1_datetime DATETIME )ENGINE=Columnstore; -INSERT INTO t1 VALUES(NULL, NULL, '', '', '0000-00-00'); +INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, '0000-00-00'); INSERT INTO t1 VALUES(123456, 111.11, repeat('a',10), 'a', '1111-11-11 11:11:11'); INSERT INTO t1 VALUES(NULL, 222.22, '', 'b', '2222-12-22 22:22:22'); diff --git a/mysql-test/columnstore/basic/t/mcs93_string_functions.test b/mysql-test/columnstore/basic/t/mcs93_string_functions.test index 82141a09b..3b14fc695 100644 --- a/mysql-test/columnstore/basic/t/mcs93_string_functions.test +++ b/mysql-test/columnstore/basic/t/mcs93_string_functions.test @@ -12,6 +12,7 @@ CREATE DATABASE mcs93_db; USE mcs93_db; CREATE TABLE t1(col1 VARCHAR(40), col2 TEXT)ENGINE=Columnstore; +INSERT INTO t1 VALUES(NULL, NULL); INSERT INTO t1 VALUES('', ''); INSERT INTO t1 VALUES(' aaa', repeat('z',10)); INSERT INTO t1 VALUES('klm, nopqrst', 'abcdefghijklmno, pqrsuvwxyz '); diff --git a/mysql-test/columnstore/basic/t/mcs95_variance_functions.test b/mysql-test/columnstore/basic/t/mcs95_variance_functions.test index 830933438..f180e48a3 100644 --- a/mysql-test/columnstore/basic/t/mcs95_variance_functions.test +++ b/mysql-test/columnstore/basic/t/mcs95_variance_functions.test @@ -12,7 +12,7 @@ CREATE DATABASE mcs95_db; USE mcs95_db; CREATE TABLE t1 (a CHAR(1), b INT)ENGINE=Columnstore; -INSERT INTO t1 VALUES ('', NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); +INSERT INTO t1 VALUES (NULL, NULL),('a', 12),('a', 13),('b', 14),('c', 15),('d', 16),('d', 17),('b', 18),('a', 19); SELECT a, VARIANCE(b) FROM t1 GROUP BY a ORDER BY a; SELECT a, VAR_POP(b) FROM t1 GROUP BY a ORDER BY a; diff --git a/mysql-test/columnstore/basic/t/mcs97_group_concat.test b/mysql-test/columnstore/basic/t/mcs97_group_concat.test index 49c09df3e..2c3697f93 100644 --- a/mysql-test/columnstore/basic/t/mcs97_group_concat.test +++ b/mysql-test/columnstore/basic/t/mcs97_group_concat.test @@ -12,7 +12,7 @@ CREATE DATABASE mcs97_db; USE mcs97_db; CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore; -INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); +INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(3, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee'); SELECT GROUP_CONCAT(a) FROM t1; SELECT GROUP_CONCAT(a SEPARATOR ';') FROM t1 ORDER BY a DESC; diff --git a/mysql-test/columnstore/basic/t/regr-fe-conv.test b/mysql-test/columnstore/basic/t/regr-fe-conv.test new file mode 100644 index 000000000..a0d75ccf7 --- /dev/null +++ b/mysql-test/columnstore/basic/t/regr-fe-conv.test @@ -0,0 +1,32 @@ +--source ../include/have_columnstore.inc +--disable_warnings +DROP DATABASE IF EXISTS regr_fe_conv; + +--enable_warnings +CREATE DATABASE regr_fe_conv; + +USE regr_fe_conv; + +--disable_query_log +--source ../include/regression_create_dtypes.inc +--enable_query_log + +select conv(dt, -10, -8) from dtypes where conv(dt, -10, -8) > 3731; +select dtm from dtypes where conv(dtm, -10, -8) > 3731 order by dtm, conv(dtm, 10, 8); +select conv(db, 10, 16), conv(ti, 8,16), conv(si, 16, 8), conv(i, 4, 8), conv(bi, 10, 8) from dtypes; +select conv (c1, 5, 10), conv(substr(c8,2,4), 8, 10), conv(concat(vc1, vc2), 10,8) from dtypes; +select substr(vc255,2,3), conv(substr(vc255,2,3),16,10) from dtypes where id < 50 ; +#select conv(max(d182), 10, 20) from dtypes; +#select conv(bi, 10, 24) from dtypes where id < 20; +select conv (c1, 5, 2), conv(substr(c8,2,4), 8, 2), conv(concat(vc1, vc2), 10, 2) from dtypes; + +--disable_warnings +drop table if exists bug3509; +--enable_warnings + +create table bug3509 (cookie varchar(32), d_datekey date) engine=columnstore; +insert into bug3509 values ('f48d2dce907ce3c54a9c12855754c0b5', 19980404); +select conv(substr(cookie,1,12),16,10), conv(substr(cookie,1,16),16,10), conv(substr(cookie,1,16),18,10) from bug3509; +drop table bug3509; + +DROP DATABASE regr_fe_conv; diff --git a/mysql-test/columnstore/basic/t/regr-fe-substr.test b/mysql-test/columnstore/basic/t/regr-fe-substr.test new file mode 100644 index 000000000..d3a865eb5 --- /dev/null +++ b/mysql-test/columnstore/basic/t/regr-fe-substr.test @@ -0,0 +1,226 @@ +--source ../include/have_columnstore.inc +--disable_warnings +DROP DATABASE IF EXISTS regr_fe_substr; + +--enable_warnings +CREATE DATABASE regr_fe_substr; + +USE regr_fe_substr; +--disable_query_log +--source ../include/regression_create_datatypetestm.inc +--enable_query_log + +select cidx, CCHAR1, SUBSTR(CCHAR1,1) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1,5) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1,7) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1,8) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1,9) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1,5,2) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1,9,3) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR1, SUBSTR(CCHAR1 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2,1) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2,5) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2,7) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2,8) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2,9) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2,5,2) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2,9,3) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR2, SUBSTR(CCHAR2 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3,1) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3,5) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3,7) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3,8) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3,9) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3,5,2) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3,9,3) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR3, SUBSTR(CCHAR3 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4,1) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4,5) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4,7) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4,8) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4,9) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4,5,2) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4,9,3) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR4, SUBSTR(CCHAR4 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5,1) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5,5) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5,7) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5,8) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5,9) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5,5,2) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5,9,3) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR5, SUBSTR(CCHAR5 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6,1) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6,5) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6,7) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6,8) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6,9) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6,5,2) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6,9,3) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR6, SUBSTR(CCHAR6 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7,1) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7,5) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7,7) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7,8) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7,9) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7,5,2) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7,9,3) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR7, SUBSTR(CCHAR7 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8,1) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8,5) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8,7) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8,8) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8,9) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8,5,2) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8,9,3) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR8, SUBSTR(CCHAR8 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9,1) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9,5) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9,7) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9,8) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9,9) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 5) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 9) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9,5,2) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9,9,3) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR9, SUBSTR(CCHAR9 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255,1) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255,5) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255,7) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255,8) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255,9) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 5) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 9) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255,5,2) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255,9,3) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR255, SUBSTR(CCHAR255 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1,1) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1,5) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1,7) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1,8) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1,9) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1,5,2) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1,9,3) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR1, SUBSTR(CVCHAR1 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2,1) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2,5) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2,7) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2,8) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2,9) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2,5,2) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2,9,3) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR2, SUBSTR(CVCHAR2 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3,1) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3,5) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3,7) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3,8) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3,9) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3,5,2) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3,9,3) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR3, SUBSTR(CVCHAR3 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4,1) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4,5) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4,7) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4,8) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4,9) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4,5,2) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4,9,3) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR4, SUBSTR(CVCHAR4 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5,1) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5,5) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5,7) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5,8) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5,9) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5,5,2) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5,9,3) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR5, SUBSTR(CVCHAR5 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6,1) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6,5) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6,7) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6,8) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6,9) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6,5,2) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6,9,3) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR6, SUBSTR(CVCHAR6 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7,1) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7,5) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7,7) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7,8) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7,9) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7,5,2) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7,9,3) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR7, SUBSTR(CVCHAR7 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8,1) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8,5) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8,7) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8,8) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8,9) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8,5,2) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8,9,3) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR8, SUBSTR(CVCHAR8 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255,1) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255,5) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255,7) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255,8) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255,9) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 5) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 9) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255,5,2) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255,9,3) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR255, SUBSTR(CVCHAR255 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR1 from datatypetestm where SUBSTR(CCHAR1,1) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTR(CCHAR1,5) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTR(CCHAR1,7) <> CCHAR1; + +DROP DATABASE regr_fe_substr; \ No newline at end of file diff --git a/mysql-test/columnstore/basic/t/regr-fe-substring.test b/mysql-test/columnstore/basic/t/regr-fe-substring.test new file mode 100644 index 000000000..3884209fa --- /dev/null +++ b/mysql-test/columnstore/basic/t/regr-fe-substring.test @@ -0,0 +1,431 @@ +--source ../include/have_columnstore.inc +--disable_warnings +DROP DATABASE IF EXISTS regr_fe_substr; + +--enable_warnings +CREATE DATABASE regr_fe_substr; + +USE regr_fe_substr; +--disable_query_log +--source ../include/regression_create_datatypetestm.inc +--enable_query_log + +select cidx, CCHAR1, SUBSTRING(CCHAR1,1) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1,5) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1,7) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1,8) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1,9) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1,5,2) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1,9,3) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR1, SUBSTRING(CCHAR1 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2,1) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2,5) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2,7) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2,8) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2,9) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2,5,2) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2,9,3) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR2, SUBSTRING(CCHAR2 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3,1) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3,5) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3,7) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3,8) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3,9) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3,5,2) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3,9,3) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR3, SUBSTRING(CCHAR3 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4,1) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4,5) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4,7) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4,8) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4,9) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4,5,2) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4,9,3) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR4, SUBSTRING(CCHAR4 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5,1) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5,5) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5,7) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5,8) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5,9) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5,5,2) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5,9,3) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR5, SUBSTRING(CCHAR5 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6,1) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6,5) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6,7) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6,8) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6,9) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6,5,2) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6,9,3) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR6, SUBSTRING(CCHAR6 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7,1) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7,5) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7,7) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7,8) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7,9) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7,5,2) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7,9,3) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR7, SUBSTRING(CCHAR7 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8,1) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8,5) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8,7) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8,8) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8,9) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8,5,2) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8,9,3) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR8, SUBSTRING(CCHAR8 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9,1) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9,5) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9,7) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9,8) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9,9) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 5) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 9) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9,5,2) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9,9,3) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR9, SUBSTRING(CCHAR9 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255,1) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255,5) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255,7) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255,8) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255,9) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 5) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 9) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255,5,2) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255,9,3) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 5 FOR 2) from datatypetestm; +select cidx, CCHAR255, SUBSTRING(CCHAR255 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,1) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,7) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,8) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,5,2) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1,9,3) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR1, SUBSTRING(CVCHAR1 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,1) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,7) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,8) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,5,2) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2,9,3) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR2, SUBSTRING(CVCHAR2 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,1) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,7) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,8) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,5,2) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3,9,3) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR3, SUBSTRING(CVCHAR3 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,1) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,7) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,8) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,5,2) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4,9,3) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR4, SUBSTRING(CVCHAR4 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,1) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,5) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,7) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,8) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,5,2) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5,9,3) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR5, SUBSTRING(CVCHAR5 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,1) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,5) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,7) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,8) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,5,2) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6,9,3) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR6, SUBSTRING(CVCHAR6 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,1) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,5) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,7) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,8) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,5,2) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7,9,3) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR7, SUBSTRING(CVCHAR7 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,1) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,5) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,7) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,8) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,5,2) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8,9,3) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR8, SUBSTRING(CVCHAR8 FROM 9 FOR 3) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,1) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,5) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,7) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,8) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,9) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 5) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 9) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,5,2) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255,9,3) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 5 FOR 2) from datatypetestm; +select cidx, CVCHAR255, SUBSTRING(CVCHAR255 FROM 9 FOR 3) from datatypetestm; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,1) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,5) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,7) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,8) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,9) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 5) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 9) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,5,2) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1,9,3) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 5 FOR 2) <> CCHAR1; +select cidx, CCHAR1 from datatypetestm where SUBSTRING(CCHAR1 FROM 9 FOR 3) <> CCHAR1; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,1) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,5) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,7) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,8) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,9) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 5) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 9) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,5,2) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2,9,3) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 5 FOR 2) <> CCHAR2; +select cidx, CCHAR2 from datatypetestm where SUBSTRING(CCHAR2 FROM 9 FOR 3) <> CCHAR2; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,1) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,5) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,7) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,8) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,9) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 5) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 9) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,5,2) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3,9,3) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 5 FOR 2) <> CCHAR3; +select cidx, CCHAR3 from datatypetestm where SUBSTRING(CCHAR3 FROM 9 FOR 3) <> CCHAR3; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,1) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,5) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,7) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,8) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,9) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 5) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 9) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,5,2) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4,9,3) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 5 FOR 2) <> CCHAR4; +select cidx, CCHAR4 from datatypetestm where SUBSTRING(CCHAR4 FROM 9 FOR 3) <> CCHAR4; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,1) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,5) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,7) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,8) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,9) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 5) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 9) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,5,2) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5,9,3) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 5 FOR 2) <> CCHAR5; +select cidx, CCHAR5 from datatypetestm where SUBSTRING(CCHAR5 FROM 9 FOR 3) <> CCHAR5; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,1) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,5) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,7) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,8) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,9) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 5) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 9) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,5,2) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6,9,3) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 5 FOR 2) <> CCHAR6; +select cidx, CCHAR6 from datatypetestm where SUBSTRING(CCHAR6 FROM 9 FOR 3) <> CCHAR6; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,1) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,5) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,7) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,8) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,9) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 5) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 9) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,5,2) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7,9,3) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 5 FOR 2) <> CCHAR7; +select cidx, CCHAR7 from datatypetestm where SUBSTRING(CCHAR7 FROM 9 FOR 3) <> CCHAR7; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,1) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,5) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,7) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,8) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,9) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 5) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 9) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,5,2) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8,9,3) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 5 FOR 2) <> CCHAR8; +select cidx, CCHAR8 from datatypetestm where SUBSTRING(CCHAR8 FROM 9 FOR 3) <> CCHAR8; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,1) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,5) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,7) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,8) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,9) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 5) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 9) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,5,2) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9,9,3) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 5 FOR 2) <> CCHAR9; +select cidx, CCHAR9 from datatypetestm where SUBSTRING(CCHAR9 FROM 9 FOR 3) <> CCHAR9; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,1) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,5) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,7) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,8) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,9) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 5) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 9) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,5,2) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255,9,3) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 5 FOR 2) <> CCHAR255; +select cidx, CCHAR255 from datatypetestm where SUBSTRING(CCHAR255 FROM 9 FOR 3) <> CCHAR255; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,1) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,5) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,7) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,8) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,9) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 5) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 9) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,5,2) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1,9,3) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 5 FOR 2) <> CVCHAR1; +select cidx, CVCHAR1 from datatypetestm where SUBSTRING(CVCHAR1 FROM 9 FOR 3) <> CVCHAR1; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,1) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,5) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,7) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,8) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,9) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 5) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 9) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,5,2) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2,9,3) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 5 FOR 2) <> CVCHAR2; +select cidx, CVCHAR2 from datatypetestm where SUBSTRING(CVCHAR2 FROM 9 FOR 3) <> CVCHAR2; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,1) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,5) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,7) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,8) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,9) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 5) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 9) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,5,2) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3,9,3) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 5 FOR 2) <> CVCHAR3; +select cidx, CVCHAR3 from datatypetestm where SUBSTRING(CVCHAR3 FROM 9 FOR 3) <> CVCHAR3; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,1) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,5) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,7) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,8) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,9) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 5) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 9) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,5,2) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4,9,3) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 5 FOR 2) <> CVCHAR4; +select cidx, CVCHAR4 from datatypetestm where SUBSTRING(CVCHAR4 FROM 9 FOR 3) <> CVCHAR4; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,1) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,5) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,7) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,8) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,9) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 5) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 9) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,5,2) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5,9,3) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 5 FOR 2) <> CVCHAR5; +select cidx, CVCHAR5 from datatypetestm where SUBSTRING(CVCHAR5 FROM 9 FOR 3) <> CVCHAR5; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,1) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,5) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,7) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,8) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,9) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 5) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 9) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,5,2) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6,9,3) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 5 FOR 2) <> CVCHAR6; +select cidx, CVCHAR6 from datatypetestm where SUBSTRING(CVCHAR6 FROM 9 FOR 3) <> CVCHAR6; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,1) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,5) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,7) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,8) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,9) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 5) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 9) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,5,2) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7,9,3) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 5 FOR 2) <> CVCHAR7; +select cidx, CVCHAR7 from datatypetestm where SUBSTRING(CVCHAR7 FROM 9 FOR 3) <> CVCHAR7; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,1) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,5) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,7) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,8) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,9) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 5) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 9) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,5,2) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8,9,3) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 5 FOR 2) <> CVCHAR8; +select cidx, CVCHAR8 from datatypetestm where SUBSTRING(CVCHAR8 FROM 9 FOR 3) <> CVCHAR8; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,1) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,5) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,7) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,8) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,9) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 5) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 9) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,5,2) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255,9,3) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 5 FOR 2) <> CVCHAR255; +select cidx, CVCHAR255 from datatypetestm where SUBSTRING(CVCHAR255 FROM 9 FOR 3) <> CVCHAR255; +DROP DATABASE regr_fe_substr; \ No newline at end of file diff --git a/mysql-test/columnstore/basic/t/type_string.test b/mysql-test/columnstore/basic/t/type_string.test index baf37e627..d6a537c56 100644 --- a/mysql-test/columnstore/basic/t/type_string.test +++ b/mysql-test/columnstore/basic/t/type_string.test @@ -4,12 +4,14 @@ DROP DATABASE IF EXISTS mcs_type_string; --enable_warnings CREATE DATABASE mcs_type_string; +USE mcs_type_string; --echo # --echo # MCOL-4823 WHERE char_col::type* = nullptr> inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, uint8_t rf, - const ColRequestHeaderDataType& typeHolder, bool isVal2Null) + const ColRequestHeaderDataType& typeHolder, T1 nullValue) { float dVal1 = *((float*)&columnValue); float dVal2 = *((float*)&filterValue); @@ -295,7 +295,7 @@ template ::type* = nullptr> inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, uint8_t rf, - const ColRequestHeaderDataType& typeHolder, bool isVal2Null) + const ColRequestHeaderDataType& typeHolder, T1 nullValue) { double dVal1 = *((double*)&columnValue); double dVal2 = *((double*)&filterValue); @@ -305,12 +305,12 @@ inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, u template ::type* = nullptr> inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, uint8_t rf, - const ColRequestHeaderDataType& typeHolder, bool isVal2Null) + const ColRequestHeaderDataType& typeHolder, T1 nullValue) { if (cop & COMPARE_LIKE) // LIKE and NOT LIKE { - utils::ConstString subject{reinterpret_cast(&columnValue), COL_WIDTH}; - utils::ConstString pattern{reinterpret_cast(&filterValue), COL_WIDTH}; + utils::ConstString subject((&columnValue), nullValue, COL_WIDTH); + utils::ConstString pattern((&filterValue), (T2)nullValue, COL_WIDTH); return typeHolder.like(cop & COMPARE_NOT, subject.rtrimZero(), pattern.rtrimZero()); } @@ -319,13 +319,26 @@ inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, u // A temporary hack for xxx_nopad_bin collations // TODO: MCOL-4534 Improve comparison performance in 8bit nopad_bin collations if ((typeHolder.getCharset().state & (MY_CS_BINSORT | MY_CS_NOPAD)) == (MY_CS_BINSORT | MY_CS_NOPAD)) + { return colCompare_(order_swap(columnValue), order_swap(filterValue), cop); - utils::ConstString s1{reinterpret_cast(&columnValue), COL_WIDTH}; - utils::ConstString s2{reinterpret_cast(&filterValue), COL_WIDTH}; - return colCompareStr(typeHolder, cop, s1.rtrimZero(), s2.rtrimZero()); + } + utils::ConstString s1((&columnValue), nullValue, COL_WIDTH); + utils::ConstString s2((&filterValue), (T2)nullValue, COL_WIDTH); + s1.rtrimZero(); + s2.rtrimZero(); + return colCompareStr(typeHolder, cop, s1, s2); } else + { return colStrCompare_(order_swap(columnValue), order_swap(filterValue), cop, rf); + } +} + +// Check whether val is NULL (or alternative NULL bit pattern for 64-bit string types) +template +inline bool isNullValue(const T val, const T NULL_VALUE) +{ + return val == NULL_VALUE; } // This template where IS_NULL = true is used only comparing filter predicate @@ -333,8 +346,10 @@ inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, u template ::type* = nullptr> inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, uint8_t rf, - const ColRequestHeaderDataType& typeHolder, bool isVal2Null) + const ColRequestHeaderDataType& typeHolder, T1 nullValue) { + const bool isVal2Null = isNullValue(filterValue, (T2)nullValue); + if (IS_NULL == isVal2Null || (isVal2Null && cop == COMPARE_NE)) { if (KIND_UNSIGNED == KIND) @@ -354,15 +369,16 @@ inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, u return colCompare_(tempVal1, filterValue, cop, rf); } } - else - return false; + return false; } template ::type* = nullptr> inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, uint8_t rf, - const ColRequestHeaderDataType& typeHolder, bool isVal2Null) + const ColRequestHeaderDataType& typeHolder, T1 nullValue) { + const bool isVal2Null = isNullValue(filterValue, (T2)nullValue); + if (IS_NULL == isVal2Null || (isVal2Null && cop == COMPARE_NE)) { // Ugly hack to convert all to the biggest type b/w T1 and T2. @@ -372,15 +388,16 @@ inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, u UT2 ufilterValue = filterValue; return colCompare_(ucolumnValue, ufilterValue, cop, rf); } - else - return false; + return false; } template ::type* = nullptr> inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, uint8_t rf, - const ColRequestHeaderDataType& typeHolder, bool isVal2Null) + const ColRequestHeaderDataType& typeHolder, T1 nullValue) { + const bool isVal2Null = isNullValue(filterValue, (T2)nullValue); + if (IS_NULL == isVal2Null || (isVal2Null && cop == COMPARE_NE)) { // Ugly hack to convert all to the biggest type b/w T1 and T2. @@ -388,22 +405,21 @@ inline bool colCompareDispatcherT(T1 columnValue, T2 filterValue, uint8_t cop, u T2 tempVal1 = columnValue; return colCompare_(tempVal1, filterValue, cop, rf); } - else - return false; + return false; } // Compare two column values using given comparison operation, // taking into account all rules about NULL values, string trimming and so on template inline bool colCompare(T1 columnValue, T2 filterValue, uint8_t cop, uint8_t rf, - const ColRequestHeaderDataType& typeHolder, bool isVal2Null = false) + const ColRequestHeaderDataType& typeHolder, T1 nullValue) { // cout << "comparing " << hex << columnValue << " to " << filterValue << endl; if (COMPARE_NIL == cop) return false; return colCompareDispatcherT(columnValue, filterValue, cop, rf, - typeHolder, isVal2Null); + typeHolder, nullValue); } /***************************************************************************** @@ -505,13 +521,6 @@ T getEmptyValue(uint8_t type) } } -// Check whether val is NULL (or alternative NULL bit pattern for 64-bit string types) -template -inline bool isNullValue(const T val, const T NULL_VALUE) -{ - return val == NULL_VALUE; -} - // // FILTER A COLUMN VALUE // @@ -582,7 +591,7 @@ inline bool matchingColValue( // This can be future optimized checking if a filterValue is NULL or not bool cmp = colCompare(curValue, filterValue, filterCOPs[0], filterRFs[0], typeHolder, - isNullValue(filterValue, NULL_VALUE)); + NULL_VALUE); return cmp; } @@ -596,7 +605,7 @@ inline bool matchingColValue( // loop. bool cmp = colCompare(curValue, filterValue, filterCOPs[argIndex], filterRFs[argIndex], typeHolder, - isNullValue(filterValue, NULL_VALUE)); + NULL_VALUE); // Short-circuit the filter evaluation - true || ... == true if (cmp == true) @@ -617,7 +626,7 @@ inline bool matchingColValue( // loop. bool cmp = colCompare(curValue, filterValue, filterCOPs[argIndex], filterRFs[argIndex], typeHolder, - isNullValue(filterValue, NULL_VALUE)); + NULL_VALUE); // Short-circuit the filter evaluation - false && ... = false if (cmp == false) @@ -640,7 +649,7 @@ inline bool matchingColValue( // loop. bool cmp = colCompare(curValue, filterValue, filterCOPs[argIndex], filterRFs[argIndex], typeHolder, - isNullValue(filterValue, NULL_VALUE)); + NULL_VALUE); result ^= cmp; } @@ -685,10 +694,11 @@ template (Min, curValue, COMPARE_GT, false, in->colType)) + const T DUMMY_NULL_VALUE = ~curValue; // it SHALL NOT be equal to curValue, other constraints do not matter. + if (colCompare(Min, curValue, COMPARE_GT, false, in->colType, DUMMY_NULL_VALUE)) Min = curValue; - if (colCompare(Max, curValue, COMPARE_LT, false, in->colType)) + if (colCompare(Max, curValue, COMPARE_LT, false, in->colType, DUMMY_NULL_VALUE)) Max = curValue; } @@ -1129,14 +1139,18 @@ void scalarFiltering_( if (!(nextColValue(curValue, isEmpty, i, rid, srcArray, srcSize, ridArray, ridSize, outputType, emptyValue, blockAux))) + { break; + } } else { if (!(nextColValue(curValue, isEmpty, i, rid, srcArray, srcSize, ridArray, ridSize, outputType, emptyValue, blockAux))) + { break; + } } if (isEmpty) @@ -1767,7 +1781,6 @@ void filterColumnData(NewColRequestHeader* in, ColResultHeader* out, uint16_t* r // applies scalar filtering. // Syscat queries mustn't follow vectorized processing path b/c PP must return // all values w/o any filter(even empty values filter) applied. - #if defined(__x86_64__) || defined(__aarch64__) // Don't use vectorized filtering for text based data types which collation translation // can deliver more then 1 byte for a single input byte of an encoded string. diff --git a/primitives/linux-port/dictionary.cpp b/primitives/linux-port/dictionary.cpp index 2e8c2ad67..337633f7c 100644 --- a/primitives/linux-port/dictionary.cpp +++ b/primitives/linux-port/dictionary.cpp @@ -36,9 +36,6 @@ using namespace std; using namespace logging; -const char* nullString = " "; // this is not NULL to preempt segfaults. -const int nullStringLen = 0; - namespace { const char* signatureNotFound = joblist::CPSTRNOTFOUND.c_str(); @@ -50,6 +47,7 @@ inline bool PrimitiveProcessor::compare(const datatypes::Charset& cs, uint8_t CO size_t length1, const char* str2, size_t length2) throw() { int error = 0; + utils::NullString s1 (str1, length1), s2 (str2, length2); bool rc = primitives::StringComparator(cs).op(&error, COP, ConstString(str1, length1), ConstString(str2, length2)); if (error) @@ -75,7 +73,7 @@ Notes: void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenByScanResultHeader* ret, unsigned outSize, boost::shared_ptr eqFilter) { - const DataValue* args; + const NonNullDataValue* args; const uint8_t* niceBlock; // block cast to a byte-indexed type const uint8_t* niceInput; // h cast to a byte-indexed type const uint16_t* offsets; @@ -122,7 +120,7 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenB siglen = offsets[offsetIndex - 1] - offsets[offsetIndex]; sig = reinterpret_cast(&niceBlock[offsets[offsetIndex]]); argsOffset = sizeof(TokenByScanRequestHeader); - args = reinterpret_cast(&niceInput[argsOffset]); + args = reinterpret_cast(&niceInput[argsOffset]); if (eqFilter) { @@ -138,7 +136,6 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenB goto no_store; } - cmpResult = compare(cs, h->COP1, sig, siglen, args->data, args->len); switch (h->NVALS) @@ -159,8 +156,8 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenB if (cmpResult && h->BOP == BOP_OR) goto store; - argsOffset += sizeof(uint16_t) + args->len; - args = (DataValue*)&niceInput[argsOffset]; + argsOffset += sizeof(*args) + args->len; + args = (NonNullDataValue*)&niceInput[argsOffset]; cmpResult = compare(cs, h->COP2, sig, siglen, args->data, args->len); @@ -183,8 +180,8 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenB if (cmpResult && h->BOP == BOP_OR) goto store; - argsOffset += sizeof(uint16_t) + args->len; - args = (DataValue*)&niceInput[argsOffset]; + argsOffset += sizeof(*args) + args->len; + args = (NonNullDataValue*)&niceInput[argsOffset]; } if (i == h->NVALS && cmpResult) @@ -195,7 +192,6 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenB } store: - if (h->OutputType == OT_DATAVALUE) { if ((ret->NBYTES + sizeof(DataValue) + siglen) > outSize) @@ -211,6 +207,7 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenB throw logging::DictionaryBufferOverflow(); } + retDataValues->isnull = false; //retDataValues->data == nullptr; XXX: SZ: verify. retDataValues->len = siglen; memcpy(retDataValues->data, sig, siglen); rdvOffset += sizeof(DataValue) + siglen; @@ -260,6 +257,7 @@ void PrimitiveProcessor::p_TokenByScan(const TokenByScanRequestHeader* h, TokenB throw logging::DictionaryBufferOverflow(); } + retDataValues->isnull = false; retDataValues->len = args->len; memcpy(retDataValues->data, args->data, args->len); rdvOffset += sizeof(DataValue) + args->len; @@ -326,8 +324,8 @@ void PrimitiveProcessor::nextSig(int NVALS, const PrimToken* tokens, p_DataValue goto again; } - ret->len = nullStringLen; - ret->data = (const uint8_t*)nullString; + ret->len = 0; + ret->data = (const uint8_t*)nullptr; } else { @@ -358,6 +356,7 @@ void PrimitiveProcessor::nextSig(int NVALS, const PrimToken* tokens, p_DataValue } /* XXXPAT: Need to check for the NULL token here */ + ret->len = tokens[dict_OffsetIndex].len; ret->data = &niceBlock[tokens[dict_OffsetIndex].offset]; @@ -562,6 +561,7 @@ void PrimitiveProcessor::p_Dictionary(const DictInput* in, vector* out, } outValue = reinterpret_cast(&(*out)[header.NBYTES]); + outValue->isnull = false; outValue->len = filter->len; memcpy(outValue->data, filter->data, filter->len); header.NBYTES += sizeof(DataValue) + filter->len; @@ -592,7 +592,10 @@ void PrimitiveProcessor::p_Dictionary(const DictInput* in, vector* out, out->resize(out->size() * SCALE_FACTOR); } + idbassert(sigptr.data != nullptr || !sigptr.len); + outValue = reinterpret_cast(&(*out)[header.NBYTES]); + outValue->isnull = sigptr.data == nullptr; outValue->len = sigptr.len; memcpy(outValue->data, sigptr.data, sigptr.len); header.NBYTES += sizeof(DataValue) + sigptr.len; @@ -615,8 +618,10 @@ void PrimitiveProcessor::p_Dictionary(const DictInput* in, vector* out, DataValue* tmpDV = reinterpret_cast(&(*out)[header.NBYTES + sizeof(uint16_t)]); *tmp16 = aggCount; + tmpDV->isnull = 0; tmpDV->len = min.len; memcpy(tmpDV->data, min.data, min.len); + idbassert(0); /// this is just plain wrong. header.NBYTES += 2 * sizeof(uint16_t) + min.len; tmpDV = reinterpret_cast(&(*out)[header.NBYTES]); diff --git a/primitives/primproc/batchprimitiveprocessor.cpp b/primitives/primproc/batchprimitiveprocessor.cpp index 659792c57..f9255d274 100644 --- a/primitives/primproc/batchprimitiveprocessor.cpp +++ b/primitives/primproc/batchprimitiveprocessor.cpp @@ -928,7 +928,7 @@ void BatchPrimitiveProcessor::initProcessor() absRids.reset(new uint64_t[LOGICAL_BLOCK_RIDS]); if (needStrValues) - strValues.reset(new string[LOGICAL_BLOCK_RIDS]); + strValues.reset(new utils::NullString[LOGICAL_BLOCK_RIDS]); outMsgSize = defaultBufferSize; outputMsg.reset(reinterpret_cast(aligned_alloc(utils::MAXCOLUMNWIDTH, outMsgSize))); @@ -1080,7 +1080,7 @@ void BatchPrimitiveProcessor::initProcessor() fFiltCmdBinaryValues[i].reset(new int128_t[LOGICAL_BLOCK_RIDS]); if (filtOnString) - fFiltStrValues[i].reset(new string[LOGICAL_BLOCK_RIDS]); + fFiltStrValues[i].reset(new utils::NullString[LOGICAL_BLOCK_RIDS]); } } diff --git a/primitives/primproc/batchprimitiveprocessor.h b/primitives/primproc/batchprimitiveprocessor.h index d7c6f1230..24ab96fbe 100644 --- a/primitives/primproc/batchprimitiveprocessor.h +++ b/primitives/primproc/batchprimitiveprocessor.h @@ -223,7 +223,7 @@ class BatchPrimitiveProcessor int64_t values[LOGICAL_BLOCK_RIDS]; int128_t wide128Values[LOGICAL_BLOCK_RIDS]; boost::scoped_array absRids; - boost::scoped_array strValues; + boost::scoped_array strValues; uint16_t origRidCount; uint16_t ridCount; bool needStrValues; @@ -295,7 +295,7 @@ class BatchPrimitiveProcessor boost::scoped_array fFiltCmdRids[2]; boost::scoped_array fFiltCmdValues[2]; boost::scoped_array fFiltCmdBinaryValues[2]; - boost::scoped_array fFiltStrValues[2]; + boost::scoped_array fFiltStrValues[2]; uint64_t fFiltRidCount[2]; // query density threshold for prefetch & async loading diff --git a/primitives/primproc/dictstep.cpp b/primitives/primproc/dictstep.cpp index b4152e2d6..db6d68be7 100644 --- a/primitives/primproc/dictstep.cpp +++ b/primitives/primproc/dictstep.cpp @@ -183,13 +183,19 @@ void DictStep::copyResultToTmpSpace(OrderedToken* ot) if (primMsg->OutputType & OT_DATAVALUE) { + NullString ns; + uint8_t isnull = *pos; + pos += 1; len = *((uint16_t*)pos); pos += 2; - ot[rid16].str = string((char*)pos, len); + if (!isnull) { + ns.assign(pos, len); + } pos += len; + ot[rid16].str = ns; - if (rid64 & 0x8000000000000000LL) - ot[rid16].str = joblist::CPNULLSTRMARK; + //if (rid64 & 0x8000000000000000LL) + // ot[rid16].str = joblist::CPNULLSTRMARK; } } } @@ -237,22 +243,23 @@ void DictStep::processResult() if (primMsg->OutputType & OT_DATAVALUE) { + uint8_t isnull = *pos; + pos += 1; + NullString ns; len = *((uint16_t*)pos); pos += 2; - (*strValues)[tmpResultCounter] = string((char*)pos, len); + if (!isnull) + { + ns.assign(pos, len); + } pos += len; + (*strValues)[tmpResultCounter] = ns; } // cout << " stored " << (*strValues)[tmpResultCounter] << endl; /* XXXPAT: disclaimer: this is how we do it in DictionaryStep; don't know if it's necessary or not yet */ - if ((bpp->absRids[tmpResultCounter] & 0x8000000000000000LL) != 0) - { - if (primMsg->OutputType & OT_DATAVALUE) - (*strValues)[tmpResultCounter] = joblist::CPNULLSTRMARK.c_str(); - - bpp->absRids[tmpResultCounter] &= 0x7FFFFFFFFFFFFFFFLL; - } + bpp->absRids[tmpResultCounter] &= 0x7FFFFFFFFFFFFFFFLL; } } @@ -262,12 +269,10 @@ void DictStep::projectResult(string* strings) uint8_t* pos; uint16_t len; DictOutput* header = (DictOutput*)&result[0]; - if (header->NVALS == 0) return; pos = &result[sizeof(DictOutput)]; - // cout << "projectResult() l: " << primMsg->LBID << " NVALS: " << header->NVALS << endl; for (i = 0; i < header->NVALS; i++) { @@ -306,9 +311,11 @@ void DictStep::projectResult(StringPtr* strings) // cout << "projectResult() l: " << primMsg->LBID << " NVALS: " << header->NVALS << endl; for (i = 0; i < header->NVALS; i++) { + uint8_t isnull = *pos; + pos += 1; len = *((uint16_t*)pos); pos += 2; - strings[tmpResultCounter++] = StringPtr(pos, len); + strings[tmpResultCounter++] = StringPtr(isnull ? nullptr : pos, len); // cout << "serialized length is " << len << " string is " << strings[tmpResultCounter-1] << " string // length = " << strings[tmpResultCounter-1].length() << endl; pos += len; @@ -583,6 +590,7 @@ void DictStep::_projectToRG(RowGroup& rg, uint32_t col) // If this is a multi-block blob, get all the blocks // We do string copy here, should maybe have a RowGroup // function to append strings or something? + // XXX: can NULLs be a valid value for multipart blob? if (((newRidList[i].token >> 46) < 0x3FFFF) && ((newRidList[i].token >> 46) > 0)) { StringPtr multi_part[1]; diff --git a/primitives/primproc/dictstep.h b/primitives/primproc/dictstep.h index 577abe6f3..5200b80c6 100644 --- a/primitives/primproc/dictstep.h +++ b/primitives/primproc/dictstep.h @@ -106,7 +106,7 @@ class DictStep : public Command uint64_t rid; uint64_t token; uint16_t pos; - std::string str; + NullString str; bool inResult; OrderedToken() : inResult(false) { @@ -147,7 +147,7 @@ class DictStep : public Command uint32_t traceFlags; // probably move this to Command uint8_t BOP; int64_t* values; - boost::scoped_array* strValues; + boost::scoped_array* strValues; int compressionType; messageqcpp::ByteStream filterString; uint32_t filterCount; diff --git a/primitives/primproc/filtercommand.cpp b/primitives/primproc/filtercommand.cpp index 88d8fbfa3..f5c0e6646 100644 --- a/primitives/primproc/filtercommand.cpp +++ b/primitives/primproc/filtercommand.cpp @@ -527,37 +527,33 @@ bool StrFilterCmd::compare_cc(uint64_t i, uint64_t j) bool StrFilterCmd::compare_ss(uint64_t i, uint64_t j) { - if (bpp->fFiltStrValues[0][i] == "" || bpp->fFiltStrValues[1][j] == "" || - bpp->fFiltStrValues[0][i] == joblist::CPNULLSTRMARK || - bpp->fFiltStrValues[1][j] == joblist::CPNULLSTRMARK) + if (bpp->fFiltStrValues[0][i].isNull() || bpp->fFiltStrValues[1][j].isNull()) return false; datatypes::Charset cs(leftColType.getCharset()); - utils::ConstString s0(utils::ConstString(bpp->fFiltStrValues[0][i])); - utils::ConstString s1(utils::ConstString(bpp->fFiltStrValues[1][j])); + utils::ConstString s0 = bpp->fFiltStrValues[0][i].toConstString(); + utils::ConstString s1 = bpp->fFiltStrValues[1][j].toConstString(); return compareString(cs, s0, s1, fBOP); } bool StrFilterCmd::compare_cs(uint64_t i, uint64_t j) { - if (execplan::isNull(bpp->fFiltCmdValues[0][i], leftColType) || bpp->fFiltStrValues[1][j] == "" || - bpp->fFiltStrValues[1][j] == joblist::CPNULLSTRMARK) + if (execplan::isNull(bpp->fFiltCmdValues[0][i], leftColType) || bpp->fFiltStrValues[1][j].isNull()) return false; datatypes::Charset cs(leftColType.getCharset()); datatypes::TCharShort s0(bpp->fFiltCmdValues[0][i]); - utils::ConstString s1(bpp->fFiltStrValues[1][j]); + utils::ConstString s1 = bpp->fFiltStrValues[1][j].toConstString(); return compareString(cs, s0.toConstString(leftColType.colWidth), s1, fBOP); } bool StrFilterCmd::compare_sc(uint64_t i, uint64_t j) { - if (bpp->fFiltStrValues[0][i] == "" || bpp->fFiltStrValues[0][i] == joblist::CPNULLSTRMARK || - execplan::isNull(bpp->fFiltCmdValues[1][j], rightColType)) + if (bpp->fFiltStrValues[0][i].isNull() || execplan::isNull(bpp->fFiltCmdValues[1][j], rightColType)) return false; datatypes::Charset cs(leftColType.getCharset()); - utils::ConstString s0(bpp->fFiltStrValues[0][i]); + utils::ConstString s0 = bpp->fFiltStrValues[0][i].toConstString(); datatypes::TCharShort s1(bpp->fFiltCmdValues[1][j]); return compareString(cs, s0, s1.toConstString(rightColType.colWidth), fBOP); } diff --git a/primitives/primproc/primitiveserver.cpp b/primitives/primproc/primitiveserver.cpp index 41730fc25..aad684c25 100644 --- a/primitives/primproc/primitiveserver.cpp +++ b/primitives/primproc/primitiveserver.cpp @@ -1567,21 +1567,18 @@ struct BPPHandler { uint32_t uniqueID, sessionID, stepID; BPPMap::iterator it; - - try - { - bs.advance(sizeof(ISMPacketHeader)); - bs >> sessionID; - bs >> stepID; - bs >> uniqueID; - } - catch (...) + if (bs.length() < sizeof(ISMPacketHeader) + sizeof(sessionID) + sizeof(stepID) + sizeof(uniqueID)) { // MCOL-857 We don't appear to have the full packet yet! - bs.rewind(); return -1; } + // throw here will be actual error, not a phony one. + bs.advance(sizeof(ISMPacketHeader)); + bs >> sessionID; + bs >> stepID; + bs >> uniqueID; + boost::unique_lock lk(getDJLock(uniqueID)); boost::mutex::scoped_lock scoped(bppLock); diff --git a/tests/rowgroup-tests.cpp b/tests/rowgroup-tests.cpp index 0c2a2e789..5d8cbbd51 100644 --- a/tests/rowgroup-tests.cpp +++ b/tests/rowgroup-tests.cpp @@ -90,6 +90,9 @@ class RowDecimalTest : public ::testing::Test rg.initRow(&r); rg.initRow(&rOutMappingCheck); + rg.initRow(&rOut); + rg.initRow(&sameRow); + rg.initRow(&nonequiRow); rowSize = r.getSize(); rg.getRow(0, &r); @@ -142,7 +145,7 @@ class RowDecimalTest : public ::testing::Test r.setIntField(s32ValueVector[i], 3); r.setIntField(s16ValueVector[i], 4); r.setIntField(s8ValueVector[i], 5); - r.nextRow(rowSize); + r.nextRow(); } rowCount = sValueVector.size(); @@ -177,7 +180,7 @@ TEST_F(RowDecimalTest, NonNullValueCheck) EXPECT_FALSE(r.isNullValue(3)); EXPECT_FALSE(r.isNullValue(4)); EXPECT_FALSE(r.isNullValue(5)); - r.nextRow(rowSize); + r.nextRow(); } } @@ -210,7 +213,7 @@ TEST_F(RowDecimalTest, GetBinaryFieldCheck) // EXPECT_EQ(s32ValueVector[i],r.getIntField(3)); // EXPECT_EQ(r.getIntField(4),s16ValueVector[i]); // EXPECT_EQ(r.getIntField(5),s8ValueVector[i]); - r.nextRow(rowSize); + r.nextRow(); } } @@ -233,7 +236,7 @@ TEST_F(RowDecimalTest, ToStringCheck) for (auto& el : exemplarVector) { EXPECT_EQ(el, r.toString()); - r.nextRow(rowSize); + r.nextRow(); } } @@ -270,7 +273,7 @@ TEST_F(RowDecimalTest, CopyBinaryFieldCheck) { rOut.setBinaryField_offset(&constVal, 16, offsets[0]); rOut.setBinaryField_offset(&constVal, 16, offsets[1]); - rOut.nextRow(rowSize); + rOut.nextRow(); } rgOut.initRow(&rOut); @@ -291,8 +294,8 @@ TEST_F(RowDecimalTest, CopyBinaryFieldCheck) col2Out = rOut.getTSInt128Field(1); EXPECT_EQ(col1In.getValue(), col1Out.getValue()); EXPECT_EQ(col2In.getValue(), col2Out.getValue()); - r.nextRow(rowSize); - rOut.nextRow(rowSize); + r.nextRow(); + rOut.nextRow(); } } @@ -309,11 +312,11 @@ TEST_F(RowDecimalTest, RowEqualsCheck) { EXPECT_FALSE(r.equals(nonequiRow)); } - r.nextRow(rowSize); - sameRow.nextRow(rowSize); + r.nextRow(); + sameRow.nextRow(); if (i < sValueVector.size() - 1) { - nonequiRow.nextRow(rowSize); + nonequiRow.nextRow(); } } } diff --git a/utils/common/collation.h b/utils/common/collation.h index 6e2cf58cc..82e8e30b0 100644 --- a/utils/common/collation.h +++ b/utils/common/collation.h @@ -166,7 +166,11 @@ class Charset } int strnncollsp(const utils::ConstString& str1, const utils::ConstString& str2) const { - return mCharset->strnncollsp(str1.str(), str1.length(), str2.str(), str2.length()); + // nullptr handling below should return values as if nulls are substituted with empty string. + // please note that ConstString has an assertion so that nullptr data has zero length. + const char* s1 = str1.str(); + const char* s2 = str2.str(); + return mCharset->strnncollsp(s1 ? s1 : "", str1.length(), s2 ? s2 : "" , str2.length()); } int strnncollsp(const char* str1, size_t length1, const char* str2, size_t length2) const { diff --git a/utils/common/conststring.h b/utils/common/conststring.h index d29ac76b0..6813cee0a 100644 --- a/utils/common/conststring.h +++ b/utils/common/conststring.h @@ -38,12 +38,31 @@ class ConstString explicit ConstString(const std::string& str) : mStr(str.data()), mLength(str.length()) { } + template + ConstString(const T* value, T nullValue, int colWidth) + { + if (*value == nullValue) + { + mStr = nullptr; + mLength = 0; + } + else + { + mStr = reinterpret_cast(value); + mLength = colWidth; + } + } const char* str() const { return mStr; } const char* end() const { + // end() should be computed for non-nullptr mStrs, otherwise it is undefined behavior. + if (!mStr) + { + return nullptr; + } return mStr + mLength; } size_t length() const @@ -61,6 +80,10 @@ class ConstString } bool eq(const ConstString& rhs) const { + if (!mStr) + { + return mStr == rhs.mStr; + } return mLength == rhs.mLength && !memcmp(mStr, rhs.mStr, mLength); } ConstString& rtrimZero() diff --git a/utils/common/nullstring.h b/utils/common/nullstring.h new file mode 100644 index 000000000..f9b663bd2 --- /dev/null +++ b/utils/common/nullstring.h @@ -0,0 +1,217 @@ +/* Copyright (C) 2022, 2023 MariaDB Corporation. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +// nullstring.h +// +// A class that can reprpesent string-with-NULL (special value not representable by a string value). + +#pragma once + +#include +#include +#include "exceptclasses.h" +#include "conststring.h" + +namespace utils +{ +// A class for striings that can hold NULL values - a value that is separate from all possible string. +class NullString +{ + protected: + std::shared_ptr mStrPtr; + + public: + NullString() : mStrPtr(nullptr) + { + } + NullString(const char* str, size_t length) + { + idbassert(str != nullptr || length == 0); + + if (str) { + mStrPtr.reset(new std::string((const char*)str, length)); + } + } + // XXX: this constructor is used to construct NullString from char*. Please be + // aware of that - std::string(nullptr) throws exception and you should check + // for nullptr. + explicit NullString(const std::string& str) : mStrPtr(new std::string(str)) + { + } + explicit NullString(const ConstString& str) : mStrPtr() + { + assign((const uint8_t*)str.str(), str.length()); + } + ConstString toConstString() const + { + if (isNull()) + { + return ConstString(nullptr, 0); + } + return ConstString(mStrPtr->c_str(), mStrPtr->length()); + } + const char* str() const + { + if (!mStrPtr) + { + return nullptr; + } + return mStrPtr->c_str(); + } + const char* end() const + { + if (!mStrPtr) + { + return nullptr; + } + return str() + length(); + } + size_t length() const + { + if (!mStrPtr) + { + return 0; + } + return mStrPtr->length(); + } + std::string toString() const + { + idbassert(mStrPtr); + return std::string(*mStrPtr); + } + // "unsafe" means we do not check for NULL. + // it should be used after we know there is data in NullString. + const std::string& unsafeStringRef() const + { + idbassert(mStrPtr); + return (*mStrPtr); + } + bool eq(char ch) const + { + return length() == 1 && str()[0] == ch; + } + // this is SQL-like NULL handling equality. NULL will not be equal to anything, including NULL. + bool eq(const NullString& rhs) const + { + if (!rhs.mStrPtr) + { + return false; + } + if (!mStrPtr) + { + return false; + } + return *mStrPtr == *(rhs.mStrPtr); + } + NullString& rtrimZero() + { + return *this; // TODO + } + // this can be used to safely get a string value, with default value for NULL substitution. + // it does not raise anything and provides some nonsensical default value for you that will be + // easy to find. + std::string safeString(const char* defaultValue = "<<>>") const + { + if (!mStrPtr) + { + return std::string(defaultValue); + } + return std::string(*mStrPtr); + } + bool isNull() const + { + return !mStrPtr; + } + void resize(size_t newSize, char pad) + { + if (mStrPtr) + { + mStrPtr->resize(newSize, pad); + } + } + NullString& dropString() + { + mStrPtr.reset(); + return (*this); + } + void assign(const uint8_t* p, size_t len) + { + if (!p) + { + mStrPtr.reset(); + return; + } + mStrPtr.reset(new std::string((const char*)p, len)); + } + void assign(const std::string& newVal) + { + mStrPtr.reset(new std::string(newVal)); + } + // XXX: here we implement what Row::equals expects. + // It is not SQL-NULL-handling compatible, please beware. + bool operator ==(const NullString& a) const + { + if (!mStrPtr && !a.mStrPtr) + { + return true; + } + if (!mStrPtr) + { + return false; + } + if (!a.mStrPtr) + { + return false; + } + // fall to std::string equality. + return (*mStrPtr) == (*a.mStrPtr); + } + bool operator ==(const std::string& a) const + { + if (!mStrPtr) + { + return false; + } + // fall to std::string equality. + return (*mStrPtr) == a; + } + bool operator <(const NullString& a) const + { + // order NULLs first. + if (isNull() > a.isNull()) + { + return true; + } + if (isNull() < a.isNull()) + { + return false; + } + if (!isNull()) + { + // fall to std::string equality. + return (*mStrPtr) < (*a.mStrPtr); + } + return false; // both are NULLs. + } + bool operator >(const NullString& a) const + { + return a < (*this); + } +}; + +} // namespace utils. + diff --git a/utils/dataconvert/dataconvert.cpp b/utils/dataconvert/dataconvert.cpp index fefca375f..cc009338b 100644 --- a/utils/dataconvert/dataconvert.cpp +++ b/utils/dataconvert/dataconvert.cpp @@ -2330,11 +2330,21 @@ int64_t DataConvert::dateToInt(const string& date) return stringToDate(date); } +int64_t DataConvert::dateToInt(const utils::NullString& date) +{ + return stringToDate(date); +} + int64_t DataConvert::datetimeToInt(const string& datetime) { return stringToDatetime(datetime); } +int64_t DataConvert::datetimeToInt(const utils::NullString& datetime) +{ + return stringToDatetime(datetime); +} + int64_t DataConvert::timestampToInt(const string& timestamp, long timeZone) { return stringToTimestamp(timestamp, timeZone); @@ -2357,6 +2367,15 @@ int64_t DataConvert::stringToDate(const string& data) else return -1; } +int64_t DataConvert::stringToDate(const utils::NullString& data) +{ + if (data.isNull()) + { + return -1; + } + + return stringToDate(data.unsafeStringRef()); +} int64_t DataConvert::stringToDatetime(const string& data, bool* date) { @@ -2368,6 +2387,20 @@ int64_t DataConvert::stringToDatetime(const string& data, bool* date) return -1; } +int64_t DataConvert::stringToDatetime(const utils::NullString& data, bool* date) +{ + if (data.isNull()) + { + if (date) + { + *date = false; + } + return -1; + } + + return stringToDatetime(data.unsafeStringRef(), date); +} + int64_t DataConvert::stringToTimestamp(const string& data, long timeZone) { TimeStamp aTimestamp; @@ -2378,6 +2411,15 @@ int64_t DataConvert::stringToTimestamp(const string& data, long timeZone) return -1; } +int64_t DataConvert::stringToTimestamp(const utils::NullString& data, long timeZone) +{ + if (data.isNull()) + { + return -1; + } + return stringToTimestamp(data.unsafeStringRef(), timeZone); +} + /* This is really painful and expensive b/c it seems the input is not normalized or sanitized. That should really be done on ingestion. */ int64_t DataConvert::intToDate(int64_t data) @@ -2770,6 +2812,11 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString) return getSInt64LE((const char*)&atime); } +int64_t DataConvert::stringToTime(const utils::NullString& data) +{ + return stringToTime(data.safeString("")); +} + int64_t DataConvert::stringToTime(const string& data) { // MySQL supported time value format 'D HHH:MM:SS.fraction' diff --git a/utils/dataconvert/dataconvert.h b/utils/dataconvert/dataconvert.h index bddcb6d2a..e755796d7 100644 --- a/utils/dataconvert/dataconvert.h +++ b/utils/dataconvert/dataconvert.h @@ -47,6 +47,8 @@ #include "bytestream.h" #include "errorids.h" +#include "nullstring.h" + // remove this block if the htonll is defined in library #include #if __BYTE_ORDER == __BIG_ENDIAN // 4312 @@ -1239,10 +1241,13 @@ class DataConvert // convert string to date EXPORT static int64_t stringToDate(const std::string& data); + EXPORT static int64_t stringToDate(const utils::NullString& data); // convert string to datetime EXPORT static int64_t stringToDatetime(const std::string& data, bool* isDate = NULL); + EXPORT static int64_t stringToDatetime(const utils::NullString& data, bool* isDate = NULL); // convert string to timestamp EXPORT static int64_t stringToTimestamp(const std::string& data, long timeZone); + EXPORT static int64_t stringToTimestamp(const utils::NullString& data, long timeZone); // convert integer to date EXPORT static int64_t intToDate(int64_t data); // convert integer to datetime @@ -1251,11 +1256,14 @@ class DataConvert EXPORT static int64_t intToTime(int64_t data, bool fromString = false); // convert string to date. alias to stringToDate EXPORT static int64_t dateToInt(const std::string& date); + EXPORT static int64_t dateToInt(const utils::NullString& date); // convert string to datetime. alias to datetimeToInt EXPORT static int64_t datetimeToInt(const std::string& datetime); + EXPORT static int64_t datetimeToInt(const utils::NullString& datetime); EXPORT static int64_t timestampToInt(const std::string& timestamp, long timeZone); EXPORT static int64_t timeToInt(const std::string& time); EXPORT static int64_t stringToTime(const std::string& data); + EXPORT static int64_t stringToTime(const utils::NullString& data); // bug4388, union type conversion EXPORT static void joinColTypeForUnion(datatypes::SystemCatalog::TypeHolderStd& unionedType, const datatypes::SystemCatalog::TypeHolderStd& type, diff --git a/utils/funcexp/func_add_time.cpp b/utils/funcexp/func_add_time.cpp index 82c173edc..f69696537 100644 --- a/utils/funcexp/func_add_time.cpp +++ b/utils/funcexp/func_add_time.cpp @@ -87,7 +87,13 @@ int64_t Func_add_time::getDatetimeIntVal(rowgroup::Row& row, FunctionParm& parm, return -1; } - const string& val2 = parm[1]->data()->getStrVal(row, isNull); + const auto& val2 = parm[1]->data()->getStrVal(row, isNull); + if (val2.isNull()) + { + isNull = true; + return -1; + } + int sign = parm[2]->data()->getIntVal(row, isNull); DateTime dt1; dt1.year = (val1 >> 48) & 0xffff; @@ -98,7 +104,7 @@ int64_t Func_add_time::getDatetimeIntVal(rowgroup::Row& row, FunctionParm& parm, dt1.second = (val1 >> 20) & 0x3f; dt1.msecond = val1 & 0xfffff; - int64_t time = DataConvert::stringToTime(val2); + int64_t time = DataConvert::stringToTime(val2.unsafeStringRef()); if (time == -1) { @@ -165,7 +171,12 @@ int64_t Func_add_time::getTimestampIntVal(rowgroup::Row& row, FunctionParm& parm return -1; } - const string& val2 = parm[1]->data()->getStrVal(row, isNull); + const auto& val2 = parm[1]->data()->getStrVal(row, isNull); + if (val2.isNull()) + { + isNull = true; + return -1; + } int sign = parm[2]->data()->getIntVal(row, isNull); DateTime dt1; TimeStamp timestamp(val1); @@ -180,7 +191,7 @@ int64_t Func_add_time::getTimestampIntVal(rowgroup::Row& row, FunctionParm& parm dt1.second = m_time.second; dt1.msecond = timestamp.msecond; - int64_t time = DataConvert::stringToTime(val2); + int64_t time = DataConvert::stringToTime(val2.unsafeStringRef()); if (time == -1) { @@ -240,7 +251,12 @@ int64_t Func_add_time::getTimeIntVal(rowgroup::Row& row, FunctionParm& parm, boo if (isNull) return -1; - const string& val2 = parm[1]->data()->getStrVal(row, isNull); + const auto& val2 = parm[1]->data()->getStrVal(row, isNull); + if (val2.isNull()) + { + isNull = true; + return -1; + } int sign = parm[2]->data()->getIntVal(row, isNull); Time dt1; dt1.day = 0; @@ -250,7 +266,7 @@ int64_t Func_add_time::getTimeIntVal(rowgroup::Row& row, FunctionParm& parm, boo dt1.second = (val1 >> 24) & 0xff; dt1.msecond = val1 & 0xffffff; - int64_t time = DataConvert::stringToTime(val2); + int64_t time = DataConvert::stringToTime(val2.unsafeStringRef()); if (time == -1) { diff --git a/utils/funcexp/func_ascii.cpp b/utils/funcexp/func_ascii.cpp index 5cf8653d2..cc1f1d165 100644 --- a/utils/funcexp/func_ascii.cpp +++ b/utils/funcexp/func_ascii.cpp @@ -47,12 +47,12 @@ CalpontSystemCatalog::ColType Func_ascii::operationType(FunctionParm& fp, int64_t Func_ascii::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType& op_ct) { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); - if (str.empty()) + if (str.isNull() || str.length() < 1) return 0; - return (unsigned char)str[0]; + return (unsigned char)(str.str())[0]; } } // namespace funcexp diff --git a/utils/funcexp/func_between.cpp b/utils/funcexp/func_between.cpp index 657123635..b0a144a40 100644 --- a/utils/funcexp/func_between.cpp +++ b/utils/funcexp/func_between.cpp @@ -242,21 +242,22 @@ inline bool getBool(rowgroup::Row& row, funcexp::FunctionParm& pm, bool& isNull, case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& val = pm[0]->data()->getStrVal(row, isNull); + const string& val = pm[0]->data()->getStrVal(row, isNull).safeString(""); CHARSET_INFO& cs = datatypes::Charset(ct.charsetNumber).getCharset(); if (notBetween) { - if (!strGE(cs, val, pm[1]->data()->getStrVal(row, isNull)) && !isNull) + if (!strGE(cs, val, pm[1]->data()->getStrVal(row, isNull).safeString("")) && !isNull) return true; isNull = false; - return (!strLE(cs, val, pm[2]->data()->getStrVal(row, isNull)) && !isNull); + return (!strLE(cs, val, pm[2]->data()->getStrVal(row, isNull).safeString("")) && !isNull); } - return !isNull && strGE(cs, val, pm[1]->data()->getStrVal(row, isNull)) && - strLE(cs, val, pm[2]->data()->getStrVal(row, isNull)); + return !isNull && strGE(cs, val, pm[1]->data()->getStrVal(row, isNull).safeString("")) && + strLE(cs, val, pm[2]->data()->getStrVal(row, isNull).safeString("")); } + break; // XXX: gcc falsely complains here. default: { @@ -312,7 +313,7 @@ CalpontSystemCatalog::ColType Func_between::operationType(FunctionParm& fp, if (cc) { Result result = cc->result(); - result.intVal = dataconvert::DataConvert::datetimeToInt(result.strVal); + result.intVal = dataconvert::DataConvert::datetimeToInt(result.strVal.safeString("")); cc->result(result); } } @@ -328,7 +329,7 @@ CalpontSystemCatalog::ColType Func_between::operationType(FunctionParm& fp, if (cc) { Result result = cc->result(); - result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal, resultType.getTimeZone()); + result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal.safeString(""), resultType.getTimeZone()); cc->result(result); } } @@ -344,7 +345,7 @@ CalpontSystemCatalog::ColType Func_between::operationType(FunctionParm& fp, if (cc) { Result result = cc->result(); - result.intVal = dataconvert::DataConvert::timeToInt(result.strVal); + result.intVal = dataconvert::DataConvert::timeToInt(result.strVal.safeString("")); cc->result(result); } } diff --git a/utils/funcexp/func_bitwise.cpp b/utils/funcexp/func_bitwise.cpp index 998696ae0..c0945bdff 100644 --- a/utils/funcexp/func_bitwise.cpp +++ b/utils/funcexp/func_bitwise.cpp @@ -140,7 +140,7 @@ datatypes::TUInt64Null GenericToBitOperand(Row& row, const execplan::SPTP& parm, case execplan::CalpontSystemCatalog::TEXT: { bool tmpIsNull = false; - const string& str = parm->data()->getStrVal(row, tmpIsNull); + const auto& str = parm->data()->getStrVal(row, tmpIsNull).safeString(""); if (tmpIsNull) return datatypes::TUInt64Null(); diff --git a/utils/funcexp/func_case.cpp b/utils/funcexp/func_case.cpp index fba7691e0..6df058609 100644 --- a/utils/funcexp/func_case.cpp +++ b/utils/funcexp/func_case.cpp @@ -175,7 +175,7 @@ inline uint64_t simple_case_cmp(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::TEXT: case execplan::CalpontSystemCatalog::VARCHAR: { - const string& ev = parm[n]->data()->getStrVal(row, isNull); + const string& ev = parm[n]->data()->getStrVal(row, isNull).safeString(""); if (isNull) break; CHARSET_INFO* cs = parm[n]->data()->resultType().getCharset(); @@ -183,7 +183,7 @@ inline uint64_t simple_case_cmp(Row& row, FunctionParm& parm, bool& isNull, for (i = 1; i <= whereCount; i++) { // BUG 5362 - const string& p1 = parm[i]->data()->getStrVal(row, isNull); + const string& p1 = parm[i]->data()->getStrVal(row, isNull).safeString(""); if (isNull) break; if (cs->strnncoll(ev.c_str(), ev.length(), p1.c_str(), p1.length()) == 0) @@ -503,7 +503,7 @@ string Func_simple_case::getStrVal(Row& row, FunctionParm& parm, bool& isNull, if (isNull) return string(""); - return parm[i]->data()->getStrVal(row, isNull); + return parm[i]->data()->getStrVal(row, isNull).safeString(""); } IDB_Decimal Func_simple_case::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull, @@ -642,7 +642,7 @@ string Func_searched_case::getStrVal(Row& row, FunctionParm& parm, bool& isNull, if (isNull) return string(""); - return parm[i]->data()->getStrVal(row, isNull); + return parm[i]->data()->getStrVal(row, isNull).safeString(""); } IDB_Decimal Func_searched_case::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull, diff --git a/utils/funcexp/func_cast.cpp b/utils/funcexp/func_cast.cpp index 98a2aec76..c95403756 100644 --- a/utils/funcexp/func_cast.cpp +++ b/utils/funcexp/func_cast.cpp @@ -143,7 +143,7 @@ int64_t Func_cast_signed::getIntVal(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& value = parm[0]->data()->getStrVal(row, isNull); + const auto& value = parm[0]->data()->getStrVal(row, isNull); if (isNull) { @@ -151,7 +151,7 @@ int64_t Func_cast_signed::getIntVal(Row& row, FunctionParm& parm, bool& isNull, return 0; } - return atoll(value.c_str()); + return atoll(value.str()); } break; @@ -259,7 +259,7 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row, FunctionParm& parm, bool& isNu case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& value = parm[0]->data()->getStrVal(row, isNull); + const auto& value = parm[0]->data()->getStrVal(row, isNull); if (isNull) { @@ -267,7 +267,7 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row, FunctionParm& parm, bool& isNu return 0; } - uint64_t ret = strtoul(value.c_str(), 0, 0); + uint64_t ret = strtoul(value.str(), 0, 0); return ret; } break; @@ -336,14 +336,14 @@ string Func_cast_char::getStrVal(Row& row, FunctionParm& parm, bool& isNull, { // check for convert with 1 arg, return the argument if (parm.size() == 1) - return parm[0]->data()->getStrVal(row, isNull); + return parm[0]->data()->getStrVal(row, isNull).safeString(""); ; int64_t length = parm[1]->data()->getIntVal(row, isNull); // @bug3488, a dummy parm is appended even the optional N is not present. if (length < 0) - return parm[0]->data()->getStrVal(row, isNull); + return parm[0]->data()->getStrVal(row, isNull).safeString(""); ; switch (parm[0]->data()->resultType().colDataType) @@ -392,15 +392,15 @@ string Func_cast_char::getStrVal(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& value = parm[0]->data()->getStrVal(row, isNull); + const utils::NullString& value = parm[0]->data()->getStrVal(row, isNull); if (isNull) { isNull = true; - return value; + return string(""); } - return value.substr(0, length); + return value.safeString("").substr(0, length); } break; @@ -549,7 +549,7 @@ int32_t Func_cast_date::getDateIntVal(rowgroup::Row& row, FunctionParm& parm, bo case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - val = dataconvert::DataConvert::stringToDate(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToDate(parm[0]->data()->getStrVal(row, isNull).safeString("")); if (val == -1) isNull = true; @@ -659,7 +659,7 @@ int64_t Func_cast_date::getDatetimeIntVal(rowgroup::Row& row, FunctionParm& parm case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull).safeString("")); if (val == -1) isNull = true; @@ -821,7 +821,7 @@ int64_t Func_cast_datetime::getDatetimeIntVal(rowgroup::Row& row, FunctionParm& case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull).safeString("")); if (val == -1) isNull = true; @@ -932,7 +932,7 @@ int64_t Func_cast_datetime::getTimeIntVal(rowgroup::Row& row, FunctionParm& parm case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - val = dataconvert::DataConvert::stringToTime(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToTime(parm[0]->data()->getStrVal(row, isNull).safeString("")); if (val == -1) isNull = true; @@ -1286,14 +1286,14 @@ IDB_Decimal Func_cast_decimal::getDecimalVal(Row& row, FunctionParm& parm, bool& case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& strValue = parm[0]->data()->getStrVal(row, isNull); - if (strValue.empty()) + const utils::NullString& strValue = parm[0]->data()->getStrVal(row, isNull); + if (strValue.isNull()) { isNull = true; return IDB_Decimal(); // need a null value for IDB_Decimal?? } datatypes::DataCondition convError; - return IDB_Decimal(strValue.data(), strValue.length(), convError, decimals, max_length); + return IDB_Decimal(strValue.str(), strValue.length(), convError, decimals, max_length); } break; @@ -1515,9 +1515,9 @@ double Func_cast_double::getDoubleVal(Row& row, FunctionParm& parm, bool& isNull case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& strValue = parm[0]->data()->getStrVal(row, isNull); + const utils::NullString& strValue = parm[0]->data()->getStrVal(row, isNull); - dblval = strtod(strValue.c_str(), NULL); + dblval = strtod(strValue.str(), NULL); } break; diff --git a/utils/funcexp/func_ceil.cpp b/utils/funcexp/func_ceil.cpp index e5c1f8728..c061bf525 100644 --- a/utils/funcexp/func_ceil.cpp +++ b/utils/funcexp/func_ceil.cpp @@ -127,10 +127,10 @@ int64_t Func_ceil::getIntVal(Row& row, FunctionParm& parm, bool& isNull, Calpont case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::TEXT: { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = (int64_t)ceil(strtod(str.c_str(), 0)); + ret = (int64_t)ceil(strtod(str.str(), 0)); } break; @@ -252,10 +252,10 @@ uint64_t Func_ceil::getUintVal(Row& row, FunctionParm& parm, bool& isNull, case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::TEXT: { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = (uint64_t)ceil(strtod(str.c_str(), 0)); + ret = (uint64_t)ceil(strtod(str.str(), 0)); } break; @@ -313,10 +313,10 @@ double Func_ceil::getDoubleVal(Row& row, FunctionParm& parm, bool& isNull, else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR || op_ct.colDataType == CalpontSystemCatalog::CHAR || op_ct.colDataType == CalpontSystemCatalog::TEXT) { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = ceil(strtod(str.c_str(), 0)); + ret = ceil(strtod(str.str(), 0)); } else if (op_ct.colDataType == CalpontSystemCatalog::LONGDOUBLE) { @@ -370,10 +370,12 @@ long double Func_ceil::getLongDoubleVal(Row& row, FunctionParm& parm, bool& isNu else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR || op_ct.colDataType == CalpontSystemCatalog::CHAR || op_ct.colDataType == CalpontSystemCatalog::TEXT) { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = ceil(strtod(str.c_str(), 0)); + { + ret = ceil(strtod(str.str(), 0)); + } } else if (op_ct.colDataType == CalpontSystemCatalog::DECIMAL || op_ct.colDataType == CalpontSystemCatalog::UDECIMAL) @@ -541,10 +543,10 @@ IDB_Decimal Func_ceil::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret.value = (int64_t)ceil(strtod(str.c_str(), 0)); + ret.value = (int64_t)ceil(strtod(str.str(), 0)); } break; diff --git a/utils/funcexp/func_char_length.cpp b/utils/funcexp/func_char_length.cpp index 5270d1d8a..a966989fc 100644 --- a/utils/funcexp/func_char_length.cpp +++ b/utils/funcexp/func_char_length.cpp @@ -75,11 +75,11 @@ int64_t Func_char_length::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool case execplan::CalpontSystemCatalog::DECIMAL: case execplan::CalpontSystemCatalog::UDECIMAL: { - const string& tstr = parm[0]->data()->getStrVal(row, isNull); + const auto& tstr = parm[0]->data()->getStrVal(row, isNull); if (isNull) return 0; - const char* b = tstr.c_str(); - const char* e = tstr.c_str() + tstr.length(); + const char* b = tstr.str(); + const char* e = tstr.str() + tstr.length(); return (int64_t)parm[0]->data()->resultType().getCharset()->numchars(b, e); } diff --git a/utils/funcexp/func_coalesce.cpp b/utils/funcexp/func_coalesce.cpp index bbb5a279e..0a8b28599 100644 --- a/utils/funcexp/func_coalesce.cpp +++ b/utils/funcexp/func_coalesce.cpp @@ -74,7 +74,7 @@ string Func_coalesce::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& is for (uint32_t i = 0; i < parm.size(); i++) { - val = parm[i]->data()->getStrVal(row, isNull); + val = parm[i]->data()->getStrVal(row, isNull).safeString(""); if (isNull) { diff --git a/utils/funcexp/func_concat.cpp b/utils/funcexp/func_concat.cpp index 05835d23a..0c5ad4edc 100644 --- a/utils/funcexp/func_concat.cpp +++ b/utils/funcexp/func_concat.cpp @@ -40,7 +40,28 @@ CalpontSystemCatalog::ColType Func_concat::operationType(FunctionParm& fp, CalpontSystemCatalog::ColType& resultType) { // operation type is not used by this functor - return fp[0]->data()->resultType(); + int widSum = 0; + for (const auto& fpi : fp) + { + switch (fpi->data()->resultType().colDataType) + { + case execplan::CalpontSystemCatalog::DECIMAL: + case execplan::CalpontSystemCatalog::UDECIMAL: + widSum += fpi->data()->resultType().precision + 2; + break; + default: + widSum += fpi->data()->resultType().colWidth * 3; // overprovision for bytes converted into decomals. + break; + } + } + if (widSum < resultType.colWidth) + { + widSum = resultType.colWidth; + } + auto temp = fp[0]->data()->resultType(); + temp.colWidth = widSum; + resultType.colWidth = widSum; + return temp; } // Returns the string that results from concatenating the arguments. diff --git a/utils/funcexp/func_concat_ws.cpp b/utils/funcexp/func_concat_ws.cpp index ea0cf22d4..8d7d34549 100644 --- a/utils/funcexp/func_concat_ws.cpp +++ b/utils/funcexp/func_concat_ws.cpp @@ -95,6 +95,7 @@ string Func_concat_ws::getStrVal(Row& row, FunctionParm& parm, bool& isNull, #endif string str; string tmp; + bool firstTime = true; for (uint32_t i = 1; i < parm.size(); i++) { stringValue(parm[i], row, isNull, tmp); @@ -104,18 +105,20 @@ string Func_concat_ws::getStrVal(Row& row, FunctionParm& parm, bool& isNull, continue; } - if (!str.empty()) + if (!firstTime) // XXX: XXX: XXX: concatenation of empty strings will result in empty string. str += delim; + firstTime = false; // TODO: Work on string reallocation. Use std::string::resize() to // grab larger chunks in some intellegent manner. str += tmp; } - if (str.empty()) + if (firstTime) { + // all arguments are NULL. isNull = true; - else - isNull = false; + return str; + } return str; } diff --git a/utils/funcexp/func_conv.cpp b/utils/funcexp/func_conv.cpp index 037ce83e8..f485b502f 100644 --- a/utils/funcexp/func_conv.cpp +++ b/utils/funcexp/func_conv.cpp @@ -277,7 +277,7 @@ CalpontSystemCatalog::ColType Func_conv::operationType(FunctionParm& fp, string Func_conv::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType& op_ct) { - const string& res = parm[0]->data()->getStrVal(row, isNull); + const auto& res = parm[0]->data()->getStrVal(row, isNull); string str; char ans[65]; int64_t dec; @@ -285,21 +285,19 @@ string Func_conv::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull int64_t to_base = parm[2]->data()->getIntVal(row, isNull); if (isNull || abs(static_cast(to_base)) > 36 || abs(static_cast(to_base)) < 2 || - abs(static_cast(from_base)) > 36 || abs(static_cast(from_base)) < 2 || !(res.length())) + abs(static_cast(from_base)) > 36 || abs(static_cast(from_base)) < 2 || res.length() < 1) { isNull = true; return ""; } if (from_base < 0) - dec = convStrToNum(res, -from_base, false); + dec = convStrToNum(res.safeString(""), -from_base, false); else - dec = (int64_t)convStrToNum(res, from_base, true); + dec = (int64_t)convStrToNum(res.safeString(""), from_base, true); str = helpers::convNumToStr(dec, ans, to_base); - isNull = str.empty(); - return str; } diff --git a/utils/funcexp/func_convert_tz.cpp b/utils/funcexp/func_convert_tz.cpp index 363392796..494ad754c 100644 --- a/utils/funcexp/func_convert_tz.cpp +++ b/utils/funcexp/func_convert_tz.cpp @@ -86,26 +86,26 @@ int64_t Func_convert_tz::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& return -1; } - const string& from_tz = parm[1]->data()->getStrVal(row, isNull); + const auto& from_tz = parm[1]->data()->getStrVal(row, isNull); if (isNull) { return 0; } - const string& to_tz = parm[2]->data()->getStrVal(row, isNull); + const auto& to_tz = parm[2]->data()->getStrVal(row, isNull); if (isNull) { return 0; } - cout << "from " << from_tz << endl; - cout << "to " << to_tz << endl; + cout << "from " << from_tz.safeString("") << endl; + cout << "to " << to_tz.safeString("") << endl; - const string& serialized_from_tzinfo = parm[3]->data()->getStrVal(row, isNull); - const string& serialized_to_tzinfo = parm[4]->data()->getStrVal(row, isNull); + const auto& serialized_from_tzinfo = parm[3]->data()->getStrVal(row, isNull); + const auto& serialized_to_tzinfo = parm[4]->data()->getStrVal(row, isNull); - if (!serialized_from_tzinfo.empty()) + if (!serialized_from_tzinfo.isNull()) { - bs.append((uint8_t*)serialized_from_tzinfo.c_str(), serialized_from_tzinfo.length()); + bs.append((uint8_t*)serialized_from_tzinfo.str(), serialized_from_tzinfo.length()); dataconvert::unserializeTimezoneInfo(bs, &tzinfo); deserializeInlineVector(bs, ats); tzinfo.ats = ats.data(); @@ -155,7 +155,7 @@ int64_t Func_convert_tz::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& else { long from_tz_offset; - dataconvert::timeZoneToOffset(from_tz.c_str(), from_tz.size(), &from_tz_offset); + dataconvert::timeZoneToOffset(from_tz.str(), from_tz.length(), &from_tz_offset); seconds = dataconvert::mySQLTimeToGmtSec(my_start_time, from_tz_offset, valid); if (!valid) { @@ -165,10 +165,10 @@ int64_t Func_convert_tz::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& } } - if (!serialized_to_tzinfo.empty()) + if (!serialized_to_tzinfo.isNull()) { bs.reset(); - bs.append((uint8_t*)serialized_to_tzinfo.c_str(), serialized_to_tzinfo.length()); + bs.append((uint8_t*)serialized_to_tzinfo.str(), serialized_to_tzinfo.length()); dataconvert::unserializeTimezoneInfo(bs, &tzinfo); deserializeInlineVector(bs, ats); tzinfo.ats = ats.data(); @@ -199,7 +199,7 @@ int64_t Func_convert_tz::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& else { long to_tz_offset; - dataconvert::timeZoneToOffset(to_tz.c_str(), to_tz.size(), &to_tz_offset); + dataconvert::timeZoneToOffset(to_tz.str(), to_tz.length(), &to_tz_offset); dataconvert::gmtSecToMySQLTime(seconds, my_time_tmp, to_tz_offset); } diff --git a/utils/funcexp/func_crc32.cpp b/utils/funcexp/func_crc32.cpp index 57bb7ceff..2a266e2fc 100644 --- a/utils/funcexp/func_crc32.cpp +++ b/utils/funcexp/func_crc32.cpp @@ -55,10 +55,10 @@ int64_t Func_crc32::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNu if (isNull) return 0; } - const string& b = parm[parm.size() - 1]->data()->getStrVal(row, isNull); + const auto& b = parm[parm.size() - 1]->data()->getStrVal(row, isNull); if (isNull) return 0; - return crc32(crc, reinterpret_cast(b.data()), b.size()); + return crc32(crc, reinterpret_cast(b.str()), b.length()); } } // namespace funcexp diff --git a/utils/funcexp/func_date.cpp b/utils/funcexp/func_date.cpp index b6e554e5f..e8191ed00 100644 --- a/utils/funcexp/func_date.cpp +++ b/utils/funcexp/func_date.cpp @@ -143,9 +143,9 @@ int64_t Func_date::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNul string Func_date::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType&) { - const string& val = parm[0]->data()->getStrVal(row, isNull); + const auto& val = parm[0]->data()->getStrVal(row, isNull); - return val.substr(0, 10); + return val.safeString("").substr(0, 10); } } // namespace funcexp diff --git a/utils/funcexp/func_date_add.cpp b/utils/funcexp/func_date_add.cpp index 6cc47fdae..5c877b3a7 100644 --- a/utils/funcexp/func_date_add.cpp +++ b/utils/funcexp/func_date_add.cpp @@ -737,7 +737,7 @@ int64_t Func_date_add::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& i case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull).safeString("")); break; } @@ -793,12 +793,12 @@ int64_t Func_date_add::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& i if ((ct3.colDataType == execplan::CalpontSystemCatalog::CHAR || ct3.colDataType == execplan::CalpontSystemCatalog::TEXT || ct3.colDataType == execplan::CalpontSystemCatalog::VARCHAR) && - constCol != NULL && constCol->constval().compare("SUB") == 0) + constCol != NULL && constCol->constval().safeString().compare("SUB") == 0) funcType = OP_SUB; else funcType = static_cast(parm[3]->data()->getIntVal(row, isNull)); - uint64_t value = helpers::dateAdd(val, parm[1]->data()->getStrVal(row, isNull), unit, dateType, funcType); + uint64_t value = helpers::dateAdd(val, parm[1]->data()->getStrVal(row, isNull).safeString(""), unit, dateType, funcType); if (value == 0) isNull = true; diff --git a/utils/funcexp/func_date_format.cpp b/utils/funcexp/func_date_format.cpp index 8a3ba9749..a2e996e18 100644 --- a/utils/funcexp/func_date_format.cpp +++ b/utils/funcexp/func_date_format.cpp @@ -314,7 +314,7 @@ string Func_date_format::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::TEXT: - val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull).safeString()); if (val == -1) { @@ -392,7 +392,7 @@ string Func_date_format::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& default: isNull = true; return ""; } - const string& format = parm[1]->data()->getStrVal(row, isNull); + const string& format = parm[1]->data()->getStrVal(row, isNull).safeString(""); return helpers::IDB_date_format(dt, format); } diff --git a/utils/funcexp/func_day.cpp b/utils/funcexp/func_day.cpp index e7954e3d0..8cad752b5 100644 --- a/utils/funcexp/func_day.cpp +++ b/utils/funcexp/func_day.cpp @@ -80,7 +80,7 @@ int64_t Func_day::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::VARCHAR: - val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull).safeString("")); if (val == -1) { diff --git a/utils/funcexp/func_dayname.cpp b/utils/funcexp/func_dayname.cpp index e8e069db5..e418bc67d 100644 --- a/utils/funcexp/func_dayname.cpp +++ b/utils/funcexp/func_dayname.cpp @@ -97,7 +97,7 @@ int64_t Func_dayname::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& is case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::VARCHAR: - val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull)); + val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull).safeString("")); if (val == -1) { diff --git a/utils/funcexp/func_dayofweek.cpp b/utils/funcexp/func_dayofweek.cpp index c8fb40ab2..b9700bdab 100644 --- a/utils/funcexp/func_dayofweek.cpp +++ b/utils/funcexp/func_dayofweek.cpp @@ -96,20 +96,28 @@ int64_t Func_dayofweek::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::VARCHAR: - val = dataconvert::DataConvert::stringToDatetime(parm[0]->data()->getStrVal(row, isNull)); - - if (val == -1) { - isNull = true; - return -1; - } - else - { - year = (uint32_t)((val >> 48) & 0xffff); - month = (uint32_t)((val >> 44) & 0xf); - day = (uint32_t)((val >> 38) & 0x3f); - } + const auto& valStr = parm[0]->data()->getStrVal(row, isNull); + if (valStr.isNull()) + { + isNull = true; + return -1; + } + + val = dataconvert::DataConvert::stringToDatetime(valStr.safeString("")); + if (val == -1) + { + isNull = true; + return -1; + } + else + { + year = (uint32_t)((val >> 48) & 0xffff); + month = (uint32_t)((val >> 44) & 0xf); + day = (uint32_t)((val >> 38) & 0x3f); + } + } break; case CalpontSystemCatalog::BIGINT: diff --git a/utils/funcexp/func_decode.cpp b/utils/funcexp/func_decode.cpp index 1adbfd407..9cccc6b61 100644 --- a/utils/funcexp/func_decode.cpp +++ b/utils/funcexp/func_decode.cpp @@ -54,12 +54,12 @@ CalpontSystemCatalog::ColType Func_decode::operationType(FunctionParm& fp, string Func_decode::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType&) { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (isNull) { return ""; } - const string& password = parm[1]->data()->getStrVal(row, isNull); + const auto& password = parm[1]->data()->getStrVal(row, isNull); if (isNull) { return ""; @@ -72,12 +72,12 @@ string Func_decode::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNu if (!fSeeded) { - hash_password(fSeeds, password.c_str(), nPassLen); + hash_password(fSeeds, password.str(), nPassLen); sql_crypt.init(fSeeds); fSeeded = true; } - memcpy(res.data(), str.c_str(), nStrLen); + memcpy(res.data(), str.str(), nStrLen); sql_crypt.decode(res.data(), nStrLen); sql_crypt.reinit(); diff --git a/utils/funcexp/func_decode_oracle.cpp b/utils/funcexp/func_decode_oracle.cpp index 0e53e16d8..25cc79e35 100644 --- a/utils/funcexp/func_decode_oracle.cpp +++ b/utils/funcexp/func_decode_oracle.cpp @@ -168,7 +168,7 @@ inline uint64_t simple_case_cmp(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::TEXT: case execplan::CalpontSystemCatalog::VARCHAR: { - const string& ev = parm[n]->data()->getStrVal(row, isNull); + const auto& ev = parm[n]->data()->getStrVal(row, isNull); if (isNull) break; CHARSET_INFO* cs = parm[n]->data()->resultType().getCharset(); @@ -176,10 +176,10 @@ inline uint64_t simple_case_cmp(Row& row, FunctionParm& parm, bool& isNull, for (i = 1; i <= whereCount; i++) { // BUG 5362 - const string& p1 = parm[i]->data()->getStrVal(row, isNull); + const auto& p1 = parm[i]->data()->getStrVal(row, isNull); if (isNull) break; - if (cs->strnncoll(ev.c_str(), ev.length(), p1.c_str(), p1.length()) == 0) + if (cs->strnncoll(ev.str(), ev.length(), p1.str(), p1.length()) == 0) { foundIt = true; break; @@ -463,7 +463,7 @@ string Func_decode_oracle::getStrVal(Row& row, FunctionParm& parm, bool& isNull, if (isNull) return string(""); - return parm[i]->data()->getStrVal(row, isNull); + return parm[i]->data()->getStrVal(row, isNull).safeString(""); } IDB_Decimal Func_decode_oracle::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull, diff --git a/utils/funcexp/func_encode.cpp b/utils/funcexp/func_encode.cpp index dcfc40e83..442391c06 100644 --- a/utils/funcexp/func_encode.cpp +++ b/utils/funcexp/func_encode.cpp @@ -55,12 +55,12 @@ CalpontSystemCatalog::ColType Func_encode::operationType(FunctionParm& fp, string Func_encode::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType&) { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (isNull) { return ""; } - const string& password = parm[1]->data()->getStrVal(row, isNull); + const auto& password = parm[1]->data()->getStrVal(row, isNull); if (isNull) { return ""; @@ -73,12 +73,12 @@ string Func_encode::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNu if (!fSeeded) { - hash_password(fSeeds, password.c_str(), nPassLen); + hash_password(fSeeds, password.str(), nPassLen); sql_crypt.init(fSeeds); fSeeded = true; } - memcpy(res.data(), str.c_str(), nStrLen); + memcpy(res.data(), str.str(), nStrLen); sql_crypt.encode(res.data(), nStrLen); sql_crypt.reinit(); diff --git a/utils/funcexp/func_extract.cpp b/utils/funcexp/func_extract.cpp index b051f2676..8c92e2520 100644 --- a/utils/funcexp/func_extract.cpp +++ b/utils/funcexp/func_extract.cpp @@ -224,8 +224,8 @@ int64_t Func_extract::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& is case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::TEXT: { - const string& val = parm[0]->data()->getStrVal(row, isNull); - time = dataconvert::DataConvert::stringToDatetime(val); + const auto& val = parm[0]->data()->getStrVal(row, isNull); + time = dataconvert::DataConvert::stringToDatetime(val.safeString("")); break; } diff --git a/utils/funcexp/func_find_in_set.cpp b/utils/funcexp/func_find_in_set.cpp index 85b0c7e25..b732f4418 100644 --- a/utils/funcexp/func_find_in_set.cpp +++ b/utils/funcexp/func_find_in_set.cpp @@ -53,15 +53,15 @@ CalpontSystemCatalog::ColType Func_find_in_set::operationType(FunctionParm& fp, int64_t Func_find_in_set::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType& op_ct) { - const string& searchStr = parm[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& searchStr = parm[0]->data()->getStrVal(row, isNull); + if (searchStr.isNull()) return 0; - const string& setString = parm[1]->data()->getStrVal(row, isNull); - if (isNull) + const auto& setString = parm[1]->data()->getStrVal(row, isNull); + if (setString.isNull()) return 0; - if (searchStr.find(",") != string::npos) + if (searchStr.unsafeStringRef().find(",") != string::npos) return 0; if (setString.length() < searchStr.length()) @@ -70,10 +70,10 @@ int64_t Func_find_in_set::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool CHARSET_INFO* cs = op_ct.getCharset(); my_wc_t wc = 0; - const char* str_begin = setString.c_str(); - const char* str_end = setString.c_str(); + const char* str_begin = setString.str(); + const char* str_end = setString.str(); const char* real_end = str_end + setString.length(); - const char* find_str = searchStr.c_str(); + const char* find_str = searchStr.str(); size_t find_str_len = searchStr.length(); int position = 0; static const char separator = ','; diff --git a/utils/funcexp/func_floor.cpp b/utils/funcexp/func_floor.cpp index f497400b5..8acaff38e 100644 --- a/utils/funcexp/func_floor.cpp +++ b/utils/funcexp/func_floor.cpp @@ -92,10 +92,10 @@ int64_t Func_floor::getIntVal(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = (int64_t)floor(strtod(str.c_str(), 0)); + ret = (int64_t)floor(strtod(str.str(), 0)); } break; @@ -194,10 +194,10 @@ uint64_t Func_floor::getUintVal(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = (uint64_t)floor(strtod(str.c_str(), 0)); + ret = (uint64_t)floor(strtod(str.str(), 0)); } break; @@ -281,10 +281,10 @@ double Func_floor::getDoubleVal(Row& row, FunctionParm& parm, bool& isNull, else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR || op_ct.colDataType == CalpontSystemCatalog::CHAR || op_ct.colDataType == CalpontSystemCatalog::TEXT) { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = floor(strtod(str.c_str(), 0)); + ret = floor(strtod(str.str(), 0)); } else if (op_ct.colDataType == CalpontSystemCatalog::DECIMAL || op_ct.colDataType == CalpontSystemCatalog::UDECIMAL) @@ -325,10 +325,10 @@ long double Func_floor::getLongDoubleVal(Row& row, FunctionParm& parm, bool& isN else if (op_ct.colDataType == CalpontSystemCatalog::VARCHAR || op_ct.colDataType == CalpontSystemCatalog::CHAR || op_ct.colDataType == CalpontSystemCatalog::TEXT) { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret = floor(strtod(str.c_str(), 0)); + ret = floor(strtod(str.str(), 0)); } else if (op_ct.colDataType == CalpontSystemCatalog::DECIMAL || op_ct.colDataType == CalpontSystemCatalog::UDECIMAL) @@ -488,10 +488,10 @@ IDB_Decimal Func_floor::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& str = parm[0]->data()->getStrVal(row, isNull); + const auto& str = parm[0]->data()->getStrVal(row, isNull); if (!isNull) - ret.value = (int64_t)floor(strtod(str.c_str(), 0)); + ret.value = (int64_t)floor(strtod(str.str(), 0)); } break; diff --git a/utils/funcexp/func_from_unixtime.cpp b/utils/funcexp/func_from_unixtime.cpp index b01bfab34..73103ad59 100644 --- a/utils/funcexp/func_from_unixtime.cpp +++ b/utils/funcexp/func_from_unixtime.cpp @@ -124,8 +124,8 @@ string Func_from_unixtime::getStrVal(rowgroup::Row& row, FunctionParm& parm, boo if (parm.size() == 2) { - const string& format = parm[1]->data()->getStrVal(row, isNull); - return helpers::IDB_date_format(dt, format); + const auto& format = parm[1]->data()->getStrVal(row, isNull); + return helpers::IDB_date_format(dt, format.safeString("")); } char buf[256] = {0}; diff --git a/utils/funcexp/func_get_format.cpp b/utils/funcexp/func_get_format.cpp index 00f513643..7fa69ede9 100644 --- a/utils/funcexp/func_get_format.cpp +++ b/utils/funcexp/func_get_format.cpp @@ -64,14 +64,14 @@ string Func_get_format::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& { // parm[0] -- format // parm[1] -- type - string format = parm[0]->data()->getStrVal(row, isNull); + string format = parm[0]->data()->getStrVal(row, isNull).safeString(""); if (isNull) return ""; transform(format.begin(), format.end(), format.begin(), to_upper()); - string type = parm[1]->data()->getStrVal(row, isNull); + string type = parm[1]->data()->getStrVal(row, isNull).safeString(""); if (isNull) return ""; @@ -98,7 +98,9 @@ string Func_get_format::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& { case 0: return known_date_time_formats[i][2]; break; - default: return ""; + default: + isNull = true; + return ""; } } } diff --git a/utils/funcexp/func_greatest.cpp b/utils/funcexp/func_greatest.cpp index 63548c323..6d021cfbb 100644 --- a/utils/funcexp/func_greatest.cpp +++ b/utils/funcexp/func_greatest.cpp @@ -124,22 +124,22 @@ long double Func_greatest::getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp std::string Func_greatest::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - const string& str = fp[0]->data()->getStrVal(row, isNull); + const auto& str = fp[0]->data()->getStrVal(row, isNull); CHARSET_INFO* cs = fp[0]->data()->resultType().getCharset(); - string greatestStr = str; + auto greatestStr = str; for (uint32_t i = 1; i < fp.size(); i++) { - const string& str1 = fp[i]->data()->getStrVal(row, isNull); + const auto& str1 = fp[i]->data()->getStrVal(row, isNull); - if (cs->strnncoll(greatestStr.c_str(), greatestStr.length(), str1.c_str(), str1.length()) < 0) + if (cs->strnncoll(greatestStr.str(), greatestStr.length(), str1.str(), str1.length()) < 0) { greatestStr = str1; } } - return greatestStr; + return greatestStr.safeString(""); } IDB_Decimal Func_greatest::getDecimalVal(Row& row, FunctionParm& fp, bool& isNull, diff --git a/utils/funcexp/func_hex.cpp b/utils/funcexp/func_hex.cpp index 6b7705af2..5d2ee5aa9 100644 --- a/utils/funcexp/func_hex.cpp +++ b/utils/funcexp/func_hex.cpp @@ -78,10 +78,10 @@ string Func_hex::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, case CalpontSystemCatalog::DATE: case CalpontSystemCatalog::TIME: { - const string& arg = parm[0]->data()->getStrVal(row, isNull); - scoped_array hexPtr(new char[strlen(arg.c_str()) * 2 + 1]); - octet2hex(hexPtr.get(), arg.c_str(), strlen(arg.c_str())); - return string(hexPtr.get(), strlen(arg.c_str()) * 2); + const auto& arg = parm[0]->data()->getStrVal(row, isNull); + scoped_array hexPtr(new char[arg.length() * 2 + 1]); // XXX: code now the same as for BLOB. + octet2hex(hexPtr.get(), arg.str(), arg.length()); + return string(hexPtr.get(), arg.length() * 2); } case CalpontSystemCatalog::DOUBLE: @@ -114,10 +114,10 @@ string Func_hex::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, case CalpontSystemCatalog::VARBINARY: case CalpontSystemCatalog::BLOB: { - const string& arg = parm[0]->data()->getStrVal(row, isNull); - uint64_t hexLen = arg.size() * 2; + const auto& arg = parm[0]->data()->getStrVal(row, isNull); + uint64_t hexLen = arg.length() * 2; scoped_array hexPtr(new char[hexLen + 1]); // "+ 1" for the last \0 - octet2hex(hexPtr.get(), arg.data(), arg.size()); + octet2hex(hexPtr.get(), arg.str(), arg.length()); return string(hexPtr.get(), hexLen); } diff --git a/utils/funcexp/func_if.cpp b/utils/funcexp/func_if.cpp index d5941df8d..0c37c6b48 100644 --- a/utils/funcexp/func_if.cpp +++ b/utils/funcexp/func_if.cpp @@ -51,7 +51,17 @@ bool boolVal(SPTP& parm, Row& row, long timeZone) case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::VARCHAR: - ret = (atoi((char*)(parm->data()->getStrVal(timeZone).c_str())) != 0); + { + const auto& str = parm->data()->getStrVal(timeZone); + if (str.isNull()) + { + ret = 0; + } + else + { + ret = (atoi((char*)(str.str())) != 0); + } + } break; case CalpontSystemCatalog::FLOAT: case CalpontSystemCatalog::UFLOAT: ret = (parm->data()->getFloatVal(row, isNull) != 0); break; @@ -138,11 +148,11 @@ string Func_if::getStrVal(Row& row, FunctionParm& parm, bool& isNull, CalpontSys { if (boolVal(parm[0], row, ct.getTimeZone())) { - return parm[1]->data()->getStrVal(row, isNull); + return parm[1]->data()->getStrVal(row, isNull).safeString(""); } else { - return parm[2]->data()->getStrVal(row, isNull); + return parm[2]->data()->getStrVal(row, isNull).safeString(""); } } diff --git a/utils/funcexp/func_ifnull.cpp b/utils/funcexp/func_ifnull.cpp index a2450a5a9..7cb5ebebc 100644 --- a/utils/funcexp/func_ifnull.cpp +++ b/utils/funcexp/func_ifnull.cpp @@ -68,18 +68,15 @@ int64_t Func_ifnull::getIntVal(Row& row, FunctionParm& parm, bool& isNull, Calpo string Func_ifnull::getStrVal(Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType&) { - if (isNull) - return string(); - - const string& r = parm[0]->data()->getStrVal(row, isNull); + const auto& r = parm[0]->data()->getStrVal(row, isNull); if (isNull) { isNull = false; - return parm[1]->data()->getStrVal(row, isNull); + return parm[1]->data()->getStrVal(row, isNull).safeString(""); } - return r; + return r.safeString(""); } IDB_Decimal Func_ifnull::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull, diff --git a/utils/funcexp/func_in.cpp b/utils/funcexp/func_in.cpp index d452fc242..aa0e7b9e7 100644 --- a/utils/funcexp/func_in.cpp +++ b/utils/funcexp/func_in.cpp @@ -263,7 +263,7 @@ inline bool getBoolForIn(rowgroup::Row& row, funcexp::FunctionParm& pm, bool& is case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& val = pm[0]->data()->getStrVal(row, isNull); + const auto& val = pm[0]->data()->getStrVal(row, isNull); if (isNull) return false; @@ -272,8 +272,8 @@ inline bool getBoolForIn(rowgroup::Row& row, funcexp::FunctionParm& pm, bool& is for (uint32_t i = 1; i < pm.size(); i++) { isNull = false; - const string& str1 = pm[i]->data()->getStrVal(row, isNull); - if (cs->strnncoll(val.c_str(), val.length(), str1.c_str(), str1.length()) == 0 && !isNull) + const auto& str1 = pm[i]->data()->getStrVal(row, isNull); + if (cs->strnncoll(val.str(), val.length(), str1.str(), str1.length()) == 0 && !isNull) return true; if (isNull && isNotIn) diff --git a/utils/funcexp/func_inet_aton.cpp b/utils/funcexp/func_inet_aton.cpp index 77c560cad..3f1e52d00 100644 --- a/utils/funcexp/func_inet_aton.cpp +++ b/utils/funcexp/func_inet_aton.cpp @@ -52,11 +52,11 @@ int64_t Func_inet_aton::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& is int64_t iValue = joblist::NULL_INT64; - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - int64_t iVal = convertAton(sValue, isNull); + int64_t iVal = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) iValue = iVal; @@ -76,11 +76,11 @@ double Func_inet_aton::getDoubleVal(rowgroup::Row& row, FunctionParm& fp, bool& double dValue = doubleNullVal(); - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - int64_t iValue = convertAton(sValue, isNull); + int64_t iValue = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) dValue = iValue; @@ -102,14 +102,18 @@ std::string Func_inet_aton::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool { // std::cout << "In Func_inet_aton::getStrVal" << std::endl; - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - convertAton(sValue, isNull); // ignore return value + convertAton(sValue.unsafeStringRef(), isNull); // ignore return valuea + if (isNull) + { + return ""; + } } - return sValue; + return sValue.safeString(""); } //------------------------------------------------------------------------------ @@ -122,11 +126,11 @@ bool Func_inet_aton::getBoolVal(rowgroup::Row& row, FunctionParm& fp, bool& isNu { bool bValue = false; - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - int64_t iVal = convertAton(sValue, isNull); + int64_t iVal = convertAton(sValue.unsafeStringRef(), isNull); if ((!isNull) && (iVal != 0)) bValue = true; @@ -144,13 +148,13 @@ execplan::IDB_Decimal Func_inet_aton::getDecimalVal(rowgroup::Row& row, Function { execplan::CalpontSystemCatalog::ColType colType = fp[0]->data()->resultType(); - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); if (!datatypes::Decimal::isWideDecimalTypeByPrecision(colType.precision)) { - if (!isNull) + if (!sValue.isNull()) { - int64_t iValue = convertAton(sValue, isNull); + int64_t iValue = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) return execplan::IDB_Decimal(iValue, colType.scale, colType.precision); @@ -162,7 +166,7 @@ execplan::IDB_Decimal Func_inet_aton::getDecimalVal(rowgroup::Row& row, Function { if (!isNull) { - int64_t iValue = convertAton(sValue, isNull); + int64_t iValue = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) return execplan::IDB_Decimal(0, colType.scale, colType.precision, (int128_t)iValue); @@ -182,11 +186,11 @@ int32_t Func_inet_aton::getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool { int32_t iValue = joblist::DATENULL; - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - int64_t iVal = convertAton(sValue, isNull); + int64_t iVal = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) iValue = iVal; @@ -206,11 +210,11 @@ int64_t Func_inet_aton::getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, { int64_t iValue = joblist::DATETIMENULL; - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - int64_t iVal = convertAton(sValue, isNull); + int64_t iVal = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) iValue = iVal; @@ -224,11 +228,11 @@ int64_t Func_inet_aton::getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, { int64_t iValue = joblist::TIMESTAMPNULL; - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - int64_t iVal = convertAton(sValue, isNull); + int64_t iVal = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) iValue = iVal; @@ -242,11 +246,11 @@ int64_t Func_inet_aton::getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool { int64_t iValue = joblist::TIMENULL; - const std::string& sValue = fp[0]->data()->getStrVal(row, isNull); + const auto& sValue = fp[0]->data()->getStrVal(row, isNull); - if (!isNull) + if (!sValue.isNull()) { - int64_t iVal = convertAton(sValue, isNull); + int64_t iVal = convertAton(sValue.unsafeStringRef(), isNull); if (!isNull) iValue = iVal; diff --git a/utils/funcexp/func_instr.cpp b/utils/funcexp/func_instr.cpp index 71eb81d0a..be60f6b14 100644 --- a/utils/funcexp/func_instr.cpp +++ b/utils/funcexp/func_instr.cpp @@ -49,17 +49,17 @@ int64_t Func_instr::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNu int64_t start0 = 0; my_match_t match; - const std::string& str = parm[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& str = parm[0]->data()->getStrVal(row, isNull); + if (str.isNull()) return 0; - const char* s1 = str.c_str(); + const char* s1 = str.str(); uint32_t l1 = (uint32_t)str.length(); - const std::string& substr = parm[1]->data()->getStrVal(row, isNull); - if (isNull) + const auto& substr = parm[1]->data()->getStrVal(row, isNull); + if (substr.isNull()) return 0; - const char* s2 = substr.c_str(); + const char* s2 = substr.str(); uint32_t l2 = (uint32_t)substr.length(); if (l2 < 1) return start + 1; diff --git a/utils/funcexp/func_json_array_append.cpp b/utils/funcexp/func_json_array_append.cpp index a8ed888f6..c88d3f1fa 100644 --- a/utils/funcexp/func_json_array_append.cpp +++ b/utils/funcexp/func_json_array_append.cpp @@ -23,7 +23,7 @@ CalpontSystemCatalog::ColType Func_json_array_append::operationType(FunctionParm string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; @@ -33,16 +33,17 @@ string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, b const uchar* arrEnd; size_t strRestLen; string retJS; - retJS.reserve(js.size() + padding); + retJS.reserve(js.length() + padding); initJSPaths(paths, fp, 1, 2); - string tmpJS{js}; + utils::NullString tmpJS(js); for (size_t i = 1, j = 0; i < fp.size(); i += 2, j++) { - const char* rawJS = tmpJS.data(); - const size_t jsLen = tmpJS.size(); + const char* rawJS = tmpJS.str(); + const size_t jsLen = tmpJS.length(); JSONPath& path = paths[j]; + if (!path.parsed && parseJSPath(path, row, fp[i], false)) goto error; @@ -77,7 +78,6 @@ string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, b /* Wrap as an array. */ retJS.append(rawJS, (const char*)jsEg.value_begin - rawJS); start = jsEg.value_begin; - if (jsEg.value_type == JSON_VALUE_OBJECT) { if (json_skip_level(&jsEg)) @@ -97,7 +97,7 @@ string Func_json_array_append::getStrVal(rowgroup::Row& row, FunctionParm& fp, b } // tmpJS save the json string for next loop - tmpJS.swap(retJS); + tmpJS.assign(retJS); retJS.clear(); } diff --git a/utils/funcexp/func_json_array_insert.cpp b/utils/funcexp/func_json_array_insert.cpp index 7c7d6eaa4..7e62ebb47 100644 --- a/utils/funcexp/func_json_array_insert.cpp +++ b/utils/funcexp/func_json_array_insert.cpp @@ -23,7 +23,7 @@ CalpontSystemCatalog::ColType Func_json_array_insert::operationType(FunctionParm string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; @@ -31,15 +31,15 @@ string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, b json_engine_t jsEg; string retJS; - retJS.reserve(js.size() + 8); + retJS.reserve(js.length() + 8); initJSPaths(paths, fp, 1, 2); - string tmpJS{js}; + utils::NullString tmpJS(js); for (size_t i = 1, j = 0; i < fp.size(); i += 2, j++) { - const char* rawJS = tmpJS.data(); - const size_t jsLen = tmpJS.size(); + const char* rawJS = tmpJS.str(); + const size_t jsLen = tmpJS.length(); JSONPath& path = paths[j]; if (!path.parsed) { @@ -122,7 +122,7 @@ string Func_json_array_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, b } // tmpJS save the json string for next loop - tmpJS.swap(retJS); + tmpJS.assign(retJS); retJS.clear(); } diff --git a/utils/funcexp/func_json_contains.cpp b/utils/funcexp/func_json_contains.cpp index abc681b4f..f3fabd9a9 100644 --- a/utils/funcexp/func_json_contains.cpp +++ b/utils/funcexp/func_json_contains.cpp @@ -160,8 +160,8 @@ bool Func_json_contains::getBoolVal(Row& row, FunctionParm& fp, bool& isNull, CalpontSystemCatalog::ColType& type) { bool isNullJS = false, isNullVal = false; - const string_view js = fp[0]->data()->getStrVal(row, isNullJS); - const string_view val = fp[1]->data()->getStrVal(row, isNullVal); + const auto& js = fp[0]->data()->getStrVal(row, isNullJS); + const auto& val = fp[1]->data()->getStrVal(row, isNullVal); if (isNullJS || isNullVal) { isNull = true; diff --git a/utils/funcexp/func_json_contains_path.cpp b/utils/funcexp/func_json_contains_path.cpp index b2b1f531c..51cd4abf3 100644 --- a/utils/funcexp/func_json_contains_path.cpp +++ b/utils/funcexp/func_json_contains_path.cpp @@ -28,10 +28,12 @@ CalpontSystemCatalog::ColType Func_json_contains_path::operationType( bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNull, CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto& js_ns = fp[0]->data()->getStrVal(row, isNull); if (isNull) return false; + const string_view js = js_ns.unsafeStringRef(); + #ifdef MYSQL_GE_1009 int arrayCounters[JSON_DEPTH_LIMIT]; bool hasNegPath = false; @@ -43,9 +45,10 @@ bool Func_json_contains_path::getBoolVal(Row& row, FunctionParm& fp, bool& isNul if (!isModeConst) isModeConst = (dynamic_cast(fp[1]->data()) != nullptr); - string mode = fp[1]->data()->getStrVal(row, isNull); + auto mode_ns = fp[1]->data()->getStrVal(row, isNull); if (isNull) return false; + string mode = mode_ns.unsafeStringRef(); transform(mode.begin(), mode.end(), mode.begin(), ::tolower); if (mode != "one" && mode != "all") diff --git a/utils/funcexp/func_json_depth.cpp b/utils/funcexp/func_json_depth.cpp index d3e826777..88d52c8cf 100644 --- a/utils/funcexp/func_json_depth.cpp +++ b/utils/funcexp/func_json_depth.cpp @@ -22,7 +22,7 @@ CalpontSystemCatalog::ColType Func_json_depth::operationType(FunctionParm& fp, int64_t Func_json_depth::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return 0; diff --git a/utils/funcexp/func_json_equals.cpp b/utils/funcexp/func_json_equals.cpp index 66c1e5ef3..fa0cc7db8 100644 --- a/utils/funcexp/func_json_equals.cpp +++ b/utils/funcexp/func_json_equals.cpp @@ -44,14 +44,17 @@ bool Func_json_equals::getBoolVal(Row& row, FunctionParm& fp, bool& isNull, return true; } - const string_view js1 = fp[0]->data()->getStrVal(row, isNull); + const auto js1_ns = fp[0]->data()->getStrVal(row, isNull); if (isNull) return false; - const string_view js2 = fp[1]->data()->getStrVal(row, isNull); + const auto js2_ns = fp[1]->data()->getStrVal(row, isNull); if (isNull) return false; + const string_view js1 = js1_ns.unsafeStringRef(); + const string_view js2 = js2_ns.unsafeStringRef(); + bool result = false; if (json_normalize(str1.get(), js1.data(), js1.size(), getCharset(fp[0]))) { diff --git a/utils/funcexp/func_json_exists.cpp b/utils/funcexp/func_json_exists.cpp index 83992227a..b76e86ae8 100644 --- a/utils/funcexp/func_json_exists.cpp +++ b/utils/funcexp/func_json_exists.cpp @@ -24,7 +24,7 @@ CalpontSystemCatalog::ColType Func_json_exists::operationType(FunctionParm& fp, bool Func_json_exists::getBoolVal(Row& row, FunctionParm& fp, bool& isNull, CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return false; diff --git a/utils/funcexp/func_json_extract.cpp b/utils/funcexp/func_json_extract.cpp index 3069c3343..1613717e8 100644 --- a/utils/funcexp/func_json_extract.cpp +++ b/utils/funcexp/func_json_extract.cpp @@ -17,10 +17,10 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t bool compareWhole = true) { bool isNull = false; - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return 1; - const char* rawJS = js.data(); + const char* rawJS = js.str(); json_engine_t jsEg, savJSEg; json_path_t p; const uchar* value; @@ -43,7 +43,7 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t JSONPath& path = paths[i - 1]; path.p.types_used = JSON_PATH_KEY_NULL; if (!path.parsed && parseJSPath(path, row, fp[i])) - goto error; + return 1; #ifdef MYSQL_GE_1009 hasNegPath |= path.p.types_used & JSON_PATH_NEGATIVE_INDEX; @@ -66,14 +66,14 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t retJS.append("["); } - json_get_path_start(&jsEg, getCharset(fp[0]), (const uchar*)rawJS, (const uchar*)rawJS + js.size(), &p); + json_get_path_start(&jsEg, getCharset(fp[0]), (const uchar*)rawJS, (const uchar*)rawJS + js.length(), &p); while (json_get_path_next(&jsEg, &p) == 0) { #ifdef MYSQL_GE_1009 if (hasNegPath && jsEg.value_type == JSON_VALUE_ARRAY && json_skip_array_and_count(&jsEg, arrayCounter + (p.last_step - p.steps))) - goto error; + return 1; #endif #ifdef MYSQL_GE_1009 @@ -91,7 +91,7 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t /* we only care about the first found value */ if (!compareWhole) { - retJS = js; + retJS = js.safeString(""); return 0; } @@ -102,7 +102,7 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t if (mayMulVal) savJSEg = jsEg; if (json_skip_level(&jsEg)) - goto error; + return 1; valLen = jsEg.s.c_str - value; if (mayMulVal) jsEg = savJSEg; @@ -125,26 +125,25 @@ int Func_json_extract::doExtract(Row& row, FunctionParm& fp, json_value_types* t } if (unlikely(jsEg.s.error)) - goto error; + return 1; if (!notFirstVal) /* Nothing was found. */ - goto error; + return 1; if (mayMulVal) retJS.append("]"); - initJSEngine(jsEg, getCharset(fp[0]), retJS); + utils::NullString retJS_ns(retJS); + initJSEngine(jsEg, getCharset(fp[0]), retJS_ns); if (doFormat(&jsEg, tmp, Func_json_format::LOOSE)) - goto error; + return 1; retJS.clear(); retJS.swap(tmp); return 0; -error: - return 1; } CalpontSystemCatalog::ColType Func_json_extract::operationType(FunctionParm& fp, diff --git a/utils/funcexp/func_json_format.cpp b/utils/funcexp/func_json_format.cpp index 82504cad1..178474935 100644 --- a/utils/funcexp/func_json_format.cpp +++ b/utils/funcexp/func_json_format.cpp @@ -25,7 +25,7 @@ CalpontSystemCatalog::ColType Func_json_format::operationType(FunctionParm& fp, string Func_json_format::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; diff --git a/utils/funcexp/func_json_insert.cpp b/utils/funcexp/func_json_insert.cpp index 08b81b2b6..b10a8314c 100644 --- a/utils/funcexp/func_json_insert.cpp +++ b/utils/funcexp/func_json_insert.cpp @@ -23,7 +23,7 @@ CalpontSystemCatalog::ColType Func_json_insert::operationType(FunctionParm& fp, string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; @@ -41,11 +41,11 @@ string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i // Save the result of each merge and the result of the final merge separately string retJS; - string tmpJS{js}; + utils::NullString tmpJS(js); for (size_t i = 1, j = 0; i < fp.size(); i += 2, j++) { - const char* rawJS = tmpJS.data(); - const size_t jsLen = tmpJS.size(); + const char* rawJS = tmpJS.str(); + const size_t jsLen = tmpJS.length(); JSONPath& path = paths[j]; const json_path_step_t* lastStep; @@ -226,7 +226,7 @@ string Func_json_insert::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i continue_point: // tmpJS save the json string for next loop - tmpJS.swap(retJS); + tmpJS.assign(retJS); retJS.clear(); } diff --git a/utils/funcexp/func_json_keys.cpp b/utils/funcexp/func_json_keys.cpp index 36e75b036..ac17750b9 100644 --- a/utils/funcexp/func_json_keys.cpp +++ b/utils/funcexp/func_json_keys.cpp @@ -54,10 +54,10 @@ CalpontSystemCatalog::ColType Func_json_keys::operationType(FunctionParm& fp, string Func_json_keys::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; - + IntType keySize = 0; string ret; json_engine_t jsEg; diff --git a/utils/funcexp/func_json_length.cpp b/utils/funcexp/func_json_length.cpp index 95b4d1b48..99763ef72 100644 --- a/utils/funcexp/func_json_length.cpp +++ b/utils/funcexp/func_json_length.cpp @@ -23,7 +23,7 @@ CalpontSystemCatalog::ColType Func_json_length::operationType(FunctionParm& fp, int64_t Func_json_length::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto& js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return 0; diff --git a/utils/funcexp/func_json_merge.cpp b/utils/funcexp/func_json_merge.cpp index ec6ed514b..4041571e7 100644 --- a/utils/funcexp/func_json_merge.cpp +++ b/utils/funcexp/func_json_merge.cpp @@ -217,7 +217,7 @@ CalpontSystemCatalog::ColType Func_json_merge::operationType(FunctionParm& fp, string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; @@ -225,12 +225,12 @@ string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is json_engine_t jsEg1, jsEg2; - string tmpJS{js}; + utils::NullString tmpJS(js); string retJS; for (size_t i = 1; i < fp.size(); i++) { - const string_view js2 = fp[i]->data()->getStrVal(row, isNull); + const auto js2 = fp[i]->data()->getStrVal(row, isNull); if (isNull) goto error; @@ -241,7 +241,7 @@ string Func_json_merge::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is goto error; // tmpJS save the merge result for next loop - tmpJS.swap(retJS); + tmpJS.assign(retJS); retJS.clear(); } diff --git a/utils/funcexp/func_json_merge_patch.cpp b/utils/funcexp/func_json_merge_patch.cpp index 02d4a6102..05561e193 100644 --- a/utils/funcexp/func_json_merge_patch.cpp +++ b/utils/funcexp/func_json_merge_patch.cpp @@ -71,8 +71,14 @@ int copyValuePatch(string& retJS, json_engine_t* jsEg) int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool& isEmpty) { - if (json_read_value(jsEg1) || json_read_value(jsEg2)) + if (json_read_value(jsEg1)) + { return 1; + } + if (json_read_value(jsEg2)) + { + return 1; + } if (jsEg1->value_type == JSON_VALUE_OBJECT && jsEg2->value_type == JSON_VALUE_OBJECT) { @@ -100,7 +106,9 @@ int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool } while (json_read_keyname_chr(jsEg1) == 0); if (jsEg1->s.error) + { return 1; + } savLen = retJS.size(); @@ -122,13 +130,17 @@ int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool if (!json_key_matches(jsEg2, &keyName)) { if (jsEg2->s.error || json_skip_key(jsEg2)) + { return 2; + } continue; } /* Json_2 has same key as Json_1. Merge them. */ if ((ires = doMergePatch(retJS, jsEg1, jsEg2, mrgEmpty))) + { return ires; + } if (mrgEmpty) retJS = retJS.substr(0, savLen); @@ -144,7 +156,9 @@ int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool keyStart = jsEg1->s.c_str; /* Just append the Json_1 key value. */ if (json_skip_key(jsEg1)) + { return 1; + } retJS.append((const char*)keyStart, jsEg1->s.c_str - keyStart); firstKey = 0; @@ -168,7 +182,9 @@ int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool } while (json_read_keyname_chr(jsEg2) == 0); if (jsEg2->s.error) + { return 1; + } *jsEg1 = savJSEg1; while (json_scan_next(jsEg1) == 0 && jsEg1->state != JST_OBJ_END) @@ -178,11 +194,15 @@ int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool if (!json_key_matches(jsEg1, &keyName)) { if (jsEg1->s.error || json_skip_key(jsEg1)) + { return 2; + } continue; } if (json_skip_key(jsEg2) || json_skip_level(jsEg1)) + { return 1; + } goto continue_j2; } @@ -199,14 +219,18 @@ int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool retJS.append("\":"); if (json_read_value(jsEg2)) + { return 1; + } if (jsEg2->value_type == JSON_VALUE_NULL) retJS = retJS.substr(0, savLen); else { if (copyValuePatch(retJS, jsEg2)) + { return 1; + } firstKey = 0; } @@ -219,11 +243,15 @@ int doMergePatch(string& retJS, json_engine_t* jsEg1, json_engine_t* jsEg2, bool else { if (!json_value_scalar(jsEg1) && json_skip_level(jsEg1)) + { return 1; + } isEmpty = (jsEg2->value_type == JSON_VALUE_NULL); if (!isEmpty && copyValuePatch(retJS, jsEg2)) + { return 1; + } } return 0; @@ -243,19 +271,18 @@ string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bo { // JSON_MERGE_PATCH return NULL if any argument is NULL bool isEmpty = false, hasNullArg = false; - const string_view js = fp[0]->data()->getStrVal(row, isNull); - hasNullArg = isNull; - if (isNull) - isNull = false; + const auto& js = fp[0]->data()->getStrVal(row, hasNullArg); + + isNull = false; json_engine_t jsEg1, jsEg2; jsEg1.s.error = jsEg2.s.error = 0; - string tmpJS{js}; + utils::NullString tmpJS(js); string retJS; for (size_t i = 1; i < fp.size(); i++) { - const string_view js2 = fp[i]->data()->getStrVal(row, isNull); + const auto& js2 = fp[i]->data()->getStrVal(row, isNull); if (isNull) { hasNullArg = true; @@ -273,23 +300,24 @@ string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bo goto next; hasNullArg = false; - retJS.append(js2.data()); + retJS.append(js2.str()); goto next; } initJSEngine(jsEg1, getCharset(fp[0]), tmpJS); if (doMergePatch(retJS, &jsEg1, &jsEg2, isEmpty)) + { goto error; + } if (isEmpty) retJS.append("null"); next: // tmpJS save the merge result for next loop - tmpJS.swap(retJS); + tmpJS.assign(retJS); retJS.clear(); } - if (hasNullArg) goto error; @@ -297,7 +325,6 @@ string Func_json_merge_patch::getStrVal(rowgroup::Row& row, FunctionParm& fp, bo retJS.clear(); if (doFormat(&jsEg1, retJS, Func_json_format::LOOSE)) goto error; - isNull = false; return retJS; diff --git a/utils/funcexp/func_json_normalize.cpp b/utils/funcexp/func_json_normalize.cpp index f9451eab6..6dbf28d2e 100644 --- a/utils/funcexp/func_json_normalize.cpp +++ b/utils/funcexp/func_json_normalize.cpp @@ -25,9 +25,10 @@ CalpontSystemCatalog::ColType Func_json_normalize::operationType(FunctionParm& f string Func_json_normalize::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js_ns = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; + const string_view js = js_ns.unsafeStringRef(); using DynamicString = unique_ptr; diff --git a/utils/funcexp/func_json_overlaps.cpp b/utils/funcexp/func_json_overlaps.cpp index aed3eb892..3df4abc9d 100644 --- a/utils/funcexp/func_json_overlaps.cpp +++ b/utils/funcexp/func_json_overlaps.cpp @@ -279,8 +279,8 @@ bool Func_json_overlaps::getBoolVal(Row& row, FunctionParm& fp, bool& isNull, CalpontSystemCatalog::ColType& type) { bool isNullJS1 = false, isNullJS2 = false; - const string_view js1 = fp[0]->data()->getStrVal(row, isNullJS1); - const string_view js2 = fp[1]->data()->getStrVal(row, isNullJS2); + const auto js1 = fp[0]->data()->getStrVal(row, isNullJS1); + const auto js2 = fp[1]->data()->getStrVal(row, isNullJS2); if (isNullJS1 || isNullJS2) return false; diff --git a/utils/funcexp/func_json_quote.cpp b/utils/funcexp/func_json_quote.cpp index 0e26272e4..30b2246eb 100644 --- a/utils/funcexp/func_json_quote.cpp +++ b/utils/funcexp/func_json_quote.cpp @@ -28,9 +28,12 @@ CalpontSystemCatalog::ColType Func_json_quote::operationType(FunctionParm& fp, std::string Func_json_quote::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull || !isCharType(fp[0]->data()->resultType().colDataType)) + { + isNull = true; return ""; + } string ret("\""); diff --git a/utils/funcexp/func_json_remove.cpp b/utils/funcexp/func_json_remove.cpp index 469d45c92..98558869c 100644 --- a/utils/funcexp/func_json_remove.cpp +++ b/utils/funcexp/func_json_remove.cpp @@ -23,7 +23,8 @@ CalpontSystemCatalog::ColType Func_json_remove::operationType(FunctionParm& fp, string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto& js = fp[0]->data()->getStrVal(row, isNull); + if (isNull) return ""; @@ -37,11 +38,11 @@ string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i initJSPaths(paths, fp, 1, 1); string retJS; - string tmpJS{js}; + utils::NullString tmpJS(js); for (size_t i = 1, j = 0; i < fp.size(); i++, j++) { - const char* rawJS = tmpJS.data(); - const size_t jsLen = tmpJS.size(); + const char* rawJS = tmpJS.str(); + const size_t jsLen = tmpJS.length(); JSONPath& path = paths[j]; const json_path_step_t* lastStep; @@ -61,7 +62,7 @@ string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i } } - initJSEngine(jsEg, cs, rawJS); + initJSEngine(jsEg, cs, tmpJS); if (path.p.last_step < path.p.steps) goto v_found; @@ -145,7 +146,7 @@ string Func_json_remove::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i retJS.append(","); retJS.append(remEnd, rawJS + jsLen - remEnd); - tmpJS.swap(retJS); + tmpJS.assign(retJS); retJS.clear(); } diff --git a/utils/funcexp/func_json_search.cpp b/utils/funcexp/func_json_search.cpp index e3df34800..c7cb6830e 100644 --- a/utils/funcexp/func_json_search.cpp +++ b/utils/funcexp/func_json_search.cpp @@ -54,11 +54,11 @@ namespace funcexp { const static int wildOne = '_'; const static int wildMany = '%'; -int Func_json_search::cmpJSValWild(json_engine_t* jsEg, const string_view& cmpStr, const CHARSET_INFO* cs) +int Func_json_search::cmpJSValWild(json_engine_t* jsEg, const utils::NullString& cmpStr, const CHARSET_INFO* cs) { if (jsEg->value_type != JSON_VALUE_STRING || !jsEg->value_escaped) return cs->wildcmp((const char*)jsEg->value, (const char*)(jsEg->value + jsEg->value_len), - (const char*)cmpStr.data(), (const char*)cmpStr.data() + cmpStr.size(), escape, + (const char*)cmpStr.str(), (const char*)cmpStr.end(), escape, wildOne, wildMany) ? 0 : 1; @@ -71,7 +71,7 @@ int Func_json_search::cmpJSValWild(json_engine_t* jsEg, const string_view& cmpSt (uchar*)buf, (uchar*)(buf + strLen))) <= 0) return 0; - return cs->wildcmp(buf, buf + strLen, cmpStr.data(), cmpStr.data() + cmpStr.size(), escape, wildOne, + return cs->wildcmp(buf, buf + strLen, cmpStr.str(), cmpStr.end(), escape, wildOne, wildMany) ? 0 : 1; @@ -89,8 +89,8 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i { string ret; bool isNullJS = false, isNullVal = false; - const string_view js = fp[0]->data()->getStrVal(row, isNull); - const string_view cmpStr = fp[2]->data()->getStrVal(row, isNull); + const auto& js = fp[0]->data()->getStrVal(row, isNull); + const auto& cmpStr = fp[2]->data()->getStrVal(row, isNull); if (isNullJS || isNullVal) { isNull = true; @@ -102,9 +102,10 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i if (!isModeConst) isModeConst = (dynamic_cast(fp[1]->data()) != nullptr); - string mode = fp[1]->data()->getStrVal(row, isNull); + const auto& mode_ns = fp[1]->data()->getStrVal(row, isNull); if (isNull) return ""; + string mode = mode_ns.safeString(""); transform(mode.begin(), mode.end(), mode.begin(), ::tolower); if (mode != "one" && mode != "all") @@ -125,13 +126,13 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i return ""; } bool isNullEscape = false; - const string_view escapeStr = fp[3]->data()->getStrVal(row, isNullEscape); - if (escapeStr.size() > 1) + const auto& escapeStr = fp[3]->data()->getStrVal(row, isNullEscape); + if (escapeStr.length() > 1) { isNull = true; return ""; } - escape = isNullEscape ? '\\' : escapeStr[0]; + escape = isNullEscape ? '\\' : escapeStr.safeString("")[0]; } json_engine_t jsEg; @@ -159,7 +160,7 @@ string Func_json_search::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i } } - json_get_path_start(&jsEg, cs, (const uchar*)js.data(), (const uchar*)js.data() + js.size(), &p); + json_get_path_start(&jsEg, cs, (const uchar*)js.str(), (const uchar*)js.end(), &p); while (json_get_path_next(&jsEg, &p) == 0) { diff --git a/utils/funcexp/func_json_type.cpp b/utils/funcexp/func_json_type.cpp index 129f44e49..333c01179 100644 --- a/utils/funcexp/func_json_type.cpp +++ b/utils/funcexp/func_json_type.cpp @@ -22,7 +22,7 @@ CalpontSystemCatalog::ColType Func_json_type::operationType(FunctionParm& fp, string Func_json_type::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; diff --git a/utils/funcexp/func_json_unquote.cpp b/utils/funcexp/func_json_unquote.cpp index 863a87a36..267e1c8b0 100644 --- a/utils/funcexp/func_json_unquote.cpp +++ b/utils/funcexp/func_json_unquote.cpp @@ -22,7 +22,7 @@ CalpontSystemCatalog::ColType Func_json_unquote::operationType(FunctionParm& fp, std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; @@ -35,7 +35,7 @@ std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, b json_read_value(&jsEg); if (unlikely(jsEg.s.error) || jsEg.value_type != JSON_VALUE_STRING) - return js.data(); + return js.safeString(); char* buf = (char*)alloca(jsEg.value_len); if ((strLen = json_unescape(cs, jsEg.value, jsEg.value + jsEg.value_len, &my_charset_utf8mb3_general_ci, @@ -46,6 +46,6 @@ std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, b return strLen == 0 ? "" : ret; } - return js.data(); + return js.safeString(""); } } // namespace funcexp diff --git a/utils/funcexp/func_json_valid.cpp b/utils/funcexp/func_json_valid.cpp index 35a93b691..e0a010d59 100644 --- a/utils/funcexp/func_json_valid.cpp +++ b/utils/funcexp/func_json_valid.cpp @@ -25,10 +25,10 @@ CalpontSystemCatalog::ColType Func_json_valid::operationType(FunctionParm& fp, bool Func_json_valid::getBoolVal(Row& row, FunctionParm& fp, bool& isNull, CalpontSystemCatalog::ColType& type) { - const string_view js = fp[0]->data()->getStrVal(row, isNull); + const auto js = fp[0]->data()->getStrVal(row, isNull); if (isNull) return false; - return json_valid(js.data(), js.size(), getCharset(fp[0])); + return json_valid(js.unsafeStringRef().data(), js.unsafeStringRef().size(), getCharset(fp[0])); } } // namespace funcexp diff --git a/utils/funcexp/func_json_value.cpp b/utils/funcexp/func_json_value.cpp index 715e750b4..c05a010aa 100644 --- a/utils/funcexp/func_json_value.cpp +++ b/utils/funcexp/func_json_value.cpp @@ -63,8 +63,9 @@ bool JSONPathWrapper::extract(std::string& ret, rowgroup::Row& row, execplan::SP { bool isNullJS = false, isNullPath = false; - const string& js = funcParamJS->data()->getStrVal(row, isNullJS); - const string_view jsp = funcParamPath->data()->getStrVal(row, isNullPath); + const string js = funcParamJS->data()->getStrVal(row, isNullJS).safeString(""); + const string sjsp = funcParamPath->data()->getStrVal(row, isNullPath).safeString(""); + const string_view jsp = sjsp; if (isNullJS || isNullPath) return true; diff --git a/utils/funcexp/func_lcase.cpp b/utils/funcexp/func_lcase.cpp index ccc2dccb5..66d96c68c 100644 --- a/utils/funcexp/func_lcase.cpp +++ b/utils/funcexp/func_lcase.cpp @@ -46,7 +46,7 @@ CalpontSystemCatalog::ColType Func_lcase::operationType(FunctionParm& fp, std::string Func_lcase::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& colType) { - const string& tstr = fp[0]->data()->getStrVal(row, isNull); + const auto& tstr = fp[0]->data()->getStrVal(row, isNull); if (isNull) return ""; @@ -56,7 +56,7 @@ std::string Func_lcase::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is uint64_t bufLen = inLen * cs->casedn_multiply; char* outBuf = new char[bufLen]; - uint64_t outLen = cs->casedn(tstr.c_str(), inLen, outBuf, bufLen); + uint64_t outLen = cs->casedn(tstr.str(), inLen, outBuf, bufLen); string ret = string(outBuf, outLen); delete[] outBuf; diff --git a/utils/funcexp/func_least.cpp b/utils/funcexp/func_least.cpp index d488b7516..0527d32b2 100644 --- a/utils/funcexp/func_least.cpp +++ b/utils/funcexp/func_least.cpp @@ -106,20 +106,20 @@ long double Func_least::getLongDoubleVal(rowgroup::Row& row, FunctionParm& fp, b std::string Func_least::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - string leastStr = fp[0]->data()->getStrVal(row, isNull); + auto leastStr = fp[0]->data()->getStrVal(row, isNull); CHARSET_INFO* cs = fp[0]->data()->resultType().getCharset(); for (uint32_t i = 1; i < fp.size(); i++) { - const string& str1 = fp[i]->data()->getStrVal(row, isNull); + const auto& str1 = fp[i]->data()->getStrVal(row, isNull); - if (cs->strnncoll(leastStr.c_str(), leastStr.length(), str1.c_str(), str1.length()) > 0) + if (cs->strnncoll(leastStr.str(), leastStr.length(), str1.str(), str1.length()) > 0) { leastStr = str1; } } - return leastStr; + return leastStr.safeString(""); } IDB_Decimal Func_least::getDecimalVal(Row& row, FunctionParm& fp, bool& isNull, diff --git a/utils/funcexp/func_left.cpp b/utils/funcexp/func_left.cpp index de31d1770..eefdeecfd 100644 --- a/utils/funcexp/func_left.cpp +++ b/utils/funcexp/func_left.cpp @@ -47,14 +47,12 @@ std::string Func_left::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (isNull || src.length() < 1) // null or empty string. return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; size_t trimLength = fp[1]->data()->getUintVal(row, isNull); @@ -65,7 +63,7 @@ std::string Func_left::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN if ((binLen <= trimLength) || (binLen <= (charPos = cs->charpos(pos, end, trimLength)))) { - return src; + return src.safeString(""); } std::string ret(pos, charPos); diff --git a/utils/funcexp/func_length.cpp b/utils/funcexp/func_length.cpp index a6f7236f5..13ae4463b 100644 --- a/utils/funcexp/func_length.cpp +++ b/utils/funcexp/func_length.cpp @@ -51,7 +51,12 @@ int64_t Func_length::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNul (fp[0]->data()->resultType().colDataType == CalpontSystemCatalog::BLOB)) return fp[0]->data()->getStrVal(row, isNull).length(); - return strlen(fp[0]->data()->getStrVal(row, isNull).c_str()); + const auto& str = fp[0]->data()->getStrVal(row, isNull); + if (str.isNull()) + { + return 0; + } + return strlen(str.str()); } } // namespace funcexp diff --git a/utils/funcexp/func_lpad.cpp b/utils/funcexp/func_lpad.cpp index 8a5544a6f..81700d6a4 100644 --- a/utils/funcexp/func_lpad.cpp +++ b/utils/funcexp/func_lpad.cpp @@ -53,14 +53,12 @@ std::string Func_lpad::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (isNull || src.length() < 1) return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); @@ -83,18 +81,20 @@ std::string Func_lpad::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN } // The pad characters. - const string* pad = &fPad; // Defaults to space + string pad = fPad; // Defaults to space + // XXX: this is extremely suspicious thing going on below. pad was pointer and pointed value + // may escape scope. I changed pad to be reference. if (fp.size() > 2) { - pad = &fp[2]->data()->getStrVal(row, isNull); + pad = fp[2]->data()->getStrVal(row, isNull).safeString(""); } // binPLen represents the number of bytes in pad - size_t binPLen = pad->length(); - const char* posP = pad->c_str(); + size_t binPLen = pad.length(); + const char* posP = pad.c_str(); // plen = the number of characters in pad size_t plen = cs->numchars(posP, posP + binPLen); if (plen == 0) - return src; + return src.safeString(""); size_t byteCount = (padLength + 1) * cs->mbmaxlen; // absolute maximun number of bytes char* buf = new char[byteCount]; diff --git a/utils/funcexp/func_ltrim.cpp b/utils/funcexp/func_ltrim.cpp index 3d7e96918..488db3623 100644 --- a/utils/funcexp/func_ltrim.cpp +++ b/utils/funcexp/func_ltrim.cpp @@ -48,27 +48,25 @@ std::string Func_ltrim::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (isNull || src.length() < 1) return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); // The trim characters. - const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull) : " "); + const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull).safeString("") : " "); // binTLen represents the number of bytes in trim size_t binTLen = trim.length(); const char* posT = trim.c_str(); // strTLen = the number of characters in trim size_t strTLen = cs->numchars(posT, posT + binTLen); if (strTLen == 0 || strTLen > strLen) - return src; + return src.unsafeStringRef(); if (binTLen == 1) { diff --git a/utils/funcexp/func_ltrim_oracle.cpp b/utils/funcexp/func_ltrim_oracle.cpp index 70fc1dc8b..9c6247e46 100644 --- a/utils/funcexp/func_ltrim_oracle.cpp +++ b/utils/funcexp/func_ltrim_oracle.cpp @@ -48,27 +48,31 @@ std::string Func_ltrim_oracle::getStrVal(rowgroup::Row& row, FunctionParm& fp, b { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (isNull || src.length() < 1) + { + isNull = true; return ""; - if (src.empty() || src.length() == 0) - return src; + } // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); // The trim characters. - const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull) : " "); + const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull).safeString("") : " "); // binTLen represents the number of bytes in trim size_t binTLen = trim.length(); const char* posT = trim.c_str(); // strTLen = the number of characters in trim size_t strTLen = cs->numchars(posT, posT + binTLen); if (strTLen == 0 || strTLen > strLen) - return src; + { + isNull = src.length() < 1; + return src.safeString(""); + } if (binTLen == 1) { diff --git a/utils/funcexp/func_makedate.cpp b/utils/funcexp/func_makedate.cpp index fb49f54cc..ea21e419f 100644 --- a/utils/funcexp/func_makedate.cpp +++ b/utils/funcexp/func_makedate.cpp @@ -101,7 +101,7 @@ uint64_t makedate(rowgroup::Row& row, FunctionParm& parm, bool& isNull) case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::VARCHAR: { - dayofyear = parm[1]->data()->getStrVal(row, isNull); + dayofyear = parm[1]->data()->getStrVal(row, isNull).safeString(""); if (atoi(dayofyear.c_str()) < 1) { diff --git a/utils/funcexp/func_math.cpp b/utils/funcexp/func_math.cpp index 7ef56be70..ce3d3542d 100644 --- a/utils/funcexp/func_math.cpp +++ b/utils/funcexp/func_math.cpp @@ -1734,7 +1734,7 @@ string Func_format::getStrVal(Row& row, FunctionParm& parm, bool& isNull, case execplan::CalpontSystemCatalog::UTINYINT: case execplan::CalpontSystemCatalog::USMALLINT: { - value = parm[0]->data()->getStrVal(row, isNull); + value = parm[0]->data()->getStrVal(row, isNull).safeString(""); } break; diff --git a/utils/funcexp/func_md5.cpp b/utils/funcexp/func_md5.cpp index 0ce6b0a05..02e32eb61 100644 --- a/utils/funcexp/func_md5.cpp +++ b/utils/funcexp/func_md5.cpp @@ -504,8 +504,12 @@ CalpontSystemCatalog::ColType Func_md5::operationType(FunctionParm& fp, string Func_md5::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType& op_ct) { - const string& arg = parm[0]->data()->getStrVal(row, isNull); - return MD5String(arg.c_str()); + const auto& arg = parm[0]->data()->getStrVal(row, isNull); + if (arg.isNull()) + { + return ""; + } + return MD5String(arg.str()); // return str; } diff --git a/utils/funcexp/func_nullif.cpp b/utils/funcexp/func_nullif.cpp index 3821151e4..ba8b83559 100644 --- a/utils/funcexp/func_nullif.cpp +++ b/utils/funcexp/func_nullif.cpp @@ -348,16 +348,16 @@ uint64_t Func_nullif::getUintVal(rowgroup::Row& row, FunctionParm& parm, bool& i string Func_nullif::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType& op_ct) { - string exp1 = parm[0]->data()->getStrVal(row, isNull); + string exp1 = parm[0]->data()->getStrVal(row, isNull).safeString(""); CHARSET_INFO* cs = parm[0]->data()->resultType().getCharset(); if (isNull) { - isNull = false; + // NULLIF(NULL, ...) is NULL, according to server's results. return ""; } - string exp2 = parm[1]->data()->getStrVal(row, isNull); + string exp2 = parm[1]->data()->getStrVal(row, isNull).safeString(""); if (isNull) { @@ -388,7 +388,7 @@ string Func_nullif::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNu return ""; } - return parm[0]->data()->getStrVal(row, isNull); + return parm[0]->data()->getStrVal(row, isNull).safeString(""); } int32_t Func_nullif::getDateIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, diff --git a/utils/funcexp/func_period_diff.cpp b/utils/funcexp/func_period_diff.cpp index 080d15a42..452c9024d 100644 --- a/utils/funcexp/func_period_diff.cpp +++ b/utils/funcexp/func_period_diff.cpp @@ -76,7 +76,11 @@ int64_t getArgSInt64Val(rowgroup::Row& row, TreeNode* exp, bool& isNull) case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::CHAR: - case execplan::CalpontSystemCatalog::TEXT: return atoi(exp->getStrVal(row, isNull).c_str()); + case execplan::CalpontSystemCatalog::TEXT: + { + const auto& str = exp->getStrVal(row, isNull); + return str.isNull() ? 0 : atoi(str.str()); + } case execplan::CalpontSystemCatalog::DOUBLE: case execplan::CalpontSystemCatalog::FLOAT: diff --git a/utils/funcexp/func_quote.cpp b/utils/funcexp/func_quote.cpp index b82cf7baa..ed1e3651c 100644 --- a/utils/funcexp/func_quote.cpp +++ b/utils/funcexp/func_quote.cpp @@ -45,15 +45,14 @@ std::string Func_quote::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is return "NULL"; } - if (str.empty()) - return "NULL"; + size_t strSize = strlen(str.c_str()); string result; - result.reserve((str.size() * 1.3) + 2); + result.reserve(((strSize + 1) * 1.3) + 2); result.push_back('\''); - for (uint64_t i = 0; i < str.size(); i++) + for (uint64_t i = 0; i < strSize; i++) { switch (str[i]) { diff --git a/utils/funcexp/func_regexp.cpp b/utils/funcexp/func_regexp.cpp index eef59d784..342cfcf0c 100644 --- a/utils/funcexp/func_regexp.cpp +++ b/utils/funcexp/func_regexp.cpp @@ -73,7 +73,7 @@ inline bool getBool(rowgroup::Row& row, funcexp::FunctionParm& pm, bool& isNull, case execplan::CalpontSystemCatalog::FLOAT: case execplan::CalpontSystemCatalog::UFLOAT: { - expr = pm[0]->data()->getStrVal(row, isNull); + expr = pm[0]->data()->getStrVal(row, isNull).safeString(""); break; } @@ -153,7 +153,7 @@ inline bool getBool(rowgroup::Row& row, funcexp::FunctionParm& pm, bool& isNull, case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - pattern = pm[1]->data()->getStrVal(row, isNull); + pattern = pm[1]->data()->getStrVal(row, isNull).safeString(""); break; } diff --git a/utils/funcexp/func_repeat.cpp b/utils/funcexp/func_repeat.cpp index ebbfc355a..405e01838 100644 --- a/utils/funcexp/func_repeat.cpp +++ b/utils/funcexp/func_repeat.cpp @@ -53,7 +53,7 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i stringValue(fp[0], row, isNull, str); - if (str.empty() || str == "") + if (isNull) return ""; int count = fp[1]->data()->getIntVal(row, isNull); @@ -62,7 +62,10 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i return ""; if (count < 1) + { + isNull = true; return ""; + } // calculate size of buffer to allocate @@ -73,15 +76,19 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i if (result == NULL) { + isNull = true; return ""; } - memset((char*)result, 0, size); + memset((char*)result, 0, size + 1); for (int i = 0; i < count; i++) { if (strcat(result, str.c_str()) == NULL) // questionable check + { + isNull = true; return ""; + } } std::string res(result); diff --git a/utils/funcexp/func_replace.cpp b/utils/funcexp/func_replace.cpp index afcb17f42..a36f2135d 100644 --- a/utils/funcexp/func_replace.cpp +++ b/utils/funcexp/func_replace.cpp @@ -48,21 +48,27 @@ std::string Func_replace::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& { CHARSET_INFO* cs = ct.getCharset(); - const string& str = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& nstr = fp[0]->data()->getStrVal(row, isNull); + if (nstr.isNull()) return ""; + + const auto& str = nstr.unsafeStringRef(); size_t strLen = str.length(); - const string& fromstr = fp[1]->data()->getStrVal(row, isNull); - if (isNull) + const auto& nfromstr = fp[1]->data()->getStrVal(row, isNull); + if (nfromstr.isNull()) return ""; + const auto& fromstr = nfromstr.unsafeStringRef(); + if (fromstr.length() == 0) return str; size_t fromLen = fromstr.length(); - const string& tostr = fp[2]->data()->getStrVal(row, isNull); - if (isNull) + const auto& ntostr = fp[2]->data()->getStrVal(row, isNull); + if (ntostr.isNull()) return ""; + const auto& tostr = ntostr.unsafeStringRef(); + size_t toLen = tostr.length(); bool binaryCmp = (cs->state & MY_CS_BINSORT) || !cs->use_mb(); diff --git a/utils/funcexp/func_replace_oracle.cpp b/utils/funcexp/func_replace_oracle.cpp index 113b49d96..2ebc09c99 100644 --- a/utils/funcexp/func_replace_oracle.cpp +++ b/utils/funcexp/func_replace_oracle.cpp @@ -42,21 +42,27 @@ std::string Func_replace_oracle::getStrVal(rowgroup::Row& row, FunctionParm& fp, { CHARSET_INFO* cs = ct.getCharset(); - const string& str = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& nstr = fp[0]->data()->getStrVal(row, isNull); + if (nstr.isNull()) return ""; + const auto& str = nstr.unsafeStringRef(); size_t strLen = str.length(); - const string& fromstr = fp[1]->data()->getStrVal(row, isNull); - if (isNull) + const auto& nfromstr = fp[1]->data()->getStrVal(row, isNull); + if (nfromstr.isNull()) return ""; + const auto& fromstr = nfromstr.unsafeStringRef(); + if (fromstr.length() == 0) return str; size_t fromLen = fromstr.length(); - const string& tostr = fp[2]->data()->getStrVal(row, isNull); - if (isNull) + const auto& ntostr = fp[2]->data()->getStrVal(row, isNull); + if (ntostr.isNull()) return ""; + + const auto& tostr = ntostr.unsafeStringRef(); + size_t toLen = tostr.length(); bool binaryCmp = (cs->state & MY_CS_BINSORT) || !cs->use_mb(); diff --git a/utils/funcexp/func_right.cpp b/utils/funcexp/func_right.cpp index 2c1ec612a..6a1a7d0e2 100644 --- a/utils/funcexp/func_right.cpp +++ b/utils/funcexp/func_right.cpp @@ -48,14 +48,12 @@ std::string Func_right::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (isNull || src.length() < 1) return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; size_t trimLength = fp[1]->data()->getUintVal(row, isNull); @@ -64,7 +62,7 @@ std::string Func_right::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is size_t start = cs->numchars(pos, end); // Here, start is number of characters in src if (start <= trimLength) - return src; + return src.safeString(""); start = cs->charpos(pos, end, start - trimLength); // Here, start becomes number of bytes into src to start copying diff --git a/utils/funcexp/func_rpad.cpp b/utils/funcexp/func_rpad.cpp index a2a538ff3..e7cfe04ef 100644 --- a/utils/funcexp/func_rpad.cpp +++ b/utils/funcexp/func_rpad.cpp @@ -52,14 +52,12 @@ std::string Func_rpad::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (src.isNull() || src.length() < 1) return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); @@ -82,18 +80,18 @@ std::string Func_rpad::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN } // The pad characters. - const string* pad = &fPad; + string pad = fPad; if (fp.size() > 2) { - pad = &fp[2]->data()->getStrVal(row, isNull); + pad = fp[2]->data()->getStrVal(row, isNull).safeString(""); } // binPLen represents the number of bytes in pad - size_t binPLen = pad->length(); - const char* posP = pad->c_str(); + size_t binPLen = pad.length(); + const char* posP = pad.c_str(); // plen = the number of characters in pad size_t plen = cs->numchars(posP, posP + binPLen); if (plen == 0) - return src; + return src.safeString(""); size_t byteCount = (padLength + 1) * cs->mbmaxlen; // absolute maximun number of bytes char* buf = new char[byteCount]; diff --git a/utils/funcexp/func_rtrim.cpp b/utils/funcexp/func_rtrim.cpp index ee61906b4..d5f439cf5 100644 --- a/utils/funcexp/func_rtrim.cpp +++ b/utils/funcexp/func_rtrim.cpp @@ -48,27 +48,25 @@ std::string Func_rtrim::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (src.isNull() || src.length() < 1) return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); // The trim characters. - const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull) : " "); + const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull).safeString("") : " "); // binTLen represents the number of bytes in trim size_t binTLen = trim.length(); const char* posT = trim.c_str(); // strTLen = the number of characters in trim size_t strTLen = cs->numchars(posT, posT + binTLen); if (strTLen == 0 || strTLen > strLen) - return src; + return src.safeString(""); if (binTLen == 1) { diff --git a/utils/funcexp/func_rtrim_oracle.cpp b/utils/funcexp/func_rtrim_oracle.cpp index 93713e113..0b4207910 100644 --- a/utils/funcexp/func_rtrim_oracle.cpp +++ b/utils/funcexp/func_rtrim_oracle.cpp @@ -48,27 +48,31 @@ std::string Func_rtrim_oracle::getStrVal(rowgroup::Row& row, FunctionParm& fp, b { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (src.isNull() || src.length() < 1) + { + isNull = true; return ""; - if (src.empty() || src.length() == 0) - return src; + } // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); // The trim characters. - const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull) : " "); + const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull).safeString("") : " "); // binTLen represents the number of bytes in trim size_t binTLen = trim.length(); const char* posT = trim.c_str(); // strTLen = the number of characters in trim size_t strTLen = cs->numchars(posT, posT + binTLen); if (strTLen == 0 || strTLen > strLen) - return src; + { + isNull = src.length() < 1; + return src.safeString(""); + } if (binTLen == 1) { diff --git a/utils/funcexp/func_sha.cpp b/utils/funcexp/func_sha.cpp index 944551eb5..4603c09ed 100644 --- a/utils/funcexp/func_sha.cpp +++ b/utils/funcexp/func_sha.cpp @@ -628,7 +628,7 @@ string Func_sha::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, // Input is always treated as sring sha.Reset(); - sha << parm[0]->data()->getStrVal(row, isNull).c_str(); + sha << parm[0]->data()->getStrVal(row, isNull).safeString("").c_str(); // can not compute if (!sha.Result(message_digest)) diff --git a/utils/funcexp/func_space.cpp b/utils/funcexp/func_space.cpp index 9a9a85789..38136f9ad 100644 --- a/utils/funcexp/func_space.cpp +++ b/utils/funcexp/func_space.cpp @@ -49,7 +49,10 @@ std::string Func_space::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is int64_t count = fp[0]->data()->getIntVal(row, isNull); if (isNull || count < 1) + { + isNull = true; return ""; + } string result(count, ' '); diff --git a/utils/funcexp/func_str_to_date.cpp b/utils/funcexp/func_str_to_date.cpp index ab0fb4f61..f3caf3921 100644 --- a/utils/funcexp/func_str_to_date.cpp +++ b/utils/funcexp/func_str_to_date.cpp @@ -55,7 +55,7 @@ dataconvert::DateTime getDateTime(rowgroup::Row& row, FunctionParm& parm, bool& dateTime.msecond = 0; int64_t val = 0; string valStr; - const string& formatStr = parm[1]->data()->getStrVal(row, isNull); + const auto& formatStr = parm[1]->data()->getStrVal(row, isNull).safeString(""); int rc = 0; switch (parm[0]->data()->resultType().colDataType) @@ -109,7 +109,7 @@ dataconvert::DateTime getDateTime(rowgroup::Row& row, FunctionParm& parm, bool& case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::VARCHAR: { - const string& valref = parm[0]->data()->getStrVal(row, isNull); + const string& valref = parm[0]->data()->getStrVal(row, isNull).safeString(""); // decode with provided format rc = extractor.extractTime(valref, formatStr, dateTime); diff --git a/utils/funcexp/func_strcmp.cpp b/utils/funcexp/func_strcmp.cpp index 63b3b0b22..57b60a39b 100644 --- a/utils/funcexp/func_strcmp.cpp +++ b/utils/funcexp/func_strcmp.cpp @@ -52,10 +52,11 @@ int64_t Func_strcmp::getIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNul execplan::CalpontSystemCatalog::ColType& type) { CHARSET_INFO* cs = fp[0]->data()->resultType().getCharset(); - const string& str = fp[0]->data()->getStrVal(row, isNull); - const string& str1 = fp[1]->data()->getStrVal(row, isNull); + const auto& str = fp[0]->data()->getStrVal(row, isNull); + const auto& str1 = fp[1]->data()->getStrVal(row, isNull); - int ret = cs->strnncollsp(str.c_str(), str.length(), str1.c_str(), str1.length()); + // XXX: str() results may be nullptrs. + int ret = cs->strnncollsp(str.str(), str.length(), str1.str(), str1.length()); // mysql's strcmp returns only -1, 0, and 1 return (ret < 0 ? -1 : (ret > 0 ? 1 : 0)); } diff --git a/utils/funcexp/func_substr.cpp b/utils/funcexp/func_substr.cpp index 9a39a4f10..1ef499fb5 100644 --- a/utils/funcexp/func_substr.cpp +++ b/utils/funcexp/func_substr.cpp @@ -48,11 +48,11 @@ std::string Func_substr::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i { CHARSET_INFO* cs = ct.getCharset(); - const string& str = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& str = fp[0]->data()->getStrVal(row, isNull); + if (str.isNull()) return ""; int64_t strLen = str.length(); - const char* strptr = str.c_str(); + const char* strptr = str.str(); const char* strend = strptr + strLen; uint32_t strChars = cs->numchars(strptr, strend); @@ -89,7 +89,7 @@ std::string Func_substr::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& i return ""; if (start == 0 && strLen == length) - return str; + return str.safeString(""); length = std::min(length, strLen - start); diff --git a/utils/funcexp/func_substring_index.cpp b/utils/funcexp/func_substring_index.cpp index 82f94a7ee..f7a77458f 100644 --- a/utils/funcexp/func_substring_index.cpp +++ b/utils/funcexp/func_substring_index.cpp @@ -48,14 +48,16 @@ std::string Func_substring_index::getStrVal(rowgroup::Row& row, FunctionParm& fp { CHARSET_INFO* cs = ct.getCharset(); - const string& str = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& nstr = fp[0]->data()->getStrVal(row, isNull); + if (nstr.isNull()) return ""; + const auto& str = nstr.unsafeStringRef(); int64_t strLen = str.length(); - const string& delimstr = fp[1]->data()->getStrVal(row, isNull); - if (isNull) + const auto& ndelimstr = fp[1]->data()->getStrVal(row, isNull); + if (ndelimstr.isNull()) return ""; + const auto& delimstr = ndelimstr.unsafeStringRef(); int64_t delimLen = delimstr.length(); int64_t count = fp[2]->data()->getIntVal(row, isNull); diff --git a/utils/funcexp/func_time_format.cpp b/utils/funcexp/func_time_format.cpp index 1205e21ba..c2d3c7663 100644 --- a/utils/funcexp/func_time_format.cpp +++ b/utils/funcexp/func_time_format.cpp @@ -152,19 +152,22 @@ string Func_time_format::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& default: isNull = true; return ""; } - const string& format = parm[1]->data()->getStrVal(row, isNull); + const auto& format = parm[1]->data()->getStrVal(row, isNull); char* ptr = buf; for (uint32_t i = 0; i < format.length(); i++) { - if (format[i] != '%') - *ptr++ = format[i]; + char fi = format.unsafeStringRef()[i]; + if (fi != '%') + *ptr++ = fi; else { i++; - switch (format[i]) + fi = format.unsafeStringRef()[i]; + + switch (fi) { case 'f': sprintf(ptr, "%06d", msec); diff --git a/utils/funcexp/func_time_to_sec.cpp b/utils/funcexp/func_time_to_sec.cpp index 3cf718aa2..5a010f20c 100644 --- a/utils/funcexp/func_time_to_sec.cpp +++ b/utils/funcexp/func_time_to_sec.cpp @@ -100,9 +100,9 @@ int64_t Func_time_to_sec::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::VARCHAR: { - std::string strVal = parm[0]->data()->getStrVal(row, isNull); + std::string strVal = parm[0]->data()->getStrVal(row, isNull).safeString(""); - if (strVal[0] == '-') + if (strVal.length() > 0 && strVal[0] == '-') { bIsNegative = true; strVal.replace(0, 1, 1, ' '); diff --git a/utils/funcexp/func_timediff.cpp b/utils/funcexp/func_timediff.cpp index 030004761..bed01600a 100644 --- a/utils/funcexp/func_timediff.cpp +++ b/utils/funcexp/func_timediff.cpp @@ -163,7 +163,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& is case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: - text = parm[0]->data()->getStrVal(row, isNull); + text = parm[0]->data()->getStrVal(row, isNull).safeString(""); if (text.length() >= 12) // datetime has length at least 12 (YYMMDDHHMMSS), convert others to time { @@ -181,7 +181,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& is case execplan::CalpontSystemCatalog::MEDINT: case execplan::CalpontSystemCatalog::TINYINT: case execplan::CalpontSystemCatalog::SMALLINT: - text = parm[0]->data()->getStrVal(row, isNull); + text = parm[0]->data()->getStrVal(row, isNull).safeString(""); if (treatIntAsDatetime(text)) val1 = dataconvert::DataConvert::intToDatetime(parm[0]->data()->getIntVal(row, isNull), &isDate1); else @@ -200,7 +200,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& is } else { - text = parm[0]->data()->getStrVal(row, isNull); + text = parm[0]->data()->getStrVal(row, isNull).safeString(""); if (treatIntAsDatetime(text)) val1 = dataconvert::DataConvert::intToDatetime(parm[0]->data()->getIntVal(row, isNull), &isDate1); else @@ -250,7 +250,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& is case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: - text = parm[1]->data()->getStrVal(row, isNull); + text = parm[1]->data()->getStrVal(row, isNull).safeString(""); if (text.length() >= 12) // datetime has length at least 12 (YYMMDDHHMMSS), convert others to time { val2 = dataconvert::DataConvert::stringToDatetime(text, &isDate2); @@ -267,7 +267,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& is case execplan::CalpontSystemCatalog::MEDINT: case execplan::CalpontSystemCatalog::TINYINT: case execplan::CalpontSystemCatalog::SMALLINT: - text = parm[1]->data()->getStrVal(row, isNull); + text = parm[1]->data()->getStrVal(row, isNull).safeString(""); if (treatIntAsDatetime(text)) val2 = dataconvert::DataConvert::intToDatetime(parm[1]->data()->getIntVal(row, isNull), &isDate2); else @@ -286,7 +286,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& is } else { - text = parm[1]->data()->getStrVal(row, isNull); + text = parm[1]->data()->getStrVal(row, isNull).safeString(""); if (treatIntAsDatetime(text)) val2 = dataconvert::DataConvert::intToDatetime(parm[1]->data()->getIntVal(row, isNull), &isDate2); else diff --git a/utils/funcexp/func_to_days.cpp b/utils/funcexp/func_to_days.cpp index d6f831be1..ef0d17fe2 100644 --- a/utils/funcexp/func_to_days.cpp +++ b/utils/funcexp/func_to_days.cpp @@ -114,10 +114,10 @@ int64_t Func_to_days::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& is case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::TEXT: { - const string& value = parm[0]->data()->getStrVal(row, isNull); + const auto& value = parm[0]->data()->getStrVal(row, isNull); int64_t val = 0; - if (value.size() == 10) + if (value.length() == 10) { // date type val = dataconvert::DataConvert::dateToInt(value); diff --git a/utils/funcexp/func_trim.cpp b/utils/funcexp/func_trim.cpp index d47823563..0705a7dcc 100644 --- a/utils/funcexp/func_trim.cpp +++ b/utils/funcexp/func_trim.cpp @@ -48,27 +48,25 @@ std::string Func_trim::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isN { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (src.isNull() || src.length() < 1) return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); // The trim characters. - const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull) : " "); + const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull).safeString("") : " "); // binTLen represents the number of bytes in trim size_t binTLen = trim.length(); const char* posT = trim.c_str(); // strTLen = the number of characters in trim size_t strTLen = cs->numchars(posT, posT + binTLen); if (strTLen == 0 || strTLen > strLen) - return src; + return src.safeString(""); if (binTLen == 1) { diff --git a/utils/funcexp/func_trim_oracle.cpp b/utils/funcexp/func_trim_oracle.cpp index 4daec213f..d8240a282 100644 --- a/utils/funcexp/func_trim_oracle.cpp +++ b/utils/funcexp/func_trim_oracle.cpp @@ -42,27 +42,25 @@ std::string Func_trim_oracle::getStrVal(rowgroup::Row& row, FunctionParm& fp, bo { CHARSET_INFO* cs = type.getCharset(); // The original string - const string& src = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + const auto& src = fp[0]->data()->getStrVal(row, isNull); + if (src.isNull() || src.length() < 1) return ""; - if (src.empty() || src.length() == 0) - return src; // binLen represents the number of bytes in src size_t binLen = src.length(); - const char* pos = src.c_str(); + const char* pos = src.str(); const char* end = pos + binLen; // strLen = the number of characters in src size_t strLen = cs->numchars(pos, end); // The trim characters. - const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull) : " "); + const string& trim = (fp.size() > 1 ? fp[1]->data()->getStrVal(row, isNull).safeString("") : " "); // binTLen represents the number of bytes in trim size_t binTLen = trim.length(); const char* posT = trim.c_str(); // strTLen = the number of characters in trim size_t strTLen = cs->numchars(posT, posT + binTLen); if (strTLen == 0 || strTLen > strLen) - return src; + return src.safeString(""); if (binTLen == 1) { diff --git a/utils/funcexp/func_ucase.cpp b/utils/funcexp/func_ucase.cpp index 578ad5e07..815bb2194 100644 --- a/utils/funcexp/func_ucase.cpp +++ b/utils/funcexp/func_ucase.cpp @@ -55,9 +55,9 @@ CalpontSystemCatalog::ColType Func_ucase::operationType(FunctionParm& fp, std::string Func_ucase::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& colType) { - const string& tstr = fp[0]->data()->getStrVal(row, isNull); + const auto& tstr = fp[0]->data()->getStrVal(row, isNull); - if (isNull) + if (tstr.isNull()) return ""; CHARSET_INFO* cs = colType.getCharset(); @@ -65,7 +65,7 @@ std::string Func_ucase::getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& is uint64_t bufLen = inLen * cs->caseup_multiply; char* outBuf = new char[bufLen]; - uint64_t outLen = cs->caseup(tstr.c_str(), inLen, outBuf, bufLen); + uint64_t outLen = cs->caseup(tstr.str(), inLen, outBuf, bufLen); string ret = string(outBuf, outLen); delete[] outBuf; diff --git a/utils/funcexp/func_unhex.cpp b/utils/funcexp/func_unhex.cpp index 92ef5fa3e..c950bb005 100644 --- a/utils/funcexp/func_unhex.cpp +++ b/utils/funcexp/func_unhex.cpp @@ -68,11 +68,13 @@ CalpontSystemCatalog::ColType Func_unhex::operationType(FunctionParm& fp, string Func_unhex::getStrVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull, CalpontSystemCatalog::ColType& op_ct) { - const string& from = parm[0]->data()->getStrVal(row, isNull); + const auto& nfrom = parm[0]->data()->getStrVal(row, isNull); - if (isNull) + if (nfrom.isNull()) return ""; + const auto& from = nfrom.unsafeStringRef(); + char* to = new char[2 + from.size() / 2]; uint64_t from_pos = 0, to_pos = 0; diff --git a/utils/funcexp/funcexp.cpp b/utils/funcexp/funcexp.cpp index 1a544b962..b07fdf27c 100644 --- a/utils/funcexp/funcexp.cpp +++ b/utils/funcexp/funcexp.cpp @@ -361,10 +361,14 @@ void FuncExp::evaluate(rowgroup::Row& row, std::vector& expressi case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: { - const std::string& val = expression[i]->getStrVal(row, isNull); + const utils::NullString& val = expression[i]->getStrVal(row, isNull); + // XXX: TODO: we may as well set the string field directly. if (isNull) - row.setStringField(CPNULLSTRMARK, expression[i]->outputIndex()); + { + utils::NullString nullstr; + row.setStringField(nullstr, expression[i]->outputIndex()); + } else row.setStringField(val, expression[i]->outputIndex()); diff --git a/utils/funcexp/functor.h b/utils/funcexp/functor.h index 1cc73879f..485c94e92 100644 --- a/utils/funcexp/functor.h +++ b/utils/funcexp/functor.h @@ -37,6 +37,8 @@ #include "dataconvert.h" +#include "nullstring.h" + namespace rowgroup { class Row; @@ -106,6 +108,18 @@ class Func virtual std::string getStrVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) = 0; + utils::NullString getNullStrVal(rowgroup::Row& row, FunctionParm& fp, + execplan::CalpontSystemCatalog::ColType& op_ct) + { + bool isNull; + std::string val = getStrVal(row, fp, isNull, op_ct); + utils::NullString result; + if (!isNull) + { + result.assign(val); + } + return result; + } virtual execplan::IDB_Decimal getDecimalVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) diff --git a/utils/funcexp/functor_json.h b/utils/funcexp/functor_json.h index bd60c1043..109fba0bc 100644 --- a/utils/funcexp/functor_json.h +++ b/utils/funcexp/functor_json.h @@ -434,7 +434,7 @@ class Func_json_contains : public Func_Bool JSONPath path; bool arg2Const; bool arg2Parsed; // argument 2 is a constant or has been parsed - std::string_view arg2Val; + utils::NullString arg2Val; public: Func_json_contains() : Func_Bool("json_contains"), arg2Const(false), arg2Parsed(false), arg2Val("") @@ -640,7 +640,7 @@ class Func_json_search : public Func_Str execplan::CalpontSystemCatalog::ColType& type); private: - int cmpJSValWild(json_engine_t* jsEg, const string_view& cmpStr, const CHARSET_INFO* cs); + int cmpJSValWild(json_engine_t* jsEg, const utils::NullString& cmpStr, const CHARSET_INFO* cs); }; /** @brief Func_json_extract_string class */ diff --git a/utils/funcexp/functor_str.h b/utils/funcexp/functor_str.h index 37657b0f3..b2fbe0933 100644 --- a/utils/funcexp/functor_str.h +++ b/utils/funcexp/functor_str.h @@ -79,28 +79,28 @@ class Func_Str : public Func int32_t getDateIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - std::string str = getStrVal(row, fp, isNull, op_ct); + auto str = getStrVal(row, fp, isNull, op_ct); return (isNull ? 0 : stringToDate(str)); } int64_t getDatetimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - std::string str = getStrVal(row, fp, isNull, op_ct); + auto str = getStrVal(row, fp, isNull, op_ct); return (isNull ? 0 : stringToDatetime(str)); } int64_t getTimestampIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - std::string str = getStrVal(row, fp, isNull, op_ct); + auto str = getStrVal(row, fp, isNull, op_ct); return (isNull ? 0 : stringToTimestamp(str, op_ct.getTimeZone())); } int64_t getTimeIntVal(rowgroup::Row& row, FunctionParm& fp, bool& isNull, execplan::CalpontSystemCatalog::ColType& op_ct) { - std::string str = getStrVal(row, fp, isNull, op_ct); + auto str = getStrVal(row, fp, isNull, op_ct); return (isNull ? 0 : stringToTime(str)); } @@ -125,11 +125,16 @@ class Func_Str : public Func case execplan::CalpontSystemCatalog::FLOAT: floatVal = fp->data()->getFloatVal(row, isNull); break; default: - fFloatStr = fp->data()->getStrVal(row, isNull); + fFloatStr = fp->data()->getStrVal(row, isNull).safeString(""); return; break; } + if (isNull) + { + return; + } + exponent = (int)floor(log10(fabsl(floatVal))); base = floatVal * pow(10, -1.0 * exponent); diff --git a/utils/funcexp/jsonhelpers.cpp b/utils/funcexp/jsonhelpers.cpp index fab5bcc16..042a3f33a 100644 --- a/utils/funcexp/jsonhelpers.cpp +++ b/utils/funcexp/jsonhelpers.cpp @@ -5,9 +5,9 @@ namespace funcexp { namespace helpers { -int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const string_view& str, bool wildcards = true) +int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const utils::NullString& str, bool wildcards = true) { - int err = json_path_setup(path, cs, (const uchar*)str.data(), (const uchar*)str.data() + str.size()); + int err = json_path_setup(path, cs, (const uchar*)str.str(), (const uchar*)str.end()); if (wildcards) return err; @@ -25,10 +25,10 @@ int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const string_view& str, boo return 1; } -bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const string_view& js, const CHARSET_INFO* jsCS) +bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const utils::NullString& js, const CHARSET_INFO* jsCS) { - const int jsLen = js.size(); - const char* rawJS = js.data(); + const int jsLen = js.length(); + const char* rawJS = js.str(); int strLen = jsLen * 12 * jsCS->mbmaxlen / jsCS->mbminlen; char* buf = (char*)alloca(strLen); if ((strLen = json_escape(retCS, (const uchar*)rawJS, (const uchar*)rawJS + jsLen, jsCS, (uchar*)buf, @@ -45,7 +45,7 @@ bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const string_view& bool appendJSKeyName(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm) { bool nullVal = false; - const string_view js = parm->data()->getStrVal(row, nullVal); + const auto& js = parm->data()->getStrVal(row, nullVal); if (nullVal) { ret.append("\"\": "); @@ -62,7 +62,7 @@ bool appendJSKeyName(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, bool appendJSValue(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm) { bool nullVal = false; - const string_view js = parm->data()->getStrVal(row, nullVal); + const auto& js = parm->data()->getStrVal(row, nullVal); if (nullVal) { ret.append("null"); @@ -72,7 +72,7 @@ bool appendJSValue(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, e datatypes::SystemCatalog::ColDataType dataType = parm->data()->resultType().colDataType; if (dataType == datatypes::SystemCatalog::BIGINT && (js == "true" || js == "false")) { - ret.append(js); + ret.append(js.safeString("")); return false; } @@ -344,7 +344,7 @@ int parseJSPath(JSONPath& path, rowgroup::Row& row, execplan::SPTP& parm, bool w markConstFlag(path, parm); bool isNull = false; - const string_view jsp = parm->data()->getStrVal(row, isNull); + const auto& jsp = parm->data()->getStrVal(row, isNull); if (isNull || setupJSPath(&path.p, getCharset(parm), jsp, wildcards)) return 1; @@ -372,3 +372,4 @@ bool matchJSPath(const vector& paths, const json_path_t* p, j } } // namespace helpers } // namespace funcexp + diff --git a/utils/funcexp/jsonhelpers.h b/utils/funcexp/jsonhelpers.h index 1615d7dfc..ca8b62a66 100644 --- a/utils/funcexp/jsonhelpers.h +++ b/utils/funcexp/jsonhelpers.h @@ -2,14 +2,13 @@ #include #include -#include #include #define PREFER_MY_CONFIG_H #include #include #include -#include +//#include #include "collation.h" #include "functor_json.h" @@ -20,6 +19,8 @@ #include "functioncolumn.h" #include "constantcolumn.h" +#include "json_lib.h" + namespace funcexp { namespace helpers @@ -34,7 +35,7 @@ static const int NO_WILDCARD_ALLOWED = 1; int setupJSPath(json_path_t* path, CHARSET_INFO* cs, const string_view& str, bool wildcards); // Return true if err occur, let the outer function handle the exception -bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const string_view& js, const CHARSET_INFO* jsCS); +bool appendEscapedJS(string& ret, const CHARSET_INFO* retCS, const utils::NullString& js, const CHARSET_INFO* jsCS); bool appendJSKeyName(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm); bool appendJSValue(string& ret, const CHARSET_INFO* retCS, rowgroup::Row& row, execplan::SPTP& parm); @@ -87,9 +88,9 @@ inline const CHARSET_INFO* getCharset(execplan::SPTP& parm) return parm->data()->resultType().getCharset(); } -inline void initJSEngine(json_engine_t& jsEg, const CHARSET_INFO* jsCS, const string_view& js) +inline void initJSEngine(json_engine_t& jsEg, const CHARSET_INFO* jsCS, const utils::NullString& js) { - json_scan_start(&jsEg, jsCS, (const uchar*)js.data(), (const uchar*)js.data() + js.size()); + json_scan_start(&jsEg, jsCS, (const uchar*)js.str(), (const uchar*)js.end()); } int parseJSPath(JSONPath& path, rowgroup::Row& row, execplan::SPTP& parm, bool wildcards = true); diff --git a/utils/messageqcpp/bytestream.cpp b/utils/messageqcpp/bytestream.cpp index 828c92969..ffcae5dab 100644 --- a/utils/messageqcpp/bytestream.cpp +++ b/utils/messageqcpp/bytestream.cpp @@ -298,6 +298,16 @@ ByteStream& ByteStream::operator<<(const string& s) return *this; } +ByteStream& ByteStream::operator<<(const utils::NullString& s) +{ + uint8_t isNull = s.isNull(); + (*this) << isNull; + if (!isNull) + { + (*this) << s.unsafeStringRef(); + } + return *this; +} ByteStream& ByteStream::operator>>(int8_t& b) { @@ -376,6 +386,24 @@ ByteStream& ByteStream::operator>>(string& s) return *this; } +ByteStream& ByteStream::operator>>(utils::NullString& s) +{ + uint8_t isNull; + (*this) >> isNull; + if (isNull) + { + s = utils::NullString(); + } + else + { + string t; + (*this) >> t; + s = utils::NullString(t); + } + return *this; +} + + ByteStream& ByteStream::operator>>(uint8_t*& bpr) { peek(bpr); diff --git a/utils/messageqcpp/bytestream.h b/utils/messageqcpp/bytestream.h index 02a4cd645..fd5c32f5b 100644 --- a/utils/messageqcpp/bytestream.h +++ b/utils/messageqcpp/bytestream.h @@ -36,6 +36,7 @@ #include "exceptclasses.h" #include "serializeable.h" #include "any.hpp" +#include "nullstring.h" class ByteStreamTestSuite; @@ -158,6 +159,10 @@ class ByteStream : public Serializeable * push a std::string onto the end of the stream. */ EXPORT ByteStream& operator<<(const std::string& s); + /** + * push a NullString onto the end of the stream. + */ + EXPORT ByteStream& operator<<(const utils::NullString& s); /** * push an arbitrary class onto the end of the stream. */ @@ -231,6 +236,10 @@ class ByteStream : public Serializeable * extract a std::string from the front of the stream. */ EXPORT ByteStream& operator>>(std::string& s); + /** + * extract a NullString from the front of the stream. + */ + EXPORT ByteStream& operator>>(utils::NullString& s); /** * write the current stream into b. The ByteStream will be empty after this operation. * @warning the caller is responsible for making sure b is big enough to hold all the data (perhaps by diff --git a/utils/regr/moda.cpp b/utils/regr/moda.cpp index ce4c9a5d2..4dbb12674 100644 --- a/utils/regr/moda.cpp +++ b/utils/regr/moda.cpp @@ -532,11 +532,16 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::nextValue(mcsv1Context* context, Col return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - string val; + utils::NullString val; if (valIn.compatible(strTypeId)) - val = valIn.cast(); + val = valIn.cast(); - (*map)[val]++; + if (val.isNull()) + { + return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. + } + + (*map)[val.safeString("")]++; return mcsv1_UDAF::SUCCESS; } @@ -572,7 +577,7 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::evaluate(mcsv1Context* context, stat if (map->size() == 0) { - valOut = string(); + valOut = utils::NullString(); return mcsv1_UDAF::SUCCESS; } @@ -601,7 +606,8 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::evaluate(mcsv1Context* context, stat if (context->getScale() > 0) context->setResultType(execplan::CalpontSystemCatalog::DECIMAL); - valOut = val; + utils::NullString ns(val); + valOut = ns; return mcsv1_UDAF::SUCCESS; } @@ -616,6 +622,7 @@ mcsv1_UDAF::ReturnCode Moda_impl_T::dropValue(mcsv1Context* context, Col return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } + idbassert(0 && "incorrect logic - does not account for NullString"); string val = convertAnyTo(valDropped); --data->fCount; diff --git a/utils/rowgroup/rowaggregation.cpp b/utils/rowgroup/rowaggregation.cpp index b66c403c3..9bfead6f1 100644 --- a/utils/rowgroup/rowaggregation.cpp +++ b/utils/rowgroup/rowaggregation.cpp @@ -220,16 +220,16 @@ inline long double getLongDoubleNullValue() return joblist::LONGDOUBLENULL; } -inline string getStringNullValue() +inline utils::NullString getStringNullValue() { - return joblist::CPNULLSTRMARK; + return utils::NullString(); } } // namespace namespace rowgroup { -const std::string typeStr; +const utils::NullString typeStr; const static_any::any& RowAggregation::charTypeId((char)1); const static_any::any& RowAggregation::scharTypeId((signed char)1); const static_any::any& RowAggregation::shortTypeId((short)1); @@ -305,15 +305,20 @@ inline void RowAggregation::updateFloatMinMax(float val1, float val2, int64_t co fRow.setFloatField(val1, col); } -void RowAggregation::updateStringMinMax(string val1, string val2, int64_t col, int func) +void RowAggregation::updateStringMinMax(utils::NullString val1, utils::NullString val2, int64_t col, int func) { if (isNull(fRowGroupOut, fRow, col)) { fRow.setStringField(val1, col); return; } + if (val1.isNull()) + { + // as any comparison with NULL is false, it should not affect min/max ranges. + return ; // do nothing. + } CHARSET_INFO* cs = fRow.getCharset(col); - int tmp = cs->strnncoll(val1.c_str(), val1.length(), val2.c_str(), val2.length()); + int tmp = cs->strnncoll(val1.str(), val1.length(), val2.str(), val2.length()); if ((tmp < 0 && func == rowgroup::ROWAGG_MIN) || (tmp > 0 && func == rowgroup::ROWAGG_MAX)) { @@ -354,11 +359,13 @@ inline bool RowAggregation::isNull(const RowGroup* pRowGroup, const Row& row, in { int colWidth = pRowGroup->getColumnWidth(col); + // XXX: this is wrong. NullStrings now contain separate NULL values. // bug 1853, use token to check null // scale here is used to indicate token, not real string. if ((pRowGroup->getScale())[col] > 0) { - if (row.getIntField(col) & joblist::BIGINTNULL) + uint64_t uintField = row.getUintField(col); + if (uintField == joblist::UBIGINTNULL) ret = true; // break the case block @@ -366,7 +373,7 @@ inline bool RowAggregation::isNull(const RowGroup* pRowGroup, const Row& row, in } // real string to check null - if (colWidth <= 8) + if (colWidth <= 7 || (colWidth == 8 && colDataType == execplan::CalpontSystemCatalog::CHAR)) { if (colWidth == 1) ret = ((uint8_t)row.getUintField(col) == joblist::CHAR1NULL); @@ -381,7 +388,7 @@ inline bool RowAggregation::isNull(const RowGroup* pRowGroup, const Row& row, in { //@bug 1821 auto const str = row.getConstString(col); - ret = str.length() == 0 || str.eq(utils::ConstString(joblist::CPNULLSTRMARK)); + ret = str.isNull(); } break; @@ -480,7 +487,7 @@ inline bool RowAggregation::isNull(const RowGroup* pRowGroup, const Row& row, in case execplan::CalpontSystemCatalog::BLOB: { auto const str = row.getConstString(col); - ret = str.length() == 0 || str.eq(utils::ConstString(joblist::CPNULLSTRMARK)); + ret = str.isNull(); break; } @@ -1165,8 +1172,8 @@ void RowAggregation::doMinMax(const Row& rowIn, int64_t colIn, int64_t colOut, i case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::TEXT: { - string valIn = rowIn.getStringField(colIn); - string valOut = fRow.getStringField(colOut); + auto valIn = rowIn.getStringField(colIn); + auto valOut = fRow.getStringField(colOut); updateStringMinMax(valIn, valOut, colOut, funcType); break; } @@ -1439,8 +1446,8 @@ void RowAggregation::doBitOp(const Row& rowIn, int64_t colIn, int64_t colOut, in case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::TEXT: { - string str = rowIn.getStringField(colIn); - valIn = strtoll(str.c_str(), nullptr, 10); + auto str = rowIn.getStringField(colIn); + valIn = strtoll(str.safeString("").c_str(), nullptr, 10); break; } @@ -2018,7 +2025,7 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, int cc = dynamic_cast(fFunctionCols[funcColsIdx]->fpConstCol.get()); } - if ((cc && cc->type() == execplan::ConstantColumn::NULLDATA) || + if ((cc && cc->isNull()) || (!cc && isNull(&fRowGroupIn, rowIn, colIn) == true)) { if (udafContextsColl[origFuncColsIdx].getRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS)) @@ -2255,7 +2262,6 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, int { datum.columnData = rowIn.getStringField(colIn); } - break; } @@ -2684,14 +2690,13 @@ void RowAggregationUM::SetUDAFValue(static_any::any& valOut, int64_t colOut) // Fields are initialized to NULL, which is what we want for empty; return; } - int64_t intOut; uint64_t uintOut; float floatOut; double doubleOut; long double longdoubleOut; ostringstream oss; - std::string strOut; + utils::NullString strOut; bool bSetSuccess = false; @@ -2843,10 +2848,11 @@ void RowAggregationUM::SetUDAFValue(static_any::any& valOut, int64_t colOut) case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::VARCHAR: case execplan::CalpontSystemCatalog::TEXT: + // XXX: check for empty valOut value? E.g., we can use nullptr inside any. if (valOut.compatible(strTypeId)) { - strOut = valOut.cast(); - fRow.setStringField(strOut, colOut); + utils::NullString s = valOut.cast(); + fRow.setStringField(s, colOut); bSetSuccess = true; } @@ -2857,7 +2863,7 @@ void RowAggregationUM::SetUDAFValue(static_any::any& valOut, int64_t colOut) case execplan::CalpontSystemCatalog::BLOB: if (valOut.compatible(strTypeId)) { - strOut = valOut.cast(); + strOut = valOut.cast(); fRow.setVarBinaryField(strOut, colOut); bSetSuccess = true; } @@ -2909,7 +2915,7 @@ void RowAggregationUM::SetUDAFAnyValue(static_any::any& valOut, int64_t colOut) long double longdoubleOut = 0.0; int128_t int128Out = 0; ostringstream oss; - std::string strOut; + utils::NullString strOut; if (valOut.compatible(charTypeId)) { @@ -3004,17 +3010,17 @@ void RowAggregationUM::SetUDAFAnyValue(static_any::any& valOut, int64_t colOut) if (valOut.compatible(strTypeId)) { - strOut = valOut.cast(); + strOut = valOut.cast(); // Convert the string to numeric type, just in case. - intOut = atol(strOut.c_str()); - uintOut = strtoul(strOut.c_str(), nullptr, 10); - doubleOut = strtod(strOut.c_str(), nullptr); - longdoubleOut = strtold(strOut.c_str(), nullptr); + intOut = atol(strOut.str()); + uintOut = strtoul(strOut.str(), nullptr, 10); + doubleOut = strtod(strOut.str(), nullptr); + longdoubleOut = strtold(strOut.str(), nullptr); int128Out = longdoubleOut; } else { - strOut = oss.str(); + strOut.assign(oss.str()); } switch (colDataType) @@ -3068,7 +3074,7 @@ void RowAggregationUM::SetUDAFAnyValue(static_any::any& valOut, int64_t colOut) case execplan::CalpontSystemCatalog::CHAR: case execplan::CalpontSystemCatalog::VARCHAR: - case execplan::CalpontSystemCatalog::TEXT: fRow.setStringField(strOut, colOut); break; + case execplan::CalpontSystemCatalog::TEXT: fRow.setStringField(strOut, colOut); break; case execplan::CalpontSystemCatalog::VARBINARY: case execplan::CalpontSystemCatalog::CLOB: @@ -3280,7 +3286,7 @@ void RowAggregationUM::fixConstantAggregate() { if (fFunctionCols[k]->fAggFunction == ROWAGG_CONSTANT) { - if (j->fIsNull || rowCnt == 0) + if (j->isNull() || rowCnt == 0) doNullConstantAggregate(*j, k); else doNotNullConstantAggregate(*j, k); @@ -3384,7 +3390,8 @@ void RowAggregationUM::doNullConstantAggregate(const ConstantAggData& aggData, u case execplan::CalpontSystemCatalog::TEXT: default: { - fRow.setStringField("", colOut); + utils::NullString nullstr; + fRow.setStringField(nullstr, colOut); } break; @@ -3483,7 +3490,8 @@ void RowAggregationUM::doNullConstantAggregate(const ConstantAggData& aggData, u default: { - fRow.setStringField("", colOut); + utils::NullString nullstr; + fRow.setStringField(nullstr, colOut); } break; } @@ -3515,7 +3523,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::INT: case execplan::CalpontSystemCatalog::BIGINT: { - fRow.setIntField(strtol(aggData.fConstValue.c_str(), nullptr, 10), colOut); + fRow.setIntField(strtol(aggData.fConstValue.safeString("").c_str(), nullptr, 10), colOut); } break; @@ -3526,7 +3534,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UBIGINT: { - fRow.setUintField(strtoul(aggData.fConstValue.c_str(), nullptr, 10), colOut); + fRow.setUintField(strtoul(aggData.fConstValue.safeString("").c_str(), nullptr, 10), colOut); } break; @@ -3545,7 +3553,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData } else if (width <= datatypes::MAXLEGACYWIDTH) { - double dbl = strtod(aggData.fConstValue.c_str(), 0); + double dbl = strtod(aggData.fConstValue.safeString("").c_str(), 0); auto scale = datatypes::scaleDivisor(fRowGroupOut->getScale()[i]); // TODO: isn't overflow possible below: fRow.setIntField((int64_t)(scale * dbl), colOut); @@ -3561,20 +3569,20 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::DOUBLE: case execplan::CalpontSystemCatalog::UDOUBLE: { - fRow.setDoubleField(strtod(aggData.fConstValue.c_str(), nullptr), colOut); + fRow.setDoubleField(strtod(aggData.fConstValue.safeString("").c_str(), nullptr), colOut); } break; case execplan::CalpontSystemCatalog::LONGDOUBLE: { - fRow.setLongDoubleField(strtold(aggData.fConstValue.c_str(), nullptr), colOut); + fRow.setLongDoubleField(strtold(aggData.fConstValue.safeString("").c_str(), nullptr), colOut); } break; case execplan::CalpontSystemCatalog::FLOAT: case execplan::CalpontSystemCatalog::UFLOAT: { - fRow.setFloatField(strtof(aggData.fConstValue.c_str(), nullptr), colOut); + fRow.setFloatField(strtof(aggData.fConstValue.safeString("").c_str(), nullptr), colOut); } break; @@ -3624,7 +3632,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::INT: case execplan::CalpontSystemCatalog::BIGINT: { - int64_t constVal = strtol(aggData.fConstValue.c_str(), nullptr, 10); + int64_t constVal = strtol(aggData.fConstValue.safeString("").c_str(), nullptr, 10); if (constVal != 0) { @@ -3647,7 +3655,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UBIGINT: { - uint64_t constVal = strtoul(aggData.fConstValue.c_str(), nullptr, 10); + uint64_t constVal = strtoul(aggData.fConstValue.safeString("").c_str(), nullptr, 10); fRow.setUintField(constVal * rowCnt, colOut); } break; @@ -3672,7 +3680,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData } else if (width == datatypes::MAXLEGACYWIDTH) { - double dbl = strtod(aggData.fConstValue.c_str(), 0); + double dbl = strtod(aggData.fConstValue.safeString("").c_str(), 0); // TODO: isn't precision loss possible below? dbl *= datatypes::scaleDivisor(fRowGroupOut->getScale()[i]); dbl *= rowCnt; @@ -3694,14 +3702,14 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::DOUBLE: case execplan::CalpontSystemCatalog::UDOUBLE: { - double dbl = strtod(aggData.fConstValue.c_str(), nullptr) * rowCnt; + double dbl = strtod(aggData.fConstValue.safeString("").c_str(), nullptr) * rowCnt; fRow.setDoubleField(dbl, colOut); } break; case execplan::CalpontSystemCatalog::LONGDOUBLE: { - long double dbl = strtold(aggData.fConstValue.c_str(), nullptr) * rowCnt; + long double dbl = strtold(aggData.fConstValue.safeString("").c_str(), nullptr) * rowCnt; fRow.setLongDoubleField(dbl, colOut); } break; @@ -3710,7 +3718,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::UFLOAT: { double flt; - flt = strtof(aggData.fConstValue.c_str(), nullptr) * rowCnt; + flt = strtof(aggData.fConstValue.safeString("").c_str(), nullptr) * rowCnt; fRow.setFloatField(flt, colOut); } break; @@ -3725,7 +3733,8 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData default: { // will not be here, checked in tupleaggregatestep.cpp. - fRow.setStringField("", colOut); + utils::NullString nullstr; + fRow.setStringField(nullstr, colOut); } break; } @@ -3797,7 +3806,8 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::TEXT: default: { - fRow.setStringField(nullptr, colOut); + utils::NullString nullstr; + fRow.setStringField(nullstr, colOut); } break; } @@ -3819,7 +3829,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case ROWAGG_BIT_AND: case ROWAGG_BIT_OR: { - double dbl = strtod(aggData.fConstValue.c_str(), nullptr); + double dbl = strtod(aggData.fConstValue.safeString("").c_str(), nullptr); dbl += (dbl > 0) ? 0.5 : -0.5; int64_t intVal = (int64_t)dbl; fRow.setUintField(intVal, colOut); @@ -3867,7 +3877,7 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::INT: case execplan::CalpontSystemCatalog::BIGINT: { - datum.columnData = strtol(aggData.fConstValue.c_str(), nullptr, 10); + datum.columnData = strtol(aggData.fConstValue.safeString("").c_str(), nullptr, 10); } break; @@ -3877,14 +3887,14 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::UINT: case execplan::CalpontSystemCatalog::UBIGINT: { - datum.columnData = strtoul(aggData.fConstValue.c_str(), nullptr, 10); + datum.columnData = strtoul(aggData.fConstValue.safeString("").c_str(), nullptr, 10); } break; case execplan::CalpontSystemCatalog::DECIMAL: case execplan::CalpontSystemCatalog::UDECIMAL: { - double dbl = strtod(aggData.fConstValue.c_str(), 0); + double dbl = strtod(aggData.fConstValue.safeString("").c_str(), 0); // TODO: isn't overflow possible below? datum.columnData = (int64_t)(dbl * datatypes::scaleDivisor(fRowGroupOut->getScale()[i])); datum.scale = fRowGroupOut->getScale()[i]; @@ -3895,20 +3905,20 @@ void RowAggregationUM::doNotNullConstantAggregate(const ConstantAggData& aggData case execplan::CalpontSystemCatalog::DOUBLE: case execplan::CalpontSystemCatalog::UDOUBLE: { - datum.columnData = strtod(aggData.fConstValue.c_str(), nullptr); + datum.columnData = strtod(aggData.fConstValue.safeString("").c_str(), nullptr); } break; case execplan::CalpontSystemCatalog::LONGDOUBLE: { - datum.columnData = strtold(aggData.fConstValue.c_str(), nullptr); + datum.columnData = strtold(aggData.fConstValue.safeString("").c_str(), nullptr); } break; case execplan::CalpontSystemCatalog::FLOAT: case execplan::CalpontSystemCatalog::UFLOAT: { - datum.columnData = strtof(aggData.fConstValue.c_str(), nullptr); + datum.columnData = strtof(aggData.fConstValue.safeString("").c_str(), nullptr); } break; @@ -4000,7 +4010,8 @@ void RowAggregationUM::setGroupConcatString() uint8_t* gcString; joblist::GroupConcatAgUM* gccAg = *((joblist::GroupConcatAgUM**)buff); gcString = gccAg->getResult(); - fRow.setStringField((char*)gcString, fFunctionCols[j]->fOutputColumnIndex); + utils::ConstString str((char*)gcString, gcString ? strlen((const char*)gcString) : 0); + fRow.setStringField(str, fFunctionCols[j]->fOutputColumnIndex); // gccAg->getResult(buff); } @@ -4010,7 +4021,8 @@ void RowAggregationUM::setGroupConcatString() uint8_t* gcString; joblist::JsonArrayAggregatAgUM* gccAg = *((joblist::JsonArrayAggregatAgUM**)buff); gcString = gccAg->getResult(); - fRow.setStringField((char*)gcString, fFunctionCols[j]->fOutputColumnIndex); + utils::ConstString str((char*)gcString, gcString ? strlen((char*)gcString) : 0); + fRow.setStringField(str, fFunctionCols[j]->fOutputColumnIndex); } } } diff --git a/utils/rowgroup/rowaggregation.h b/utils/rowgroup/rowaggregation.h index 901c8eb3d..5e537e0cb 100644 --- a/utils/rowgroup/rowaggregation.h +++ b/utils/rowgroup/rowaggregation.h @@ -50,6 +50,7 @@ #include "resourcemanager.h" #include "rowstorage.h" +#include "nullstring.h" // To do: move code that depends on joblist to a proper subsystem. namespace joblist @@ -298,23 +299,26 @@ inline void RowUDAFFunctionCol::deserialize(messageqcpp::ByteStream& bs) struct ConstantAggData { - std::string fConstValue; + utils::NullString fConstValue; std::string fUDAFName; // If a UDAF is called with constant. RowAggFunctionType fOp; - bool fIsNull; - ConstantAggData() : fOp(ROWAGG_FUNCT_UNDEFINE), fIsNull(false) + ConstantAggData() : fOp(ROWAGG_FUNCT_UNDEFINE) { } - ConstantAggData(std::string v, RowAggFunctionType f, bool n) : fConstValue(std::move(v)), fOp(f), fIsNull(n) + ConstantAggData(utils::NullString v, RowAggFunctionType f, bool n) : fConstValue(v), fOp(f) { } - ConstantAggData(std::string v, std::string u, RowAggFunctionType f, bool n) - : fConstValue(std::move(v)), fUDAFName(std::move(u)), fOp(f), fIsNull(n) + ConstantAggData(utils::NullString v, std::string u, RowAggFunctionType f, bool n) + : fConstValue(v), fUDAFName(u), fOp(f) { } + bool isNull() const + { + return fConstValue.isNull(); + } }; typedef boost::shared_ptr SP_ROWAGG_GRPBY_t; @@ -326,7 +330,7 @@ struct GroupConcat std::vector> fGroupCols; // columns to concatenate, and position std::vector> fOrderCols; // columns to order by [asc/desc] std::string fSeparator; - std::vector> fConstCols; // constant columns in group + std::vector> fConstCols; // constant columns in group bool fDistinct; uint64_t fSize; @@ -354,7 +358,6 @@ class GroupConcatAg virtual void processRow(const rowgroup::Row&){}; virtual void merge(const rowgroup::Row&, uint64_t){}; - void getResult(uint8_t*){}; uint8_t* getResult() { return nullptr; @@ -563,7 +566,7 @@ class RowAggregation : public messageqcpp::Serializeable inline void updateDoubleMinMax(double val1, double val2, int64_t col, int func); inline void updateLongDoubleMinMax(long double val1, long double val2, int64_t col, int func); inline void updateFloatMinMax(float val1, float val2, int64_t col, int func); - inline void updateStringMinMax(std::string val1, std::string val2, int64_t col, int func); + inline void updateStringMinMax(utils::NullString val1, utils::NullString val2, int64_t col, int func); std::vector fGroupByCols; std::vector fFunctionCols; uint32_t fAggMapKeyCount; // the number of columns that make up the key diff --git a/utils/rowgroup/rowgroup.cpp b/utils/rowgroup/rowgroup.cpp index c9983ce1b..0f9826759 100644 --- a/utils/rowgroup/rowgroup.cpp +++ b/utils/rowgroup/rowgroup.cpp @@ -95,7 +95,7 @@ uint64_t StringStore::storeString(const uint8_t* data, uint32_t len) // if (len == 0) // return numeric_limits::max(); - if ((len == 8 || len == 9) && *((uint64_t*)data) == *((uint64_t*)joblist::CPNULLSTRMARK.c_str())) + if (!data) return numeric_limits::max(); //@bug6065, make StringStore::storeString() thread safe @@ -427,7 +427,6 @@ void RGData::deserialize(ByteStream& bs, uint32_t defAmount) uint8_t tmp8; bs.peek(sig); - if (sig == RGDATA_SIG) { bs >> sig; @@ -618,7 +617,7 @@ string Row::toCSV() const switch (types[i]) { case CalpontSystemCatalog::CHAR: - case CalpontSystemCatalog::VARCHAR: os << getStringField(i).c_str(); break; + case CalpontSystemCatalog::VARCHAR: os << getStringField(i).safeString(); break; case CalpontSystemCatalog::FLOAT: case CalpontSystemCatalog::UFLOAT: os << getFloatField(i); break; @@ -653,135 +652,139 @@ string Row::toCSV() const return os.str(); } +void Row::setToNull(uint32_t colIndex) +{ + setNullMark(colIndex, true); // mark as null. + switch (types[colIndex]) + { + case CalpontSystemCatalog::TINYINT: data[offsets[colIndex]] = joblist::TINYINTNULL; break; + + case CalpontSystemCatalog::SMALLINT: + *((int16_t*)&data[offsets[colIndex]]) = static_cast(joblist::SMALLINTNULL); + break; + + case CalpontSystemCatalog::MEDINT: + case CalpontSystemCatalog::INT: + *((int32_t*)&data[offsets[colIndex]]) = static_cast(joblist::INTNULL); + break; + + case CalpontSystemCatalog::FLOAT: + case CalpontSystemCatalog::UFLOAT: + *((int32_t*)&data[offsets[colIndex]]) = static_cast(joblist::FLOATNULL); + break; + + case CalpontSystemCatalog::DATE: + *((int32_t*)&data[offsets[colIndex]]) = static_cast(joblist::DATENULL); + break; + + case CalpontSystemCatalog::BIGINT: + if (precision[colIndex] != MagicPrecisionForCountAgg) + *((uint64_t*)&data[offsets[colIndex]]) = joblist::BIGINTNULL; + else // work around for count() in outer join result. + *((uint64_t*)&data[offsets[colIndex]]) = 0; + + break; + + case CalpontSystemCatalog::DOUBLE: + case CalpontSystemCatalog::UDOUBLE: *((uint64_t*)&data[offsets[colIndex]]) = joblist::DOUBLENULL; break; + + case CalpontSystemCatalog::LONGDOUBLE: + *((long double*)&data[offsets[colIndex]]) = joblist::LONGDOUBLENULL; + break; + + case CalpontSystemCatalog::DATETIME: *((uint64_t*)&data[offsets[colIndex]]) = joblist::DATETIMENULL; break; + + case CalpontSystemCatalog::TIMESTAMP: *((uint64_t*)&data[offsets[colIndex]]) = joblist::TIMESTAMPNULL; break; + + case CalpontSystemCatalog::TIME: *((uint64_t*)&data[offsets[colIndex]]) = joblist::TIMENULL; break; + + case CalpontSystemCatalog::VARBINARY: + case CalpontSystemCatalog::BLOB: + case CalpontSystemCatalog::CHAR: + case CalpontSystemCatalog::VARCHAR: + case CalpontSystemCatalog::TEXT: + case CalpontSystemCatalog::STRINT: + { + if (inStringTable(colIndex)) + { + utils::NullString nullstr; + setStringField(nullstr, colIndex); + break; + } + + uint32_t len = getColumnWidth(colIndex); + + switch (len) + { + case 1: data[offsets[colIndex]] = joblist::CHAR1NULL; break; + + case 2: *((uint16_t*)&data[offsets[colIndex]]) = joblist::CHAR2NULL; break; + + case 3: + case 4: *((uint32_t*)&data[offsets[colIndex]]) = joblist::CHAR4NULL; break; + + case 5: + case 6: + case 7: + case 8: *((uint64_t*)&data[offsets[colIndex]]) = joblist::CHAR8NULL; break; + + default: + setNullMark(colIndex, true); + break; + } + + break; + } + + case CalpontSystemCatalog::DECIMAL: + case CalpontSystemCatalog::UDECIMAL: + { + uint32_t len = getColumnWidth(colIndex); + + switch (len) + { + case 1: data[offsets[colIndex]] = joblist::TINYINTNULL; break; + + case 2: *((int16_t*)&data[offsets[colIndex]]) = static_cast(joblist::SMALLINTNULL); break; + + case 4: *((int32_t*)&data[offsets[colIndex]]) = static_cast(joblist::INTNULL); break; + + case 16: + { + int128_t* s128ValuePtr = (int128_t*)(&data[offsets[colIndex]]); + datatypes::TSInt128::storeUnaligned(s128ValuePtr, datatypes::Decimal128Null); + } + break; + default: *((int64_t*)&data[offsets[colIndex]]) = static_cast(joblist::BIGINTNULL); break; + } + + break; + } + + case CalpontSystemCatalog::UTINYINT: data[offsets[colIndex]] = joblist::UTINYINTNULL; break; + + case CalpontSystemCatalog::USMALLINT: *((uint16_t*)&data[offsets[colIndex]]) = joblist::USMALLINTNULL; break; + + case CalpontSystemCatalog::UMEDINT: + case CalpontSystemCatalog::UINT: *((uint32_t*)&data[offsets[colIndex]]) = joblist::UINTNULL; break; + + case CalpontSystemCatalog::UBIGINT: *((uint64_t*)&data[offsets[colIndex]]) = joblist::UBIGINTNULL; break; + + default: + ostringstream os; + os << "Row::initToNull(): got bad column type (" << types[colIndex] << "). Width=" << getColumnWidth(colIndex) + << endl; + os << toString(); + throw logic_error(os.str()); + } +} void Row::initToNull() { uint32_t i; for (i = 0; i < columnCount; i++) { - switch (types[i]) - { - case CalpontSystemCatalog::TINYINT: data[offsets[i]] = joblist::TINYINTNULL; break; - - case CalpontSystemCatalog::SMALLINT: - *((int16_t*)&data[offsets[i]]) = static_cast(joblist::SMALLINTNULL); - break; - - case CalpontSystemCatalog::MEDINT: - case CalpontSystemCatalog::INT: - *((int32_t*)&data[offsets[i]]) = static_cast(joblist::INTNULL); - break; - - case CalpontSystemCatalog::FLOAT: - case CalpontSystemCatalog::UFLOAT: - *((int32_t*)&data[offsets[i]]) = static_cast(joblist::FLOATNULL); - break; - - case CalpontSystemCatalog::DATE: - *((int32_t*)&data[offsets[i]]) = static_cast(joblist::DATENULL); - break; - - case CalpontSystemCatalog::BIGINT: - if (precision[i] != MagicPrecisionForCountAgg) - *((uint64_t*)&data[offsets[i]]) = joblist::BIGINTNULL; - else // work around for count() in outer join result. - *((uint64_t*)&data[offsets[i]]) = 0; - - break; - - case CalpontSystemCatalog::DOUBLE: - case CalpontSystemCatalog::UDOUBLE: *((uint64_t*)&data[offsets[i]]) = joblist::DOUBLENULL; break; - - case CalpontSystemCatalog::LONGDOUBLE: - *((long double*)&data[offsets[i]]) = joblist::LONGDOUBLENULL; - break; - - case CalpontSystemCatalog::DATETIME: *((uint64_t*)&data[offsets[i]]) = joblist::DATETIMENULL; break; - - case CalpontSystemCatalog::TIMESTAMP: *((uint64_t*)&data[offsets[i]]) = joblist::TIMESTAMPNULL; break; - - case CalpontSystemCatalog::TIME: *((uint64_t*)&data[offsets[i]]) = joblist::TIMENULL; break; - - case CalpontSystemCatalog::CHAR: - case CalpontSystemCatalog::VARCHAR: - case CalpontSystemCatalog::TEXT: - case CalpontSystemCatalog::STRINT: - { - if (inStringTable(i)) - { - setStringField(joblist::CPNULLSTRMARK, i); - break; - } - - uint32_t len = getColumnWidth(i); - - switch (len) - { - case 1: data[offsets[i]] = joblist::CHAR1NULL; break; - - case 2: *((uint16_t*)&data[offsets[i]]) = joblist::CHAR2NULL; break; - - case 3: - case 4: *((uint32_t*)&data[offsets[i]]) = joblist::CHAR4NULL; break; - - case 5: - case 6: - case 7: - case 8: *((uint64_t*)&data[offsets[i]]) = joblist::CHAR8NULL; break; - - default: - *((uint64_t*)&data[offsets[i]]) = *((uint64_t*)joblist::CPNULLSTRMARK.c_str()); - memset(&data[offsets[i] + 8], 0, len - 8); - break; - } - - break; - } - - case CalpontSystemCatalog::VARBINARY: - case CalpontSystemCatalog::BLOB: *((uint16_t*)&data[offsets[i]]) = 0; break; - - case CalpontSystemCatalog::DECIMAL: - case CalpontSystemCatalog::UDECIMAL: - { - uint32_t len = getColumnWidth(i); - - switch (len) - { - case 1: data[offsets[i]] = joblist::TINYINTNULL; break; - - case 2: *((int16_t*)&data[offsets[i]]) = static_cast(joblist::SMALLINTNULL); break; - - case 4: *((int32_t*)&data[offsets[i]]) = static_cast(joblist::INTNULL); break; - - case 16: - { - int128_t* s128ValuePtr = (int128_t*)(&data[offsets[i]]); - datatypes::TSInt128::storeUnaligned(s128ValuePtr, datatypes::Decimal128Null); - } - break; - default: *((int64_t*)&data[offsets[i]]) = static_cast(joblist::BIGINTNULL); break; - } - - break; - } - - case CalpontSystemCatalog::UTINYINT: data[offsets[i]] = joblist::UTINYINTNULL; break; - - case CalpontSystemCatalog::USMALLINT: *((uint16_t*)&data[offsets[i]]) = joblist::USMALLINTNULL; break; - - case CalpontSystemCatalog::UMEDINT: - case CalpontSystemCatalog::UINT: *((uint32_t*)&data[offsets[i]]) = joblist::UINTNULL; break; - - case CalpontSystemCatalog::UBIGINT: *((uint64_t*)&data[offsets[i]]) = joblist::UBIGINTNULL; break; - - default: - ostringstream os; - os << "Row::initToNull(): got bad column type (" << types[i] << "). Width=" << getColumnWidth(i) - << endl; - os << toString(); - throw logic_error(os.str()); - } + setToNull(i); } } @@ -863,6 +866,9 @@ bool Row::isNullValue(uint32_t colIndex) const case CalpontSystemCatalog::TIME: return (*((uint64_t*)&data[offsets[colIndex]]) == joblist::TIMENULL); + case CalpontSystemCatalog::BLOB: + case CalpontSystemCatalog::TEXT: + case CalpontSystemCatalog::VARBINARY: case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::STRINT: @@ -876,8 +882,8 @@ bool Row::isNullValue(uint32_t colIndex) const return strings->isNullValue(offset); } - if (data[offsets[colIndex]] == 0) // empty string - return true; +// if (data[offsets[colIndex]] == 0) // empty string +// return true; switch (len) { @@ -893,7 +899,9 @@ bool Row::isNullValue(uint32_t colIndex) const case 7: case 8: return (*((uint64_t*)&data[offsets[colIndex]]) == joblist::CHAR8NULL); default: - return (*((uint64_t*)&data[offsets[colIndex]]) == *((uint64_t*)joblist::CPNULLSTRMARK.c_str())); + // a case for value stored with NULL flag prefix. + // see setStringField method. + return getNullMark(colIndex); } break; @@ -919,28 +927,6 @@ bool Row::isNullValue(uint32_t colIndex) const break; } - case CalpontSystemCatalog::BLOB: - case CalpontSystemCatalog::TEXT: - case CalpontSystemCatalog::VARBINARY: - { - uint32_t pos = offsets[colIndex]; - - if (inStringTable(colIndex)) - { - uint64_t offset; - offset = *((uint64_t*)&data[pos]); - return strings->isNullValue(offset); - } - - if (*((uint16_t*)&data[pos]) == 0) - return true; - else if ((strncmp((char*)&data[pos + 2], joblist::CPNULLSTRMARK.c_str(), 8) == 0) && - *((uint16_t*)&data[pos]) == joblist::CPNULLSTRMARK.length()) - return true; - - break; - } - case CalpontSystemCatalog::UTINYINT: return (data[offsets[colIndex]] == joblist::UTINYINTNULL); case CalpontSystemCatalog::USMALLINT: @@ -1154,6 +1140,7 @@ RowGroup::RowGroup(const RowGroup& r) offsets = &stOffsets[0]; else if (!useStringTable && !oldOffsets.empty()) offsets = &oldOffsets[0]; + } RowGroup& RowGroup::operator=(const RowGroup& r) @@ -1287,22 +1274,22 @@ void RowGroup::serializeRGData(ByteStream& bs) const uint32_t RowGroup::getDataSize() const { - return headerSize + (getRowCount() * offsets[columnCount]); + return getDataSize(getRowCount()); } uint32_t RowGroup::getDataSize(uint64_t n) const { - return headerSize + (n * offsets[columnCount]); + return headerSize + (n * getRowSize()); } uint32_t RowGroup::getMaxDataSize() const { - return headerSize + (8192 * offsets[columnCount]); + return headerSize + (8192 * getRowSize()); } uint32_t RowGroup::getMaxDataSizeWithStrings() const { - return headerSize + (8192 * oldOffsets[columnCount]); + return headerSize + (8192 * (oldOffsets[columnCount] + columnCount)); } uint32_t RowGroup::getEmptySize() const @@ -1445,9 +1432,13 @@ void applyMapping(const int* mapping, const Row& in, Row* out) if (UNLIKELY(in.getColTypes()[i] == execplan::CalpontSystemCatalog::VARBINARY || in.getColTypes()[i] == execplan::CalpontSystemCatalog::BLOB || in.getColTypes()[i] == execplan::CalpontSystemCatalog::TEXT)) + { out->setVarBinaryField(in.getVarBinaryField(i), in.getVarBinaryLength(i), mapping[i]); + } else if (UNLIKELY(in.isLongString(i))) + { out->setStringField(in.getConstString(i), mapping[i]); + } else if (UNLIKELY(in.isShortString(i))) out->setUintField(in.getUintField(i), mapping[i]); else if (UNLIKELY(in.getColTypes()[i] == execplan::CalpontSystemCatalog::LONGDOUBLE)) @@ -1565,8 +1556,8 @@ void RowGroup::addToSysDataList(execplan::CalpontSystemCatalog::NJLSysDataList& default: { - string s = row.getStringField(j); - cr->PutStringData(string(s.c_str(), strlen(s.c_str()))); + NullString s = row.getStringField(j); + cr->PutStringData(s.str(), s.isNull() ? 0 : strlen(s.str())); } } @@ -1609,6 +1600,8 @@ RGData RowGroup::duplicate() { // this isn't a straight memcpy of everything b/c it might be remapping strings. // think about a big memcpy + a remap operation; might be faster. + // SZ: copy columns (can even be donw COW style), not rows. even memcpy approach for + // columns is safer. Row r1, r2; RowGroup rg(*this); rg.setData(&ret); @@ -1629,37 +1622,13 @@ RGData RowGroup::duplicate() } } else + { memcpy(ret.rowData.get(), data, getDataSize()); + } return ret; } -void Row::setStringField(const std::string& val, uint32_t colIndex) -{ - uint64_t offset; - uint64_t length; - - // length = strlen(val.c_str()) + 1; - length = val.length(); - - if (length > getColumnWidth(colIndex)) - length = getColumnWidth(colIndex); - - if (inStringTable(colIndex)) - { - offset = strings->storeString((const uint8_t*)val.data(), length); - *((uint64_t*)&data[offsets[colIndex]]) = offset; - // cout << " -- stored offset " << *((uint32_t *) &data[offsets[colIndex]]) - // << " length " << *((uint32_t *) &data[offsets[colIndex] + 4]) - // << endl; - } - else - { - memcpy(&data[offsets[colIndex]], val.data(), length); - memset(&data[offsets[colIndex] + length], 0, offsets[colIndex + 1] - (offsets[colIndex] + length)); - } -} - void RowGroup::append(RGData& rgd) { RowGroup tmp(*this); diff --git a/utils/rowgroup/rowgroup.h b/utils/rowgroup/rowgroup.h index 6c724bc68..02f498f58 100644 --- a/utils/rowgroup/rowgroup.h +++ b/utils/rowgroup/rowgroup.h @@ -54,6 +54,9 @@ #include "collation.h" #include "common/hashfamily.h" +#include "stdlib.h" +#include "execinfo.h" + // Workaround for my_global.h #define of isnan(X) causing a std::std namespace namespace rowgroup @@ -132,8 +135,11 @@ class StringStore StringStore(); virtual ~StringStore(); - inline std::string getString(uint64_t offset) const; - uint64_t storeString(const uint8_t* data, uint32_t length); // returns the offset + inline utils::NullString getString(uint64_t offset) const; + // returns the offset. + // it may receive nullptr as data and it is proper way to store NULL values. + uint64_t storeString(const uint8_t* data, uint32_t length); + //please note getPointer can return nullptr. inline const uint8_t* getPointer(uint64_t offset) const; inline uint32_t getStringLength(uint64_t offset) const; inline utils::ConstString getConstString(uint64_t offset) const @@ -356,6 +362,7 @@ class Row inline void nextRow(); inline uint32_t getColumnWidth(uint32_t colIndex) const; inline uint32_t getColumnCount() const; + inline uint32_t getInternalSize() const; // this is only accurate if there is no string table inline uint32_t getSize() const; // this is only accurate if there is no string table // if a string table is being used, getRealSize() takes into account variable-length strings inline uint32_t getRealSize() const; @@ -475,14 +482,16 @@ class Row inline void setRid(uint64_t rid); // TODO: remove this (string is not efficient for this), use getConstString() instead - inline std::string getStringField(uint32_t colIndex) const + inline utils::NullString getStringField(uint32_t colIndex) const { - return getConstString(colIndex).toString(); + utils::ConstString x = getConstString(colIndex); + return utils::NullString(x); } inline utils::ConstString getConstString(uint32_t colIndex) const; inline utils::ConstString getShortConstString(uint32_t colIndex) const; - void setStringField(const std::string& val, uint32_t colIndex); + void setStringField(const utils::NullString& val, uint32_t colIndex); + void setStringField(const uint8_t* val, uint32_t length, uint32_t colIndex); inline void setStringField(const utils::ConstString& str, uint32_t colIndex); template inline void setBinaryField(const T* value, uint32_t width, uint32_t colIndex); @@ -493,8 +502,7 @@ class Row // support VARBINARY // Add 2-byte length at the CHARSET_INFO*beginning of the field. NULL and zero length field are // treated the same, could use one of the length bit to distinguish these two cases. - inline std::string getVarBinaryStringField(uint32_t colIndex) const; - inline void setVarBinaryField(const std::string& val, uint32_t colIndex); + inline void setVarBinaryField(const utils::NullString& val, uint32_t colIndex); // No string construction is necessary for better performance. inline uint32_t getVarBinaryLength(uint32_t colIndex) const; inline const uint8_t* getVarBinaryField(uint32_t colIndex) const; @@ -534,6 +542,7 @@ class Row inline void markRow(); inline void zeroRid(); inline bool isMarked(); + void setToNull(uint32_t colIndex); void initToNull(); inline void usesStringTable(bool b) @@ -577,6 +586,16 @@ class Row userDataStore = u; } + bool getNullMark(uint32_t col) const + { + return data[getInternalSize() + col]; + } + + void setNullMark(uint32_t col, bool isNull) const + { + data[getInternalSize() + col] = isNull; + } + const CHARSET_INFO* getCharset(uint32_t col) const; private: @@ -639,7 +658,7 @@ inline void Row::setData(const Pointer& p) inline void Row::nextRow() { - data += offsets[columnCount]; + data += getSize(); } inline uint32_t Row::getColumnCount() const @@ -652,17 +671,22 @@ inline uint32_t Row::getColumnWidth(uint32_t col) const return colWidths[col]; } -inline uint32_t Row::getSize() const +inline uint32_t Row::getInternalSize() const { return offsets[columnCount]; } +inline uint32_t Row::getSize() const +{ + return getInternalSize() + columnCount; +} + inline uint32_t Row::getRealSize() const { if (!useStringTable) return getSize(); - uint32_t ret = 2; + uint32_t ret = columnCount; // account for NULL flags. for (uint32_t i = 0; i < columnCount; i++) { @@ -829,7 +853,8 @@ inline int64_t Row::getIntField(uint32_t colIndex) const case 8: return *((int64_t*)&data[offsets[colIndex]]); - default: idbassert(0); throw std::logic_error("Row::getIntField(): bad length."); + default: + idbassert(0); throw std::logic_error("Row::getIntField(): bad length."); } } @@ -872,8 +897,16 @@ inline void Row::setBinaryField_offset(const int128_t* value, uint32_t inline utils::ConstString Row::getShortConstString(uint32_t colIndex) const { - const char* src = (const char*)&data[offsets[colIndex]]; - return utils::ConstString(src, strnlen(src, getColumnWidth(colIndex))); + uint32_t offset = offsets[colIndex]; + const char* src = (const char*)&data[offset]; + if (!isNullValue(colIndex)) + { + return utils::ConstString(src, strnlen(src, getColumnWidth(colIndex))); + } + else + { + return utils::ConstString(nullptr, 0); + } } inline utils::ConstString Row::getConstString(uint32_t colIndex) const @@ -969,14 +1002,28 @@ inline void Row::colUpdateHasherTypeless(datatypes::MariaDBHasher& h, uint32_t k } } +inline void Row::setStringField(const uint8_t* str, uint32_t length, uint32_t colIndex) +{ + utils::ConstString temp((const char*)str, length); + setStringField(temp, colIndex); +} +inline void Row::setStringField(const utils::NullString& val, uint32_t colIndex) +{ + utils::ConstString temp(val.str(), val.length()); + setStringField(temp, colIndex); +} inline void Row::setStringField(const utils::ConstString& str, uint32_t colIndex) { uint64_t offset; // TODO: add multi-byte safe truncation here uint32_t length = str.length(); - if (length > getColumnWidth(colIndex)) - length = getColumnWidth(colIndex); + uint32_t colWidth = getColumnWidth(colIndex); + + setNullMark(colIndex, !str.str()); + + if (length > colWidth) + length = colWidth; if (inStringTable(colIndex)) { @@ -988,24 +1035,28 @@ inline void Row::setStringField(const utils::ConstString& str, uint32_t colIndex } else { - memcpy(&data[offsets[colIndex]], str.str(), length); - memset(&data[offsets[colIndex] + length], 0, offsets[colIndex + 1] - (offsets[colIndex] + length)); + uint8_t* buf = &data[offsets[colIndex]]; + memset(buf + length, 0, offsets[colIndex + 1] - (offsets[colIndex] + length)); // needed for memcmp in equals(). + if (str.str()) + { + memcpy(buf, str.str(), length); + } + else if (colWidth <= 8) // special magic value. + { + setToNull(colIndex); + } } } -inline std::string Row::getVarBinaryStringField(uint32_t colIndex) const -{ - if (inStringTable(colIndex)) - return getConstString(colIndex).toString(); - - return std::string((char*)&data[offsets[colIndex] + 2], *((uint16_t*)&data[offsets[colIndex]])); -} - inline uint32_t Row::getVarBinaryLength(uint32_t colIndex) const { if (inStringTable(colIndex)) return strings->getStringLength(*((uint64_t*)&data[offsets[colIndex]])); - ; + + if (getNullMark(colIndex)) + { + return 0; + } return *((uint16_t*)&data[offsets[colIndex]]); } @@ -1015,6 +1066,11 @@ inline const uint8_t* Row::getVarBinaryField(uint32_t colIndex) const if (inStringTable(colIndex)) return strings->getPointer(*((uint64_t*)&data[offsets[colIndex]])); + if (getNullMark(colIndex)) + { + return nullptr; + } + return &data[offsets[colIndex] + 2]; } @@ -1027,6 +1083,11 @@ inline const uint8_t* Row::getVarBinaryField(uint32_t& len, uint32_t colIndex) c } else { + if (getNullMark(colIndex)) + { + len = 0; + return nullptr; + } len = *((uint16_t*)&data[offsets[colIndex]]); return &data[offsets[colIndex] + 2]; } @@ -1238,29 +1299,28 @@ inline void Row::setInt128Field(const int128_t& val, uint32_t colIndex) setBinaryField(&val, colIndex); } -inline void Row::setVarBinaryField(const std::string& val, uint32_t colIndex) +inline void Row::setVarBinaryField(const utils::NullString& val, uint32_t colIndex) { - if (inStringTable(colIndex)) - setStringField(val, colIndex); - else - { - *((uint16_t*)&data[offsets[colIndex]]) = static_cast(val.length()); - memcpy(&data[offsets[colIndex] + 2], val.data(), val.length()); - } + setVarBinaryField((uint8_t*)val.str(), val.length(), colIndex); } inline void Row::setVarBinaryField(const uint8_t* val, uint32_t len, uint32_t colIndex) { - if (len > getColumnWidth(colIndex)) - len = getColumnWidth(colIndex); + setNullMark(colIndex, !val); if (inStringTable(colIndex)) { + if (len > getColumnWidth(colIndex)) + len = getColumnWidth(colIndex); + uint64_t offset = strings->storeString(val, len); *((uint64_t*)&data[offsets[colIndex]]) = offset; } else { + if (len > getColumnWidth(colIndex)) + len = getColumnWidth(colIndex); + *((uint16_t*)&data[offsets[colIndex]]) = len; memcpy(&data[offsets[colIndex] + 2], val, len); } @@ -1283,6 +1343,7 @@ inline void Row::copyField(uint32_t destIndex, uint32_t srcIndex) const { uint32_t n = offsets[destIndex + 1] - offsets[destIndex]; memmove(&data[offsets[destIndex]], &data[offsets[srcIndex]], n); + setNullMark(destIndex, getNullMark(srcIndex)); } inline void Row::copyField(Row& out, uint32_t destIndex, uint32_t srcIndex) const @@ -1291,7 +1352,7 @@ inline void Row::copyField(Row& out, uint32_t destIndex, uint32_t srcIndex) cons types[srcIndex] == execplan::CalpontSystemCatalog::BLOB || types[srcIndex] == execplan::CalpontSystemCatalog::TEXT)) { - out.setVarBinaryField(getVarBinaryStringField(srcIndex), destIndex); + out.setVarBinaryField(getVarBinaryField(srcIndex), getVarBinaryLength(srcIndex), destIndex); } else if (UNLIKELY(isLongString(srcIndex))) { @@ -1388,7 +1449,6 @@ class RowGroup : public messageqcpp::Serializeable @param scale An array specifying the scale of DECIMAL types (0 for non-decimal) @param precision An array specifying the precision of DECIMAL types (0 for non-decimal) */ - RowGroup(uint32_t colCount, const std::vector& positions, const std::vector& cOids, const std::vector& tkeys, const std::vector& colTypes, @@ -1609,7 +1669,7 @@ inline void RowGroup::getRow(uint32_t rowNum, Row* r) const initRow(r); r->baseRid = getBaseRid(); - r->data = &(data[headerSize + (rowNum * offsets[columnCount])]); + r->data = &(data[headerSize + (rowNum * r->getSize())]); r->strings = strings; r->userDataStore = rgData->userDataStore.get(); } @@ -1702,12 +1762,12 @@ void RowGroup::initRow(Row* r, bool forceInlineData) const inline uint32_t RowGroup::getRowSize() const { - return offsets[columnCount]; + return offsets[columnCount] + columnCount; } inline uint32_t RowGroup::getRowSizeWithStrings() const { - return oldOffsets[columnCount]; + return oldOffsets[columnCount] + columnCount; } inline uint64_t RowGroup::getSizeWithStrings(uint64_t n) const @@ -1900,6 +1960,10 @@ inline void Row::getLocation(uint32_t* partNum, uint16_t* segNum, uint8_t* exten *rowNum = getRelRid(); } +// This routine can be slow for your purposes. Please inspect copyRowInline below, +// in some cases it can be faster. +// Please be sure that copyRowInline does indeed copy rows of the same structure of +// fields. inline void copyRow(const Row& in, Row* out, uint32_t colCount) { if (&in == out) @@ -1909,7 +1973,12 @@ inline void copyRow(const Row& in, Row* out, uint32_t colCount) if (!in.usesStringTable() && !out->usesStringTable()) { - memcpy(out->getData(), in.getData(), std::min(in.getOffset(colCount), out->getOffset(colCount))); + memcpy(out->getData(), in.getData(), std::min(in.getSize(), out->getSize())); + + for (uint32_t i = 0; i < colCount; i++) + { + out->setNullMark(i, in.getNullMark(i)); + } return; } @@ -1920,7 +1989,7 @@ inline void copyRow(const Row& in, Row* out, uint32_t colCount) in.getColTypes()[i] == execplan::CalpontSystemCatalog::TEXT || in.getColTypes()[i] == execplan::CalpontSystemCatalog::CLOB)) { - out->setVarBinaryField(in.getVarBinaryStringField(i), i); + out->setVarBinaryField(in.getVarBinaryField(i), in.getVarBinaryLength(i), i); } else if (UNLIKELY(in.isLongString(i))) { @@ -1930,6 +1999,10 @@ inline void copyRow(const Row& in, Row* out, uint32_t colCount) { out->setUintField(in.getUintField(i), i); } + else if (UNLIKELY(in.getColTypes()[i] == execplan::CalpontSystemCatalog::DOUBLE)) + { + out->setDoubleField(in.getDoubleField(i), i); + } else if (UNLIKELY(in.getColTypes()[i] == execplan::CalpontSystemCatalog::LONGDOUBLE)) { out->setLongDoubleField(in.getLongDoubleField(i), i); @@ -1950,12 +2023,34 @@ inline void copyRow(const Row& in, Row* out) copyRow(in, out, std::min(in.getColumnCount(), out->getColumnCount())); } -inline std::string StringStore::getString(uint64_t off) const +// This routine can be substantially faster than copyRow above, but there are caveats. +// The speedy part with memcpy should only be invoked when structures of the rows are the same. +// Otherwise information about NULLs for inline strings can be lost or garbled. +inline void copyRowInline(const Row& in, Row* out, uint32_t colCount) +{ + if (&in == out) + return; + + // XXX: this code still may copy data incorrectly if sizes of columns differ. + if (!in.usesStringTable() && !out->usesStringTable() && in.getSize() == out->getSize()) + { + out->setRid(in.getRelRid()); + + memcpy(out->getData(), in.getData(), in.getSize()); + return; + } + + copyRow(in, out, colCount); +} + + +inline utils::NullString StringStore::getString(uint64_t off) const { uint32_t length; + utils::NullString nStr; if (off == std::numeric_limits::max()) - return joblist::CPNULLSTRMARK; + return nStr; MemChunk* mc; @@ -1965,11 +2060,12 @@ inline std::string StringStore::getString(uint64_t off) const off &= ~0x8000000000000000; if (longStrings.size() <= off) - return joblist::CPNULLSTRMARK; + return nStr; mc = (MemChunk*)longStrings[off].get(); memcpy(&length, mc->data, 4); - return std::string((char*)mc->data + 4, length); + nStr.assign(std::string((char*)mc->data + 4, length)); + return nStr; } uint64_t chunk = off / CHUNK_SIZE; @@ -1978,22 +2074,23 @@ inline std::string StringStore::getString(uint64_t off) const // this has to handle uninitialized data as well. If it's uninitialized it doesn't matter // what gets returned, it just can't go out of bounds. if (mem.size() <= chunk) - return joblist::CPNULLSTRMARK; + return nStr; mc = (MemChunk*)mem[chunk].get(); memcpy(&length, &mc->data[offset], 4); if ((offset + length) > mc->currentSize) - return joblist::CPNULLSTRMARK; + return nStr; - return std::string((char*)&(mc->data[offset]) + 4, length); + nStr.assign(std::string((char*)&(mc->data[offset]) + 4, length)); + return nStr; } inline const uint8_t* StringStore::getPointer(uint64_t off) const { if (off == std::numeric_limits::max()) - return (const uint8_t*)joblist::CPNULLSTRMARK.c_str(); + return nullptr; uint64_t chunk = off / CHUNK_SIZE; uint64_t offset = off % CHUNK_SIZE; @@ -2005,7 +2102,7 @@ inline const uint8_t* StringStore::getPointer(uint64_t off) const off &= ~0x8000000000000000; if (longStrings.size() <= off) - return (const uint8_t*)joblist::CPNULLSTRMARK.c_str(); + return nullptr; mc = (MemChunk*)longStrings[off].get(); return mc->data + 4; @@ -2014,49 +2111,21 @@ inline const uint8_t* StringStore::getPointer(uint64_t off) const // this has to handle uninitialized data as well. If it's uninitialized it doesn't matter // what gets returned, it just can't go out of bounds. if (UNLIKELY(mem.size() <= chunk)) - return (const uint8_t*)joblist::CPNULLSTRMARK.c_str(); + return nullptr; mc = (MemChunk*)mem[chunk].get(); if (offset > mc->currentSize) - return (const uint8_t*)joblist::CPNULLSTRMARK.c_str(); + return nullptr; return &(mc->data[offset]) + 4; } inline bool StringStore::isNullValue(uint64_t off) const { - uint32_t length; - if (off == std::numeric_limits::max()) return true; - - // Long strings won't be NULL - if (off & 0x8000000000000000) - return false; - - uint32_t chunk = off / CHUNK_SIZE; - uint32_t offset = off % CHUNK_SIZE; - MemChunk* mc; - - if (mem.size() <= chunk) - return true; - - mc = (MemChunk*)mem[chunk].get(); - memcpy(&length, &mc->data[offset], 4); - - if (length == 0) - return true; - - if (length < 8) - return false; - - if ((offset + length) > mc->currentSize) - return true; - - if (mc->data[offset + 4] == 0) // "" = NULL string for some reason... - return true; - return (memcmp(&mc->data[offset + 4], joblist::CPNULLSTRMARK.c_str(), 8) == 0); + return false; } inline uint32_t StringStore::getStringLength(uint64_t off) const diff --git a/utils/udfsdk/mcsv1_udaf.cpp b/utils/udfsdk/mcsv1_udaf.cpp index 4b705865c..291998103 100644 --- a/utils/udfsdk/mcsv1_udaf.cpp +++ b/utils/udfsdk/mcsv1_udaf.cpp @@ -254,7 +254,7 @@ void UserData::unserialize(messageqcpp::ByteStream& bs) bs.advance(size); } -const std::string typeStr(""); +const utils::NullString typeStr(""); const static_any::any& mcsv1_UDAF::charTypeId((char)1); const static_any::any& mcsv1_UDAF::scharTypeId((signed char)1); const static_any::any& mcsv1_UDAF::shortTypeId((short)1); diff --git a/utils/windowfunction/wf_count.cpp b/utils/windowfunction/wf_count.cpp index bc4694762..342baf426 100644 --- a/utils/windowfunction/wf_count.cpp +++ b/utils/windowfunction/wf_count.cpp @@ -62,7 +62,7 @@ boost::shared_ptr WF_count::makeFunction(int id, const st case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::VARBINARY: { - func.reset(new WF_count(id, name)); + func.reset(new WF_count(id, name)); break; } diff --git a/utils/windowfunction/wf_lead_lag.cpp b/utils/windowfunction/wf_lead_lag.cpp index b3babe8b8..dd1d4e93e 100644 --- a/utils/windowfunction/wf_lead_lag.cpp +++ b/utils/windowfunction/wf_lead_lag.cpp @@ -119,7 +119,7 @@ boost::shared_ptr WF_lead_lag::makeFunction(int id, const default: { - func.reset(new WF_lead_lag(id, name)); + func.reset(new WF_lead_lag(id, name)); break; } } @@ -303,6 +303,6 @@ template void WF_lead_lag::parseParms(const std::vector::parseParms(const std::vector&); template void WF_lead_lag::parseParms(const std::vector&); template void WF_lead_lag::parseParms(const std::vector&); -template void WF_lead_lag::parseParms(const std::vector&); +template void WF_lead_lag::parseParms(const std::vector&); } // namespace windowfunction diff --git a/utils/windowfunction/wf_min_max.cpp b/utils/windowfunction/wf_min_max.cpp index b5b63bde7..fbc2ffe18 100644 --- a/utils/windowfunction/wf_min_max.cpp +++ b/utils/windowfunction/wf_min_max.cpp @@ -120,7 +120,7 @@ boost::shared_ptr WF_min_max::makeFunction(int id, const default: { - func.reset(new WF_min_max(id, name)); + func.reset(new WF_min_max(id, name)); break; } } diff --git a/utils/windowfunction/wf_nth_value.cpp b/utils/windowfunction/wf_nth_value.cpp index f3c9e2a1b..a79f2a402 100644 --- a/utils/windowfunction/wf_nth_value.cpp +++ b/utils/windowfunction/wf_nth_value.cpp @@ -120,7 +120,7 @@ boost::shared_ptr WF_nth_value::makeFunction(int id, cons default: { - func.reset(new WF_nth_value(id, name)); + func.reset(new WF_nth_value(id, name)); break; } } diff --git a/utils/windowfunction/wf_percentile.cpp b/utils/windowfunction/wf_percentile.cpp index ef2c12548..2b7a34ab5 100644 --- a/utils/windowfunction/wf_percentile.cpp +++ b/utils/windowfunction/wf_percentile.cpp @@ -129,7 +129,7 @@ boost::shared_ptr WF_percentile::makeFunction(int id, con { if (id == WF__PERCENTILE_DISC) { - func.reset(new WF_percentile(id, name)); + func.reset(new WF_percentile(id, name)); } else { @@ -334,11 +334,12 @@ void WF_percentile::operator()(int64_t b, int64_t e, int64_t c) implicit2T(idx, cv, 0); vd = (crn - rn) * fv + (rn - frn) * cv; } - double tempvd[2]; tempvd[0] = vd; tempvd[1] = 0; - v = *(reinterpret_cast(&tempvd[0])); // old code that referred to 'vd' var triggered partial out-of-bounds warning. + + v = *(reinterpret_cast(&tempvd[0])); + //v = *(reinterpret_cast(&vd)); // XXX old code that produced out-of-bounds difference. p = &v; } else // (fFunctionId == WF__PERCENTILE_DISC) diff --git a/utils/windowfunction/wf_udaf.cpp b/utils/windowfunction/wf_udaf.cpp index 0894c6ad1..6d1fafcdb 100644 --- a/utils/windowfunction/wf_udaf.cpp +++ b/utils/windowfunction/wf_udaf.cpp @@ -162,7 +162,7 @@ bool WF_udaf::dropValues(int64_t b, int64_t e) // Turn on Null flags or skip based on respect nulls flags[k] = 0; - if ((!cc && fRow.isNullValue(colIn) == true) || (cc && cc->type() == ConstantColumn::NULLDATA)) + if ((!cc && fRow.isNullValue(colIn) == true) || (cc && cc->isNull())) { if (!bRespectNulls) { @@ -450,11 +450,11 @@ bool WF_udaf::dropValues(int64_t b, int64_t e) case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::BLOB: { - string valIn; + utils::NullString valIn; if (cc) { - valIn = cc->getStrVal(fRow, isNull); + valIn = cc->getStrVal(fRow, isNull); // XXX: we probably need to change Distinctmap. } else { @@ -548,7 +548,7 @@ void WF_udaf::SetUDAFValue(static_any::any& valOut, int64_t colOut, int64_t b, i static const static_any::any& ullTypeId = (unsigned long long)1; static const static_any::any& floatTypeId = (float)1; static const static_any::any& doubleTypeId = (double)1; - static const std::string typeStr(""); + static const std::string typeStr; static const static_any::any& strTypeId = typeStr; CDT colDataType = fRow.getColType(colOut); @@ -661,7 +661,7 @@ void WF_udaf::SetUDAFValue(static_any::any& valOut, int64_t colOut, int64_t b, i if (valOut.compatible(strTypeId)) { - std::string strOut = valOut.cast(); + strOut = valOut.cast(); // Convert the string to numeric type, just in case. intOut = atol(strOut.c_str()); uintOut = strtoul(strOut.c_str(), NULL, 10); @@ -756,11 +756,12 @@ void WF_udaf::SetUDAFValue(static_any::any& valOut, int64_t colOut, int64_t b, i case execplan::CalpontSystemCatalog::BLOB: if (valOut.empty()) { - setValue(colDataType, b, e, c, (string*)NULL); + setValue(colDataType, b, e, c, (utils::NullString*)NULL); } else { - setValue(colDataType, b, e, c, &strOut); + utils::NullString nullStrOut(strOut); + setValue(colDataType, b, e, c, &nullStrOut); } break; @@ -845,7 +846,7 @@ void WF_udaf::operator()(int64_t b, int64_t e, int64_t c) // Turn on Null flags or skip based on respect nulls flags[k] = 0; - if ((!cc && fRow.isNullValue(colIn) == true) || (cc && cc->type() == ConstantColumn::NULLDATA)) + if ((!cc && fRow.isNullValue(colIn) == true) || (cc && cc->isNull())) { if (!bRespectNulls) { @@ -1112,11 +1113,11 @@ void WF_udaf::operator()(int64_t b, int64_t e, int64_t c) case CalpontSystemCatalog::TEXT: case CalpontSystemCatalog::BLOB: { - string valIn; + utils::NullString valIn; if (cc) { - valIn = cc->getStrVal(fRow, isNull); + valIn = cc->getStrVal(fRow, isNull); // XXX: the same problem with distinct. } else { @@ -1127,7 +1128,7 @@ void WF_udaf::operator()(int64_t b, int64_t e, int64_t c) // Currently, distinct only works on the first parameter. if (k == 0 && fDistinct) { - std::pair val = make_pair(valIn, 1); + std::pair val = make_pair(valIn.isNull() ? nullptr : valIn.safeString(""), 1); std::pair distinct; distinct = fDistinctMap.insert(val); if (distinct.second == false) @@ -1138,7 +1139,7 @@ void WF_udaf::operator()(int64_t b, int64_t e, int64_t c) } } - datum.columnData = valIn; + datum.columnData = valIn.isNull() ? nullptr : valIn.safeString(""); break; } diff --git a/utils/windowfunction/windowfunctiontype.cpp b/utils/windowfunction/windowfunctiontype.cpp index eb8b6331d..d14b7074e 100644 --- a/utils/windowfunction/windowfunctiontype.cpp +++ b/utils/windowfunction/windowfunctiontype.cpp @@ -297,7 +297,7 @@ void WindowFunctionType::getValue(uint64_t i, long double& t, CDT* } template <> -void WindowFunctionType::getValue(uint64_t i, string& t, CDT* cdt) +void WindowFunctionType::getValue(uint64_t i, utils::NullString& t, CDT* cdt) { t = fRow.getStringField(i); // By not setting cdt, we let it default to the column's type @@ -356,14 +356,14 @@ void WindowFunctionType::setValue(uint64_t i, int128_t& t) } template <> -void WindowFunctionType::setValue(uint64_t i, string& t) +void WindowFunctionType::setValue(uint64_t i, utils::NullString& t) { fRow.setStringField(t, i); } // MCOL-1676 Need a separate specialization for string now. template <> -void WindowFunctionType::setValue(int ct, int64_t b, int64_t e, int64_t c, string* v) +void WindowFunctionType::setValue(int ct, int64_t b, int64_t e, int64_t c, utils::NullString* v) { if (c != WF__BOUND_ALL) b = e = c; @@ -371,13 +371,12 @@ void WindowFunctionType::setValue(int ct, int64_t b, int64_t e, int64_t uint64_t i = fFieldIndex[0]; if (v == NULL) - v = (string*)getNullValueByType(ct, i); + v = (utils::NullString*)getNullValueByType(ct, i); for (int64_t j = b; j <= e; j++) { if (j % 1000 == 0 && fStep->cancelled()) break; - fRow.setData(getPointer((*fRowData)[j])); setValue(i, *v); } @@ -574,7 +573,7 @@ void WindowFunctionType::implicit2T(uint64_t i, T& t, int s) } template <> -void WindowFunctionType::implicit2T(uint64_t i, string& t, int) +void WindowFunctionType::implicit2T(uint64_t i, utils::NullString& t, int) { t = fRow.getStringField(i); } @@ -621,7 +620,7 @@ void WindowFunctionType::getConstValue(ConstantColumn* cc, float& t, bool } template <> -void WindowFunctionType::getConstValue(ConstantColumn* cc, string& t, bool& b) +void WindowFunctionType::getConstValue(ConstantColumn* cc, utils::NullString& t, bool& b) { t = cc->getStrVal(fRow, b); } @@ -660,7 +659,7 @@ void* WindowFunctionType::getNullValueByType(int ct, int pos) // static uint64_t char2Null = joblist::CHAR2NULL; // static uint64_t char4Null = joblist::CHAR4NULL; // static uint64_t char8Null = joblist::CHAR8NULL; - static string stringNull(""); + static utils::NullString stringNull; static int128_t int128Null; // Set at runtime; void* v = NULL; @@ -692,6 +691,8 @@ void* WindowFunctionType::getNullValueByType(int ct, int pos) case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::VARCHAR: + case CalpontSystemCatalog::TEXT: + case CalpontSystemCatalog::VARBINARY: // XXX: I guess it is right to do that. TODO: we can add TEXT here too. { // uint64_t len = fRow.getColumnWidth(pos); #if 0 @@ -764,7 +765,6 @@ void* WindowFunctionType::getNullValueByType(int ct, int pos) case CalpontSystemCatalog::LONGDOUBLE: v = &longDoubleNull; break; - case CalpontSystemCatalog::VARBINARY: default: std::ostringstream oss; oss << "not supported data type: " << colType2String[ct]; diff --git a/utils/windowfunction/windowfunctiontype.h b/utils/windowfunction/windowfunctiontype.h index ef59444cc..c29c08376 100644 --- a/utils/windowfunction/windowfunctiontype.h +++ b/utils/windowfunction/windowfunctiontype.h @@ -32,6 +32,7 @@ #include "windowframe.h" #include "constantcolumn.h" #include "mcs_decimal.h" +#include "nullstring.h" namespace ordering { diff --git a/writeengine/bulk/we_bulkloadbuffer.cpp b/writeengine/bulk/we_bulkloadbuffer.cpp index 9af6e8e23..9d9278370 100644 --- a/writeengine/bulk/we_bulkloadbuffer.cpp +++ b/writeengine/bulk/we_bulkloadbuffer.cpp @@ -483,8 +483,8 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, bool nullFlag, unsign { if (column.fWithDefault) { - int defLen = column.fDefaultChr.size(); - const char* defData = column.fDefaultChr.c_str(); + int defLen = column.fDefaultChr.length(); + const char* defData = column.fDefaultChr.str(); if (defLen > column.definedWidth) memcpy(charTmpBuf, defData, column.definedWidth); diff --git a/writeengine/dictionary/we_dctnry.cpp b/writeengine/dictionary/we_dctnry.cpp index 0a4f5e90b..34605e421 100644 --- a/writeengine/dictionary/we_dctnry.cpp +++ b/writeengine/dictionary/we_dctnry.cpp @@ -657,7 +657,7 @@ int Dctnry::insertDctnry2(Signature& sig) sig.token.bc = 0; - while (sig.size > 0) + while (sig.size > 0 || !lbid_in_token) { if (sig.size > (m_freeSpace - HDR_UNIT_SIZE)) { @@ -819,7 +819,7 @@ int Dctnry::insertDctnry(const char* buf, ColPosPair** pos, const int totalRow, { if (m_defVal.length() > 0) // use default string if available { - pIn = m_defVal.c_str(); + pIn = m_defVal.str(); curSig.signature = (unsigned char*)pIn; curSig.size = m_defVal.length(); } @@ -1061,13 +1061,6 @@ int Dctnry::insertDctnry(const int& sgnature_size, const unsigned char* sgnature return ERR_DICT_SIZE_GT_2G; } - if (sgnature_size == 0) - { - WriteEngine::Token nullToken; - memcpy(&token, &nullToken, 8); - return NO_ERROR; - } - CommBlock cb; cb.file.oid = m_dctnryOID; cb.file.pFile = m_dFile; diff --git a/writeengine/dictionary/we_dctnry.h b/writeengine/dictionary/we_dctnry.h index 7d41e5d03..d20791316 100644 --- a/writeengine/dictionary/we_dctnry.h +++ b/writeengine/dictionary/we_dctnry.h @@ -35,6 +35,7 @@ #include "we_type.h" #include "we_brm.h" #include "bytestream.h" +#include "nullstring.h" #define EXPORT @@ -214,7 +215,7 @@ class Dctnry : public DbFileOp /** * @brief Set dictionary default for this column */ - void setDefault(const std::string& defVal) + void setDefault(const utils::NullString& defVal) { m_defVal = defVal; } @@ -325,7 +326,7 @@ class Dctnry : public DbFileOp DataBlock m_curBlock; // current "raw" (uncompressed) data block Log* m_logger; // logger, mainly for bulk load int m_colWidth; // width of this dictionary column - std::string m_defVal; // optional default string value + utils::NullString m_defVal; // optional default string value ImportDataMode m_importDataMode; // Import data in text or binary mode }; // end of class diff --git a/writeengine/server/we_ddlcommandproc.cpp b/writeengine/server/we_ddlcommandproc.cpp index 85d465780..2e385f20a 100644 --- a/writeengine/server/we_ddlcommandproc.cpp +++ b/writeengine/server/we_ddlcommandproc.cpp @@ -171,24 +171,26 @@ uint8_t WE_DDLCommandProc::writeSystable(ByteStream& bs, std::string& err) getColumnsForTable(sessionID, tableName.schema, tableName.table, columns); column_iterator = columns.begin(); - std::string tmpStr(""); + NullString tmpStr; while (column_iterator != columns.end()) { column = *column_iterator; boost::to_lower(column.tableColName.column); + tmpStr.dropString(); + if (TABLENAME_COL == column.tableColName.column) { std::string tablename = tableDef.fQualifiedName->fName; colTuple.data = tablename; - tmpStr = tablename; + tmpStr.assign(tablename); } else if (SCHEMA_COL == column.tableColName.column) { std::string schema = tableDef.fQualifiedName->fSchema; colTuple.data = schema; - tmpStr = schema; + tmpStr.assign(schema); } else if (OBJECTID_COL == column.tableColName.column) { @@ -433,7 +435,7 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err ddlpackage::QualifiedName qualifiedName = *(tableDef.fQualifiedName); iter = tableDefCols.begin(); // colpos = 0; - std::string tmpStr(""); + NullString tmpStr; for (unsigned int ii = 0; ii < numCols; ii++) { @@ -517,18 +519,18 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err if (SCHEMA_COL == column.tableColName.column) { colTuple.data = qualifiedName.fSchema; - tmpStr = qualifiedName.fSchema; + tmpStr.assign(qualifiedName.fSchema); } else if (TABLENAME_COL == column.tableColName.column) { colTuple.data = qualifiedName.fName; - tmpStr = qualifiedName.fName; + tmpStr.assign(qualifiedName.fName); } else if (COLNAME_COL == column.tableColName.column) { boost::to_lower(colDefPtr->fName); colTuple.data = colDefPtr->fName; - tmpStr = colDefPtr->fName; + tmpStr.assign(colDefPtr->fName); } else if (OBJECTID_COL == column.tableColName.column) { @@ -564,16 +566,15 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err } else if (DEFAULTVAL_COL == column.tableColName.column) { - if (colDefPtr->fDefaultValue) + if (colDefPtr->fDefaultValue && !colDefPtr->fDefaultValue->fNull) { - colTuple.data = colDefPtr->fDefaultValue->fValue; - tmpStr = colDefPtr->fDefaultValue->fValue; + tmpStr.assign(colDefPtr->fDefaultValue->fValue); } else { - tmpStr = ""; - // colTuple.data = column.colType.getNullValueForType(); + tmpStr.dropString(); } + colTuple.data = tmpStr; } else if (NULLABLE_COL == column.tableColName.column) { @@ -625,11 +626,11 @@ uint8_t WE_DDLCommandProc::writeCreateSyscolumn(ByteStream& bs, std::string& err } else if (MINVAL_COL == column.tableColName.column) { - tmpStr = ""; + tmpStr.dropString(); } else if (MAXVAL_COL == column.tableColName.column) { - tmpStr = ""; + tmpStr.dropString(); } else if (COMPRESSIONTYPE_COL == column.tableColName.column) { @@ -834,7 +835,6 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err) std::map oids; std::vector oidsToFlush; // colpos = 0; - std::string tmpStr(""); for (unsigned int ii = 0; ii < numCols; ii++) { @@ -900,24 +900,25 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err) while (column_iterator != columns.end()) { + NullString tmpStr; column = *column_iterator; boost::to_lower(column.tableColName.column); if (SCHEMA_COL == column.tableColName.column) { colTuple.data = schema; - tmpStr = schema; + tmpStr.assign(schema); } else if (TABLENAME_COL == column.tableColName.column) { colTuple.data = tablename; - tmpStr = tablename; + tmpStr.assign(tablename); } else if (COLNAME_COL == column.tableColName.column) { boost::to_lower(colDefPtr->fName); colTuple.data = colDefPtr->fName; - tmpStr = colDefPtr->fName; + tmpStr.assign(colDefPtr->fName); } else if (OBJECTID_COL == column.tableColName.column) { @@ -950,16 +951,16 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err) } else if (DEFAULTVAL_COL == column.tableColName.column) { - if (colDefPtr->fDefaultValue) + if (colDefPtr->fDefaultValue && !colDefPtr->fDefaultValue->fNull) { - colTuple.data = colDefPtr->fDefaultValue->fValue; - tmpStr = colDefPtr->fDefaultValue->fValue; + tmpStr.assign(colDefPtr->fDefaultValue->fValue); } else { - tmpStr = ""; + tmpStr.dropString(); // colTuple.data = column.colType.getNullValueForType(); } + colTuple.data = tmpStr; } else if (NULLABLE_COL == column.tableColName.column) { @@ -1011,11 +1012,11 @@ uint8_t WE_DDLCommandProc::writeSyscolumn(ByteStream& bs, std::string& err) } else if (MINVAL_COL == column.tableColName.column) { - tmpStr = ""; + tmpStr.dropString(); } else if (MAXVAL_COL == column.tableColName.column) { - tmpStr = ""; + tmpStr.dropString(); } else if (COMPRESSIONTYPE_COL == column.tableColName.column) { diff --git a/writeengine/server/we_dmlcommandproc.cpp b/writeengine/server/we_dmlcommandproc.cpp index 328711802..5260c66ce 100644 --- a/writeengine/server/we_dmlcommandproc.cpp +++ b/writeengine/server/we_dmlcommandproc.cpp @@ -54,6 +54,7 @@ using namespace BRM; #include "columnwidth.h" using namespace std; +using namespace utils; namespace WriteEngine { @@ -91,7 +92,7 @@ WE_DMLCommandProc::~WE_DMLCommandProc() dbRootExtTrackerVec.clear(); } -void WE_DMLCommandProc::processAuxCol(const std::vector& origVals, +void WE_DMLCommandProc::processAuxCol(const std::vector& origVals, WriteEngine::ColValueList& colValuesList, WriteEngine::DictStrList& dicStringList) { @@ -104,7 +105,8 @@ void WE_DMLCommandProc::processAuxCol(const std::vector& origVals, auxColTuple.data = (uint8_t)1; auxColTuples.push_back(auxColTuple); //@Bug 2515. Only pass string values to write engine - auxDicStrings.push_back(""); + utils::NullString ns; + auxDicStrings.push_back(ns); } colValuesList.push_back(auxColTuples); @@ -206,7 +208,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: dctnryStruct.fCharsetNumber = colType.charsetNumber; - if (colStruct.tokenFlag) + if (colStruct.tokenFlag) { dctnryStruct.dctnryOid = colType.ddn.dictOID; dctnryStruct.columnOid = colStruct.dataOid; @@ -255,7 +257,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: cscColTypeList.push_back(colType); } - std::string tmpStr(""); + NullString tmpStr; for (unsigned int i = 0; i < numcols; i++) { @@ -278,7 +280,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: boost::any datavalue; bool isNULL = false; bool pushWarning = false; - std::vector origVals; + std::vector origVals; origVals = columnPtr->get_DataVector(); WriteEngine::dictStr dicStrings; @@ -291,14 +293,11 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: isNULL = columnPtr->get_isnull(); - if (isNULL || (tmpStr.length() == 0)) - isNULL = true; - else - isNULL = false; + isNULL = isNULL ? true : tmpStr.isNull(); if (colType.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT) { - if (isNULL && colType.defaultValue.empty()) // error out + if (isNULL && colType.defaultValue.isNull()) // error out { Message::Args args; args.add(tableColName.column); @@ -306,7 +305,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: rc = 1; return rc; } - else if (isNULL && !(colType.defaultValue.empty())) + else if (isNULL && !(colType.defaultValue.isNull())) { tmpStr = colType.defaultValue; } @@ -314,7 +313,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: if (tmpStr.length() > (unsigned int)colType.colWidth) { - tmpStr = tmpStr.substr(0, colType.colWidth); + tmpStr.assign(tmpStr.unsafeStringRef().substr(0, colType.colWidth)); if (!pushWarning) { @@ -343,18 +342,13 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: else { string x; - std::string indata; + NullString indata; for (uint32_t i = 0; i < origVals.size(); i++) { indata = origVals[i]; - isNULL = columnPtr->get_isnull(); - - if (isNULL || (indata.length() == 0)) - isNULL = true; - else - isNULL = false; + isNULL = columnPtr->get_isnull() ? true : indata.isNull(); // check if autoincrement column and value is 0 or null uint64_t nextVal = 1; @@ -376,7 +370,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: } } - if (colType.autoincrement && (isNULL || (indata.compare("0") == 0))) + if (colType.autoincrement && (isNULL || (indata.safeString("").compare("0") == 0))) { try { @@ -398,13 +392,13 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: ostringstream oss; oss << nextVal; - indata = oss.str(); + indata.assign(oss.str()); isNULL = false; } if (colType.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT) { - if (isNULL && colType.defaultValue.empty()) // error out + if (isNULL && colType.defaultValue.isNull()) // error out { Message::Args args; args.add(tableColName.column); @@ -412,7 +406,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: rc = 1; return rc; } - else if (isNULL && !(colType.defaultValue.empty())) + else if (isNULL && !(colType.defaultValue.isNull())) { indata = colType.defaultValue; isNULL = false; @@ -421,14 +415,14 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std: try { - datavalue = colType.convertColumnData(indata, pushWarning, insertPkg.get_TimeZone(), isNULL, + datavalue = colType.convertColumnData(indata, pushWarning, insertPkg.get_TimeZone(), false, false); } catch (exception&) { rc = 1; Message::Args args; - args.add(string("'") + indata + string("'")); + args.add(string("'") + indata.safeString("<>") + string("'")); err = IDBErrorInfo::instance()->errorMsg(ERR_NON_NUMERIC_DATA, args); } @@ -1185,7 +1179,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: } unsigned int numcols = rowPtr->get_NumberOfColumns(); - std::string tmpStr(""); + NullString tmpStr; try { @@ -1209,7 +1203,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: boost::any datavalue; bool isNULL = false; - std::vector origVals; + std::vector origVals; origVals = columnPtr->get_DataVector(); WriteEngine::dictStr dicStrings; @@ -1220,14 +1214,11 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: { tmpStr = origVals[i]; - if (tmpStr.length() == 0) - isNULL = true; - else - isNULL = false; + isNULL = tmpStr.isNull(); if (colType.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT) { - if (isNULL && colType.defaultValue.empty()) // error out + if (isNULL && colType.defaultValue.isNull()) // error out { Message::Args args; args.add(tableColName.column); @@ -1235,7 +1226,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: rc = 1; return rc; } - else if (isNULL && !(colType.defaultValue.empty())) + else if (isNULL && !(colType.defaultValue.isNull())) { tmpStr = colType.defaultValue; } @@ -1243,7 +1234,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: if (tmpStr.length() > (unsigned int)colType.colWidth) { - tmpStr = tmpStr.substr(0, colType.colWidth); + tmpStr.assign(tmpStr.unsafeStringRef().substr(0, colType.colWidth)); if (!pushWarning) pushWarning = true; @@ -1264,7 +1255,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: else { string x; - std::string indata; + NullString indata; // scan once to check how many autoincrement value needed uint32_t nextValNeeded = 0; uint64_t nextVal = 1; @@ -1287,12 +1278,12 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: { indata = origVals[i]; - if (indata.length() == 0) + if (indata.isNull()) isNULL = true; else isNULL = false; - if (isNULL || (indata.compare("0") == 0)) + if (isNULL || (indata.safeString("").compare("0") == 0)) nextValNeeded++; } } @@ -1322,23 +1313,23 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: { indata = origVals[i]; - if (indata.length() == 0) + if (indata.isNull()) isNULL = true; else isNULL = false; // check if autoincrement column and value is 0 or null - if (colType.autoincrement && (isNULL || (indata.compare("0") == 0))) + if (colType.autoincrement && (isNULL || (indata.safeString("").compare("0") == 0))) { ostringstream oss; oss << nextVal++; - indata = oss.str(); + indata.assign(oss.str()); isNULL = false; } if (colType.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT) { - if (isNULL && colType.defaultValue.empty()) // error out + if (isNULL && colType.defaultValue.isNull()) // error out { Message::Args args; args.add(tableColName.column); @@ -1346,7 +1337,7 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: rc = 1; return rc; } - else if (isNULL && !(colType.defaultValue.empty())) + else if (isNULL && !(colType.defaultValue.isNull())) { indata = colType.defaultValue; isNULL = false; @@ -1355,14 +1346,14 @@ uint8_t WE_DMLCommandProc::processBatchInsert(messageqcpp::ByteStream& bs, std:: try { - datavalue = colType.convertColumnData(indata, pushWarning, insertPkg.get_TimeZone(), isNULL, + datavalue = colType.convertColumnData(indata, pushWarning, insertPkg.get_TimeZone(), false, false); } catch (exception&) { rc = 1; Message::Args args; - args.add(string("'") + indata + string("'")); + args.add(string("'") + indata.safeString("<>") + string("'")); err = IDBErrorInfo::instance()->errorMsg(ERR_NON_NUMERIC_DATA, args); } @@ -1772,7 +1763,7 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, return rc; } - std::string tmpStr(""); + NullString tmpStr; uint32_t valuesPerColumn; bs >> valuesPerColumn; colValuesList.reserve(columnCount * valuesPerColumn); @@ -1798,16 +1789,13 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, { for (uint32_t i = 0; i < valuesPerColumn; i++) { - bs >> tmp8; - isNULL = tmp8; bs >> tmpStr; - if (tmpStr.length() == 0) - isNULL = true; + isNULL = tmpStr.isNull(); if (colType.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT) { - if (isNULL && colType.defaultValue.empty()) // error out + if (isNULL && colType.defaultValue.isNull()) // error out { Message::Args args; args.add(tableColName.column); @@ -1815,7 +1803,7 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, rc = 1; return rc; } - else if (isNULL && !(colType.defaultValue.empty())) + else if (isNULL && !(colType.defaultValue.isNull())) { tmpStr = colType.defaultValue; } @@ -1823,7 +1811,7 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, if (tmpStr.length() > (unsigned int)colType.colWidth) { - tmpStr = tmpStr.substr(0, colType.colWidth); + tmpStr.assign(tmpStr.unsafeStringRef().substr(0, colType.colWidth)); if (!pushWarning) pushWarning = true; @@ -1871,7 +1859,7 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, uint64_t colValue; float valF; double valD; - std::string valStr; + NullString valStr; bool valZero = false; // Needed for autoinc check switch (colType.colDataType) @@ -2058,22 +2046,25 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, case execplan::CalpontSystemCatalog::BLOB: bs >> valStr; - if (valStr.length() > (unsigned int)colType.colWidth) + if (!valStr.isNull()) // null values do not require any padding or truncation. { - valStr = valStr.substr(0, colType.colWidth); - pushWarning = true; - } - else - { - if ((unsigned int)colType.colWidth > valStr.length()) + if (valStr.length() > (unsigned int)colType.colWidth) { - // Pad null character to the string - valStr.resize(colType.colWidth, 0); + valStr = NullString(valStr.unsafeStringRef().substr(0, colType.colWidth)); + pushWarning = true; + } + else + { + if ((unsigned int)colType.colWidth > valStr.length()) + { + // Pad null character to the string + valStr.resize(colType.colWidth, 0); + } } } // FIXME: colValue is uint64_t (8 bytes) - memcpy(&colValue, valStr.c_str(), valStr.length()); + memcpy(&colValue, valStr.str(), valStr.length()); break; default: @@ -2113,7 +2104,7 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, if (colType.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT) { - if (isNULL && colType.defaultValue.empty()) // error out + if (isNULL && colType.defaultValue.isNull()) // error out { Message::Args args; args.add(tableColName.column); @@ -2121,9 +2112,9 @@ uint8_t WE_DMLCommandProc::processBatchInsertBinary(messageqcpp::ByteStream& bs, rc = 1; return rc; } - else if (isNULL && !(colType.defaultValue.empty())) + else if (isNULL && !(colType.defaultValue.isNull())) { - memcpy(&colValue, colType.defaultValue.c_str(), colType.defaultValue.length()); + memcpy(&colValue, colType.defaultValue.str(), colType.defaultValue.length()); isNULL = false; } } @@ -2771,7 +2762,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin // get rows and values rowgroup::Row row; rowGroups[txnId]->initRow(&row); - string value(""); + utils::NullString value; uint32_t rowsThisRowgroup = rowGroups[txnId]->getRowCount(); uint32_t columnsSelected = rowGroups[txnId]->getColumnCount(); std::vector fetchColTypes = rowGroups[txnId]->getColTypes(); @@ -3000,6 +2991,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin { for (unsigned i = 0; i < rowsThisRowgroup; i++) { + value.dropString(); rowGroups[txnId]->getRow(i, &row); if (row.isNullValue(fetchColPos)) @@ -3019,7 +3011,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin if (value.length() > (unsigned int)colType.colWidth) { - value = value.substr(0, colType.colWidth); + value.assign(value.safeString("").substr(0, colType.colWidth)); pushWarn = true; if (!pushWarning) @@ -3032,7 +3024,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin } WriteEngine::DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)value.c_str(); + dctTuple.sigValue = (unsigned char*)value.str(); dctTuple.sigSize = value.length(); dctTuple.isNull = false; @@ -3062,28 +3054,28 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin case CalpontSystemCatalog::DATE: { intColVal = row.getUintField<4>(fetchColPos); - value = DataConvert::dateToString(intColVal); + value.assign(DataConvert::dateToString(intColVal)); break; } case CalpontSystemCatalog::DATETIME: { intColVal = row.getUintField<8>(fetchColPos); - value = DataConvert::datetimeToString(intColVal, colType.precision); + value.assign(DataConvert::datetimeToString(intColVal, colType.precision)); break; } case CalpontSystemCatalog::TIMESTAMP: { intColVal = row.getUintField<8>(fetchColPos); - value = DataConvert::timestampToString(intColVal, timeZone, colType.precision); + value.assign(DataConvert::timestampToString(intColVal, timeZone, colType.precision)); break; } case CalpontSystemCatalog::TIME: { intColVal = row.getIntField<8>(fetchColPos); - value = DataConvert::timeToString(intColVal, colType.precision); + value.assign(DataConvert::timeToString(intColVal, colType.precision)); break; } @@ -3091,8 +3083,11 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin case CalpontSystemCatalog::VARCHAR: { value = row.getStringField(fetchColPos); - unsigned i = strlen(value.c_str()); - value = value.substr(0, i); + if (!value.isNull()) + { + unsigned i = strlen(value.str()); + value.assign(value.unsafeStringRef().substr(0, i)); + } break; } @@ -3100,7 +3095,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: { - value = row.getVarBinaryStringField(fetchColPos); + value.assign(row.getVarBinaryField(fetchColPos), row.getVarBinaryLength(fetchColPos)); break; } @@ -3111,7 +3106,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin { datatypes::Decimal dec(row.getTSInt128Field(fetchColPos), fetchColScales[fetchColPos], rowGroups[txnId]->getPrecision()[fetchColPos]); - value = dec.toString(true); + value.assign(dec.toString(true)); break; } } @@ -3145,13 +3140,13 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin else os << intColVal; - value = os.str(); + value.assign(os.str()); } else { datatypes::Decimal dec(intColVal, fetchColScales[fetchColPos], rowGroups[txnId]->getPrecision()[fetchColPos]); - value = dec.toString(); + value.assign(dec.toString()); } } break; @@ -3175,7 +3170,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; //@Bug 3350 fix the precision. os << setprecision(7) << dl; - value = os.str(); + value.assign(os.str()); break; } @@ -3195,7 +3190,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; //@Bug 3350 fix the precision. os << setprecision(16) << dl; - value = os.str(); + value.assign(os.str()); break; } @@ -3209,7 +3204,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; //@Bug 3350 fix the precision. os << setprecision(19) << dll; - value = os.str(); + value.assign(os.str()); break; } @@ -3218,7 +3213,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; intColVal = row.getUintField<8>(fetchColPos); os << intColVal; - value = os.str(); + value.assign(os.str()); break; } } @@ -3227,27 +3222,30 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin if (funcScale != 0) { - string::size_type pos = value.find_first_of("."); // decimal point + string str = value.safeString(""); + string::size_type pos = str.find_first_of("."); // decimal point - if (pos >= value.length()) - value.insert(value.length(), "."); + if (pos >= str.length()) + str.insert(str.length(), "."); // padding 0 if needed - pos = value.find_first_of("."); - uint32_t digitsAfterPoint = value.length() - pos - 1; + pos = str.find_first_of("."); + uint32_t digitsAfterPoint = str.length() - pos - 1; if (digitsAfterPoint < funcScale) { for (uint32_t i = 0; i < (funcScale - digitsAfterPoint); i++) - value += "0"; + str += "0"; } + + value.assign(str); } // check data length // trim the string if needed if (value.length() > (unsigned int)colType.colWidth) { - value = value.substr(0, colType.colWidth); + value.assign(value.unsafeStringRef().substr(0, colType.colWidth)); if (!pushWarn) pushWarn = true; @@ -3260,7 +3258,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin } WriteEngine::DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)value.c_str(); + dctTuple.sigValue = (unsigned char*)value.str(); dctTuple.sigSize = value.length(); dctTuple.isNull = false; @@ -3305,7 +3303,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin if (value.length() > (unsigned int)colType.colWidth) { - value = value.substr(0, colType.colWidth); + value.assign(value.safeString("").substr(0, colType.colWidth)); pushWarn = true; if (!pushWarning) @@ -3318,7 +3316,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin } WriteEngine::DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)value.c_str(); + dctTuple.sigValue = (unsigned char*)value.str(); dctTuple.sigSize = value.length(); dctTuple.isNull = false; error = fWEWrapper.tokenize(txnId, dctTuple, colType.compressionType); @@ -3348,11 +3346,12 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin } else { - value = columnsUpdated[j]->get_Data(); + idbassert(!columnsUpdated[j]->get_DataVector()[0].isNull()); + value = columnsUpdated[j]->get_DataVector()[0]; if (value.length() > (unsigned int)colType.colWidth) { - value = value.substr(0, colType.colWidth); + value.assign(value.unsafeStringRef().substr(0, colType.colWidth)); pushWarn = true; if (!pushWarning) @@ -3365,7 +3364,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin } WriteEngine::DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)value.c_str(); + dctTuple.sigValue = (unsigned char*)value.str(); dctTuple.sigSize = value.length(); dctTuple.isNull = false; error = fWEWrapper.tokenize(txnId, dctTuple, colType.compressionType); @@ -3405,7 +3404,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin if (row.isNullValue(fetchColPos)) { isNull = true; - value = ""; + value.dropString(); } else { @@ -3416,28 +3415,28 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin case CalpontSystemCatalog::DATE: { intColVal = row.getUintField<4>(fetchColPos); - value = DataConvert::dateToString(intColVal); + value.assign(DataConvert::dateToString(intColVal)); break; } case CalpontSystemCatalog::DATETIME: { intColVal = row.getUintField<8>(fetchColPos); - value = DataConvert::datetimeToString(intColVal, colType.precision); + value.assign(DataConvert::datetimeToString(intColVal, colType.precision)); break; } case CalpontSystemCatalog::TIMESTAMP: { intColVal = row.getUintField<8>(fetchColPos); - value = DataConvert::timestampToString(intColVal, timeZone, colType.precision); + value.assign(DataConvert::timestampToString(intColVal, timeZone, colType.precision)); break; } case CalpontSystemCatalog::TIME: { intColVal = row.getIntField<8>(fetchColPos); - value = DataConvert::timeToString(intColVal, colType.precision); + value.assign(DataConvert::timeToString(intColVal, colType.precision)); break; } @@ -3445,8 +3444,11 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin case CalpontSystemCatalog::VARCHAR: { value = row.getStringField(fetchColPos); - unsigned i = strlen(value.c_str()); - value = value.substr(0, i); + if (!value.isNull()) + { + unsigned i = strlen(value.str()); + value.assign(value.safeString().substr(0, i)); // XXX: why??? + } break; } @@ -3454,7 +3456,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin case CalpontSystemCatalog::BLOB: case CalpontSystemCatalog::TEXT: { - value = row.getVarBinaryStringField(fetchColPos); + value.assign(row.getVarBinaryField(fetchColPos), row.getVarBinaryLength(fetchColPos)); break; } @@ -3465,7 +3467,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin { datatypes::Decimal dec(row.getTSInt128Field(fetchColPos), fetchColScales[fetchColPos], rowGroups[txnId]->getPrecision()[fetchColPos]); - value = dec.toString(true); + value.assign(dec.toString(true)); break; } } @@ -3499,13 +3501,13 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin else os << intColVal; - value = os.str(); + value.assign(os.str()); } else { datatypes::Decimal dec(intColVal, fetchColScales[fetchColPos], rowGroups[txnId]->getPrecision()[fetchColPos]); - value = dec.toString(); + value.assign(dec.toString()); } } break; @@ -3529,7 +3531,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; //@Bug 3350 fix the precision. os << setprecision(7) << dl; - value = os.str(); + value.assign(os.str()); break; } @@ -3549,7 +3551,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; //@Bug 3350 fix the precision. os << setprecision(16) << dl; - value = os.str(); + value.assign(os.str()); break; } @@ -3563,7 +3565,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; //@Bug 3350 fix the precision. os << setprecision(19) << dll; - value = os.str(); + value.assign(os.str()); break; } @@ -3572,7 +3574,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin ostringstream os; intColVal = row.getUintField<8>(fetchColPos); os << intColVal; - value = os.str(); + value.assign(os.str()); break; } } @@ -3582,24 +3584,26 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin if (funcScale != 0) { - string::size_type pos = value.find_first_of("."); // decimal point + string str = value.safeString(""); + string::size_type pos = str.find_first_of("."); // decimal point - if (pos >= value.length()) - value.insert(value.length(), "."); + if (pos >= str.length()) + str.insert(str.length(), "."); // padding 0 if needed - pos = value.find_first_of("."); - uint32_t digitsAfterPoint = value.length() - pos - 1; + pos = str.find_first_of("."); + uint32_t digitsAfterPoint = str.length() - pos - 1; if (digitsAfterPoint < funcScale) { for (uint32_t i = 0; i < (funcScale - digitsAfterPoint); i++) - value += "0"; + str += "0"; } + value.assign(str); } // Check NOT NULL constraint and default value - if ((isNull) && (colType.defaultValue.length() <= 0) && + if ((isNull) && (colType.defaultValue.isNull()) && (colType.constraintType == CalpontSystemCatalog::NOTNULL_CONSTRAINT)) { rc = 1; @@ -3608,7 +3612,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin err = IDBErrorInfo::instance()->errorMsg(ERR_NOT_NULL_CONSTRAINTS, args); return rc; } - else if ((isNull) && (colType.defaultValue.length() > 0)) + else if ((isNull) && (!colType.defaultValue.isNull())) { isNull = false; bool oneWarn = false; @@ -3616,14 +3620,14 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin try { datavalue = - colType.convertColumnData(colType.defaultValue, pushWarn, timeZone, isNull, false, false); + colType.convertColumnData(colType.defaultValue.safeString(""), pushWarn, timeZone, isNull, false, false); } catch (exception&) { //@Bug 2624. Error out on conversion failure rc = 1; Message::Args args; - args.add(string("'") + colType.defaultValue + string("'")); + args.add(string("'") + colType.defaultValue.safeString() + string("'")); err = IDBErrorInfo::instance()->errorMsg(ERR_NON_NUMERIC_DATA, args); } @@ -3648,14 +3652,14 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin { try { - datavalue = colType.convertColumnData(value, pushWarn, timeZone, isNull, false, false); + datavalue = colType.convertColumnData(value.safeString(""), pushWarn, timeZone, isNull, false, false); } catch (exception&) { //@Bug 2624. Error out on conversion failure rc = 1; Message::Args args; - args.add(string("'") + value + string("'")); + args.add(string("'") + value.safeString() + string("'")); err = IDBErrorInfo::instance()->errorMsg(ERR_NON_NUMERIC_DATA, args); return rc; } @@ -3686,14 +3690,19 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin isNull = false; } - string inData(columnsUpdated[j]->get_Data()); - - if (((colType.colDataType == execplan::CalpontSystemCatalog::DATE) && (inData == "0000-00-00")) || - ((colType.colDataType == execplan::CalpontSystemCatalog::DATETIME) && - (inData == "0000-00-00 00:00:00")) || - ((colType.colDataType == execplan::CalpontSystemCatalog::TIMESTAMP) && - (inData == "0000-00-00 00:00:00"))) + NullString inData; + if (!isNull) { + inData = columnsUpdated[j]->get_DataVector()[0]; + } + + if (((colType.colDataType == execplan::CalpontSystemCatalog::DATE) && (inData.safeString("").compare("0000-00-00") == 0)) || + ((colType.colDataType == execplan::CalpontSystemCatalog::DATETIME) && + (inData.safeString("").compare("0000-00-00 00:00:00") == 0)) || + ((colType.colDataType == execplan::CalpontSystemCatalog::TIMESTAMP) && + (inData.safeString("").compare("0000-00-00 00:00:00") == 0))) + { + inData.dropString(); isNull = true; } @@ -3714,7 +3723,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin } } - if (colType.autoincrement && (isNull || (inData.compare("0") == 0))) + if (colType.autoincrement && (isNull || (inData.safeString("").compare("0") == 0))) { // reserve nextVal try @@ -3742,18 +3751,18 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin { ostringstream oss; oss << nextVal++; - inData = oss.str(); + inData.assign(oss.str()); try { - datavalue = colType.convertColumnData(inData, pushWarn, timeZone, isNull, false, false); + datavalue = colType.convertColumnData(inData, pushWarn, timeZone, false, false); } catch (exception&) { //@Bug 2624. Error out on conversion failure rc = 1; Message::Args args; - args.add(string("'") + inData + string("'")); + args.add(string("'") + inData.safeString() + string("'")); err = IDBErrorInfo::instance()->errorMsg(ERR_NON_NUMERIC_DATA, args); } @@ -3794,14 +3803,14 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin try { datavalue = - colType.convertColumnData(colType.defaultValue, pushWarn, timeZone, isNull, false, false); + colType.convertColumnData(colType.defaultValue.safeString(), pushWarn, timeZone, isNull, false, false); } catch (exception&) { //@Bug 2624. Error out on conversion failure rc = 1; Message::Args args; - args.add(string("'") + colType.defaultValue + string("'")); + args.add(string("'") + colType.defaultValue.safeString() + string("'")); err = IDBErrorInfo::instance()->errorMsg(ERR_NON_NUMERIC_DATA, args); } @@ -3827,7 +3836,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin { try { - datavalue = colType.convertColumnData(inData, pushWarn, timeZone, isNull, false, true); + datavalue = colType.convertColumnData(inData, pushWarn, timeZone, false, true); } catch (exception& ex) { @@ -3835,7 +3844,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs, std::strin rc = 1; cout << ex.what() << endl; Message::Args args; - args.add(string("'") + inData + string("'")); + args.add(string("'") + inData.safeString() + string("'")); err = IDBErrorInfo::instance()->errorMsg(ERR_NON_NUMERIC_DATA, args); return rc; } diff --git a/writeengine/server/we_dmlcommandproc.h b/writeengine/server/we_dmlcommandproc.h index c931f126f..3418e36b7 100644 --- a/writeengine/server/we_dmlcommandproc.h +++ b/writeengine/server/we_dmlcommandproc.h @@ -39,6 +39,7 @@ #include "we_rbmetawriter.h" #include "rowgroup.h" #include "we_log.h" +#include "nullstring.h" #define EXPORT @@ -123,7 +124,7 @@ class WE_DMLCommandProc const std::vector& files, const std::vector& oidsToFlush, std::string& err); - void processAuxCol(const std::vector& origVals, + void processAuxCol(const std::vector& origVals, WriteEngine::ColValueList& colValuesList, WriteEngine::DictStrList& dicStringList); diff --git a/writeengine/shared/we_type.h b/writeengine/shared/we_type.h index dca7c05db..27ebd9970 100644 --- a/writeengine/shared/we_type.h +++ b/writeengine/shared/we_type.h @@ -39,6 +39,7 @@ #include "calpontsystemcatalog.h" #include "IDBDataFile.h" #include "IDBPolicy.h" +#include "nullstring.h" #undef EXPORT #undef DELETE @@ -331,7 +332,7 @@ typedef std::vector ColValueList; /** @ typedef std::vector RIDList; /** @brief RID list */ typedef std::vector CSCTypesList; /** @brief CSC column types list */ -typedef std::vector dictStr; +typedef std::vector dictStr; typedef std::vector DictStrList; // dictionary @@ -408,7 +409,7 @@ struct JobColumn /** @brief Job Column Structure */ unsigned long long fDefaultUInt; /** @brief UnsignedInt col default*/ double fDefaultDbl; /** @brief Dbl/Flt column default */ int128_t fDefaultWideDecimal; /** @brief Wide decimal column default */ - std::string fDefaultChr; /** @brief Char column default */ + utils::NullString fDefaultChr; /** @brief Char column default */ JobColumn() : mapOid(0) , dataType(execplan::CalpontSystemCatalog::INT) diff --git a/writeengine/wrapper/writeengine.cpp b/writeengine/wrapper/writeengine.cpp index 3723e7137..474e7825d 100644 --- a/writeengine/wrapper/writeengine.cpp +++ b/writeengine/wrapper/writeengine.cpp @@ -791,7 +791,9 @@ void WriteEngineWrapper::convertValue(const CalpontSystemCatalog::ColType& cscCo case WriteEngine::WR_ULONGLONG: ((uint64_t*)valArray)[pos] = boost::any_cast(data); break; - case WriteEngine::WR_TOKEN: ((Token*)valArray)[pos] = boost::any_cast(data); break; + case WriteEngine::WR_TOKEN: + ((Token*)valArray)[pos] = boost::any_cast(data); + break; case WriteEngine::WR_BINARY: size_t size = cscColType.colWidth; @@ -1714,7 +1716,7 @@ int WriteEngineWrapper::insertColumnRecs( #if defined(XXX_WRITEENGINE_TOKENS_RANGES_XXX) int64_t strPrefix; #endif - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; col_iter->data = nullToken; @@ -1728,10 +1730,10 @@ int WriteEngineWrapper::insertColumnRecs( timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); #if defined(XXX_WRITEENGINE_TOKENS_RANGES_XXX) - strPrefix = encodeStringPrefix_check_null(dctTuple.sigValue, dctTuple.sigSize, + strPrefix = encodeStringPrefix(dctTuple.sigValue, dctTuple.sigSize, dctnryStructList[i].fCharsetNumber); #endif dctTuple.isNull = false; @@ -1782,7 +1784,7 @@ int WriteEngineWrapper::insertColumnRecs( #if defined(XXX_WRITEENGINE_TOKENS_RANGES_XXX) int64_t strPrefix; #endif - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; col_iter->data = nullToken; @@ -1796,7 +1798,7 @@ int WriteEngineWrapper::insertColumnRecs( timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); #if defined(XXX_WRITEENGINE_TOKENS_RANGES_XXX) strPrefix = encodeStringPrefix_check_null(dctTuple.sigValue, dctTuple.sigSize, @@ -2532,7 +2534,7 @@ int WriteEngineWrapper::insertColumnRecsBinary( { colValPtr = &colValueList[(i * rowsPerColumn) + rows]; - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; memcpy(colValPtr, &nullToken, 8); @@ -2543,7 +2545,7 @@ int WriteEngineWrapper::insertColumnRecsBinary( timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); dctTuple.isNull = false; rc = tokenize(txnid, dctTuple, dctnryStructList[i].fCompressionType); @@ -2589,7 +2591,7 @@ int WriteEngineWrapper::insertColumnRecsBinary( { colValPtr = &colValueList[(i * rowsPerColumn) + rows]; - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; memcpy(colValPtr, &nullToken, 8); @@ -2600,7 +2602,7 @@ int WriteEngineWrapper::insertColumnRecsBinary( timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); dctTuple.isNull = false; rc = tokenize(txnid, dctTuple, newDctnryStructList[i].fCompressionType); @@ -3107,7 +3109,7 @@ int WriteEngineWrapper::insertColumnRec_SYS(const TxnID& txnid, const CSCTypesLi for (uint32_t rows = 0; rows < (totalRow - rowsLeft); rows++) { - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; col_iter->data = nullToken; @@ -3118,7 +3120,7 @@ int WriteEngineWrapper::insertColumnRec_SYS(const TxnID& txnid, const CSCTypesLi timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); dctTuple.isNull = false; rc = tokenize(txnid, dctTuple, dctnryStructList[i].fCompressionType); @@ -3181,7 +3183,7 @@ int WriteEngineWrapper::insertColumnRec_SYS(const TxnID& txnid, const CSCTypesLi for (uint32_t rows = 0; rows < rowsLeft; rows++) { - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; col_iter->data = nullToken; @@ -3192,7 +3194,7 @@ int WriteEngineWrapper::insertColumnRec_SYS(const TxnID& txnid, const CSCTypesLi timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); dctTuple.isNull = false; rc = tokenize(txnid, dctTuple, newDctnryStructList[i].fCompressionType); @@ -3769,7 +3771,7 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid, const CSCType for (uint32_t rows = 0; rows < (totalRow - rowsLeft); rows++) { - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; col_iter->data = nullToken; @@ -3780,7 +3782,7 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid, const CSCType timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); dctTuple.isNull = false; rc = tokenize(txnid, dctTuple, dctnryStructList[i].fCompressionType); @@ -3844,7 +3846,7 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid, const CSCType for (uint32_t rows = 0; rows < rowsLeft; rows++) { - if (dctStr_iter->length() == 0) + if (dctStr_iter->isNull()) { Token nullToken; col_iter->data = nullToken; @@ -3855,7 +3857,7 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid, const CSCType timer.start("tokenize"); #endif DctnryTuple dctTuple; - dctTuple.sigValue = (unsigned char*)dctStr_iter->c_str(); + dctTuple.sigValue = (unsigned char*)dctStr_iter->str(); dctTuple.sigSize = dctStr_iter->length(); dctTuple.isNull = false; rc = tokenize(txnid, dctTuple, newDctnryStructList[i].fCompressionType); @@ -4218,7 +4220,7 @@ void WriteEngineWrapper::printInputValue(const ColStructList& colStructList, con { // We presume there will be a value. auto tokenOidIdx = oidToIdxMap[dctnryStructList[i].columnOid]; - std::cerr << "string [" << dictStrList[i][j] << "]" << std::endl; + std::cerr << "string [" << dictStrList[i][j].safeString("<>") << "]" << std::endl; bool isToken = colStructList[tokenOidIdx].colType == WriteEngine::WR_TOKEN && colStructList[tokenOidIdx].tokenFlag; if (isToken && !colValueList[tokenOidIdx][j].data.empty()) diff --git a/writeengine/xml/we_xmlgenproc.cpp b/writeengine/xml/we_xmlgenproc.cpp index 7be9fe2fe..784f21891 100644 --- a/writeengine/xml/we_xmlgenproc.cpp +++ b/writeengine/xml/we_xmlgenproc.cpp @@ -325,23 +325,24 @@ bool XMLGenProc::makeColumnData(const CalpontSystemCatalog::TableName& table) } // Include NotNull and Default value - const std::string col_defaultValue(col->colType.defaultValue); + const NullString col_defaultValue(col->colType.defaultValue); if (col->colType.constraintType == execplan::CalpontSystemCatalog::NOTNULL_CONSTRAINT) { int notNull = 1; xmlTextWriterWriteFormatAttribute(fWriter, BAD_CAST xmlTagTable[TAG_NOT_NULL], "%d", notNull); - if (!col_defaultValue.empty()) + if (!col_defaultValue.isNull()) { xmlTextWriterWriteAttribute(fWriter, BAD_CAST xmlTagTable[TAG_DEFAULT_VALUE], - BAD_CAST col_defaultValue.c_str()); + BAD_CAST col_defaultValue.unsafeStringRef().c_str()); } } else if (col->colType.constraintType == execplan::CalpontSystemCatalog::DEFAULT_CONSTRAINT) { + idbassert(!col_defaultValue.isNull()); // good enough for now. I have to figure out how to store the null. xmlTextWriterWriteAttribute(fWriter, BAD_CAST xmlTagTable[TAG_DEFAULT_VALUE], - BAD_CAST col_defaultValue.c_str()); + BAD_CAST (col_defaultValue.unsafeStringRef().c_str())); } } // end of "if fSysCatRpt" diff --git a/writeengine/xml/we_xmljob.cpp b/writeengine/xml/we_xmljob.cpp index f5bd25e3f..e5e9d6111 100644 --- a/writeengine/xml/we_xmljob.cpp +++ b/writeengine/xml/we_xmljob.cpp @@ -930,13 +930,13 @@ void XMLJob::fillInXMLDataAsLoaded(execplan::CalpontSystemCatalog::RIDList& colR void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, execplan::CalpontSystemCatalog::ColType& colType, JobColumn& col) { - const std::string col_defaultValue(colType.defaultValue); + const NullString col_defaultValue(colType.defaultValue); if (colType.constraintType == execplan::CalpontSystemCatalog::NOTNULL_CONSTRAINT) { col.fNotNull = true; - if (!col_defaultValue.empty()) + if (!col_defaultValue.isNull()) col.fWithDefault = true; } else if (colType.constraintType == execplan::CalpontSystemCatalog::DEFAULT_CONSTRAINT) @@ -963,7 +963,7 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, case execplan::CalpontSystemCatalog::BIGINT: { errno = 0; - col.fDefaultInt = strtoll(col_defaultValue.c_str(), 0, 10); + col.fDefaultInt = strtoll(col_defaultValue.str(), 0, 10); if (errno == ERANGE) bDefaultConvertError = true; @@ -978,7 +978,7 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, case execplan::CalpontSystemCatalog::UBIGINT: { errno = 0; - col.fDefaultUInt = strtoull(col_defaultValue.c_str(), 0, 10); + col.fDefaultUInt = strtoull(col_defaultValue.str(), 0, 10); if (errno == ERANGE) bDefaultConvertError = true; @@ -991,11 +991,11 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, { if (LIKELY(colType.colWidth == datatypes::MAXDECIMALWIDTH)) { - col.fDefaultWideDecimal = colType.decimal128FromString(col_defaultValue, &bDefaultConvertError); + col.fDefaultWideDecimal = colType.decimal128FromString(col_defaultValue.safeString(), &bDefaultConvertError); } else { - col.fDefaultInt = Convertor::convertDecimalString(col_defaultValue.c_str(), + col.fDefaultInt = Convertor::convertDecimalString(col_defaultValue.str(), col_defaultValue.length(), colType.scale); if (errno == ERANGE) @@ -1008,7 +1008,7 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, case execplan::CalpontSystemCatalog::DATE: { int convertStatus; - int32_t dt = dataconvert::DataConvert::convertColumnDate(col_defaultValue.c_str(), + int32_t dt = dataconvert::DataConvert::convertColumnDate(col_defaultValue.str(), dataconvert::CALPONTDATE_ENUM, convertStatus, col_defaultValue.length()); @@ -1023,7 +1023,7 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, { int convertStatus; int64_t dt = dataconvert::DataConvert::convertColumnDatetime( - col_defaultValue.c_str(), dataconvert::CALPONTDATETIME_ENUM, convertStatus, + col_defaultValue.str(), dataconvert::CALPONTDATETIME_ENUM, convertStatus, col_defaultValue.length()); if (convertStatus != 0) @@ -1037,7 +1037,7 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, { int convertStatus; int64_t dt = dataconvert::DataConvert::convertColumnTimestamp( - col_defaultValue.c_str(), dataconvert::CALPONTDATETIME_ENUM, convertStatus, + col_defaultValue.str(), dataconvert::CALPONTDATETIME_ENUM, convertStatus, col_defaultValue.length(), fTimeZone); if (convertStatus != 0) @@ -1050,7 +1050,7 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, case execplan::CalpontSystemCatalog::TIME: { int convertStatus; - int64_t dt = dataconvert::DataConvert::convertColumnTime(col_defaultValue.c_str(), + int64_t dt = dataconvert::DataConvert::convertColumnTime(col_defaultValue.str(), dataconvert::CALPONTTIME_ENUM, convertStatus, col_defaultValue.length()); @@ -1067,7 +1067,7 @@ void XMLJob::fillInXMLDataNotNullDefault(const std::string& fullTblName, case execplan::CalpontSystemCatalog::UDOUBLE: { errno = 0; - col.fDefaultDbl = strtod(col_defaultValue.c_str(), 0); + col.fDefaultDbl = strtod(col_defaultValue.str(), 0); if (errno == ERANGE) bDefaultConvertError = true; From 4eced2c23a241773b9f3698825f6605dde1b09d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilfredo=20Vel=C3=A1zquez-Rodr=C3=ADguez?= Date: Fri, 31 Mar 2023 08:57:31 -0400 Subject: [PATCH 4/6] Generate published package URL as part of new pipeline step (#2800) * Generate published package URL as part of pipeline step * Pull publish_pkg_url into local variable * Add dependency on 'publish pkg' step --- .drone.jsonnet | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.drone.jsonnet b/.drone.jsonnet index 27439d2ef..ae5242bb5 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -117,6 +117,8 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise') local brancht = if (branch == '**') then '' else branch + '-', local result = std.strReplace(std.strReplace(platform, ':', ''), '/', '-'), + local publish_pkg_url = "https://cspkg.s3.amazonaws.com/index.html?prefix=" + branchp + event + "/${DRONE_BUILD_NUMBER}/" + server + "/" + arch + "/" + result + "/", + local container_tags = if (event == 'cron') then [brancht + std.strReplace(event, '_', '-') + '${DRONE_BUILD_NUMBER}', brancht] else [brancht + std.strReplace(event, '_', '-') + '${DRONE_BUILD_NUMBER}'], local container_version = branchp + event + '/${DRONE_BUILD_NUMBER}/' + server + '/' + arch, @@ -627,6 +629,16 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise') }, ] + [pipeline.publish()] + + [ + { + name: 'publish pkg url', + depends_on: ['publish pkg'], + image: 'alpine/git', + commands: [ + "echo -e '\\e]8;;" + publish_pkg_url + "\\e\\\\" + publish_pkg_url + "\\e]8;;\\e\\\\'" + ] + } + ] + (if (event == 'cron') then [pipeline.publish('pkg latest', 'latest')] else []) + [pipeline.smoke] + [pipeline.smokelog] + From ac8881091b7c524394a47ec3fb5df0552ee951ae Mon Sep 17 00:00:00 2001 From: Leonid Fedorov <79837786+mariadb-LeonidFedorov@users.noreply.github.com> Date: Mon, 3 Apr 2023 20:54:43 +0300 Subject: [PATCH 5/6] Add color to build logswq (#2802) --- .drone.jsonnet | 4 +++- build/ansi2txt.sh | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100755 build/ansi2txt.sh diff --git a/.drone.jsonnet b/.drone.jsonnet index ae5242bb5..338c7c9a6 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -76,7 +76,9 @@ local platformMap(platform, arch) = 'ubuntu:22.04': bootstrap_deps + ' && ' + deb_build_deps + " && sleep $${BUILD_DELAY_SECONDS:-1s} && CMAKEFLAGS='" + cmakeflags + " -DDEB=jammy' debian/autobake-deb.sh", }; local result = std.strReplace(std.strReplace(platform, ':', ''), '/', '-'); - platform_map[platform] + ' | tee ' + result + '/build.log'; + "export CLICOLOR_FORCE=1; " + platform_map[platform] + " | storage/columnstore/columnstore/build/ansi2txt.sh " + result + "/build.log"; + + local testRun(platform) = diff --git a/build/ansi2txt.sh b/build/ansi2txt.sh new file mode 100755 index 000000000..009cd669c --- /dev/null +++ b/build/ansi2txt.sh @@ -0,0 +1,2 @@ +bash -c "tee >(sed $'s/\033[[][^A-Za-z]*m//g' > $1)" + From 2e1394149b656c0659a2f03320bbcfca015e13df Mon Sep 17 00:00:00 2001 From: Leonid Fedorov <79837786+mariadb-LeonidFedorov@users.noreply.github.com> Date: Tue, 4 Apr 2023 02:33:23 +0300 Subject: [PATCH 6/6] MCOL-5464: Fixes of bugs from ASAN warnings, part one (#2792) * Fixes of bugs from ASAN warnings, part one * MQC as static library, with nifty counter for global map and mutex * Switch clang to 16 * link messageqcpp to execplan --- .drone.jsonnet | 2 +- CMakeLists.txt | 9 +- build/bootstrap_mcs.sh | 132 ++++++++++++--- datatypes/mcs_decimal.h | 21 +++ dbcon/ddlpackageproc/libddlpackageproc.rc | 102 ----------- dbcon/dmlpackageproc/libdmlpackageproc.rc | 102 ----------- dbcon/execplan/CMakeLists.txt | 2 +- dbcon/execplan/calpontsystemcatalog.cpp | 1 + dbcon/joblist/libjoblist.rc | 102 ----------- dbcon/joblist/primitivemsg.h | 3 +- dbcon/joblist/tupleannexstep.cpp | 13 +- dbcon/joblist/tupleannexstep.h | 1 + dbcon/joblist/windowfunctionstep.cpp | 2 +- dbcon/mysql/ha_mcs.cpp | 2 +- dbcon/mysql/ha_mcs_execplan.cpp | 2 +- dbcon/mysql/ha_mcs_partition.cpp | 4 +- ddlproc/DDLProc.rc | 102 ----------- debian/mariadb-plugin-columnstore.install | 1 - dmlproc/DMLProc.rc | 102 ----------- oam/install_scripts/CMakeLists.txt | 28 +++ .../mcs-controllernode.service.in | 2 +- oam/install_scripts/mcs-ddlproc.service.in | 1 + oam/install_scripts/mcs-dmlproc.service.in | 1 + oam/install_scripts/mcs-primproc.service.in | 2 +- .../mcs-storagemanager.service.in | 2 +- oam/install_scripts/mcs-workernode.service.in | 1 + .../mcs-writeengineserver.service.in | 2 +- oam/oamcpp/liboamcpp.rc | 102 ----------- primitives/primproc/PrimProc.rc | 102 ----------- .../primproc/batchprimitiveprocessor.cpp | 2 +- primitives/primproc/batchprimitiveprocessor.h | 2 +- primitives/primproc/columncommand.cpp | 3 +- primitives/primproc/columncommand.h | 4 +- primitives/primproc/serviceexemgr.h | 6 +- primitives/primproc/sqlfrontsessionthread.cpp | 4 +- storage-manager/src/Config.h | 10 ++ storage-manager/src/MetadataFile.cpp | 9 + storage-manager/src/S3Storage.cpp | 9 + tests/scripts/fullmtr.sh | 16 +- tests/scripts/smoke.sql | 5 + tools/dbloadxml/colxml.rc | 102 ----------- utils/common/columnwidth.h | 12 +- utils/configcpp/configcpp.cpp | 43 ++--- utils/configcpp/configcpp.h | 11 ++ utils/configcpp/libconfigcpp.rc | 102 ----------- utils/configcpp/xmlparser.cpp | 1 + utils/dataconvert/dataconvert.cpp | 46 +---- utils/dataconvert/dataconvert.h | 15 ++ utils/funcexp/func_cast.cpp | 1 - utils/funcexp/func_date_add.cpp | 23 +++ utils/funcexp/func_json_unquote.cpp | 2 +- utils/idbdatafile/IDBFactory.cpp | 26 +-- utils/idbdatafile/IDBFactory.h | 34 ++-- utils/messageqcpp/CMakeLists.txt | 2 +- utils/messageqcpp/messagequeuepool.cpp | 104 +++++++----- utils/messageqcpp/messagequeuepool.h | 22 ++- utils/rowgroup/rowgroup.cpp | 106 +++--------- utils/rowgroup/rowgroup.h | 160 +++++++++--------- utils/udfsdk/libudf_mysql.rc | 102 ----------- utils/udfsdk/libudfsdk.rc | 102 ----------- versioning/BRM/slavecomm.cpp | 49 ++---- versioning/BRM/slavecomm.h | 14 +- versioning/BRM/slavenode.cpp | 16 +- writeengine/build/startdbrm | 2 - writeengine/build/we_rules.mak | 48 ------ writeengine/bulk/cpimport.rc | 100 ----------- writeengine/bulk/we_bulkloadbuffer.cpp | 10 +- writeengine/libwriteengine.rc | 102 ----------- writeengine/server/WriteEngineServer.rc | 102 ----------- writeengine/shared/we_fileop.cpp | 32 +--- writeengine/shared/we_fileop.h | 3 +- writeengine/shared/we_type.h | 4 +- writeengine/splitter/splitter.rc | 101 ----------- writeengine/splitter/we_cmdargs.cpp | 2 +- writeengine/wrapper/writeengine.cpp | 31 +++- writeengine/xml/we_xmljob.cpp | 30 +--- 76 files changed, 630 insertions(+), 2050 deletions(-) delete mode 100644 dbcon/ddlpackageproc/libddlpackageproc.rc delete mode 100644 dbcon/dmlpackageproc/libdmlpackageproc.rc delete mode 100644 dbcon/joblist/libjoblist.rc delete mode 100644 ddlproc/DDLProc.rc delete mode 100644 dmlproc/DMLProc.rc delete mode 100644 oam/oamcpp/liboamcpp.rc delete mode 100644 primitives/primproc/PrimProc.rc create mode 100644 tests/scripts/smoke.sql delete mode 100644 tools/dbloadxml/colxml.rc delete mode 100644 utils/configcpp/libconfigcpp.rc delete mode 100644 utils/udfsdk/libudf_mysql.rc delete mode 100644 utils/udfsdk/libudfsdk.rc delete mode 100755 writeengine/build/startdbrm delete mode 100644 writeengine/build/we_rules.mak delete mode 100644 writeengine/bulk/cpimport.rc delete mode 100644 writeengine/libwriteengine.rc delete mode 100644 writeengine/server/WriteEngineServer.rc delete mode 100644 writeengine/splitter/splitter.rc diff --git a/.drone.jsonnet b/.drone.jsonnet index 338c7c9a6..bcf566a89 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -31,7 +31,7 @@ local cmakeflags = '-DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_relea '-DPLUGIN_GSSAPI=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_SPHINX=NO ' + '-DWITH_EMBEDDED_SERVER=NO -DWITH_WSREP=NO -DWITH_COREDUMPS=ON'; -local clang_version = '14'; +local clang_version = '16'; local gcc_version = '11'; local clang_update_alternatives = 'update-alternatives --install /usr/bin/clang clang /usr/bin/clang-' + clang_version + ' 100 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-' + clang_version + ' && update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 '; diff --git a/CMakeLists.txt b/CMakeLists.txt index 27140dc82..ed5e63aee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,7 +205,7 @@ IF (NOT INSTALL_LAYOUT) ENDIF() OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ${security_default}) OPTION(SECURITY_HARDENED_NEW "Use new security-enhancing compilier features" OFF) - IF(SECURITY_HARDENED) + IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF) # security-enhancing flags MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") MY_CHECK_AND_SET_COMPILER_FLAG("-Wl,-z,relro,-z,now") @@ -237,10 +237,15 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-register") endif() +IF (WITH_COLUMNSTORE_ASAN) + MY_CHECK_AND_SET_COMPILER_FLAG("-U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) + MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fsanitize-address-use-after-scope -fPIC") +ENDIF() + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-copy" DEBUG RELEASE RELWITHDEBINFO MINSIZEREL) MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-declarations" DEBUG RELEASE RELWITHDEBINFO MINSIZEREL) -MY_CHECK_AND_SET_COMPILER_FLAG("-Werror -Wall") +MY_CHECK_AND_SET_COMPILER_FLAG("-Werror -Wall -Wextra") SET (ENGINE_LDFLAGS "-Wl,--no-as-needed -Wl,--add-needed") SET (ENGINE_DT_LIB datatypes) SET (ENGINE_COMMON_LIBS messageqcpp loggingcpp configcpp idbboot boost_thread xml2 pthread rt ${ENGINE_DT_LIB}) diff --git a/build/bootstrap_mcs.sh b/build/bootstrap_mcs.sh index 5f12f1927..5a61547a0 100755 --- a/build/bootstrap_mcs.sh +++ b/build/bootstrap_mcs.sh @@ -18,17 +18,25 @@ message "Building Mariadb Server from $color_yellow$MDB_SOURCE_PATH$color_normal BUILD_TYPE_OPTIONS=("Debug" "RelWithDebInfo") DISTRO_OPTIONS=("Ubuntu" "CentOS" "Debian" "Rocky") + +cd $SCRIPT_LOCATION +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) BRANCHES=($(git branch --list --no-color| grep "[^* ]+" -Eo)) +cd - + 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=D long=install-deps desc="Install dependences" variable=INSTALL_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=u long=skip-unit-tests desc="Skip UnitTests" variable=SKIP_UNIT_TESTS default=false value=true optparse.define short=B long=run-microbench="Compile and run microbenchmarks " variable=RUN_BENCHMARKS default=false value=true -optparse.define short=b long=branch desc="Choouse git branch ('none' for menu)" variable=BRANCH +optparse.define short=b long=branch desc="Choose git branch. For menu use -b \"\"" variable=BRANCH default=$CURRENT_BRANCH optparse.define short=D long=without-core-dumps desc="Do not produce core dumps" variable=WITHOUT_COREDUMPS default=false value=true +optparse.define short=A long=asan desc="Build with ASAN" variable=ASAN default=false value=true +optparse.define short=v long=verbose desc="Verbose makefile commands" variable=MAKEFILE_VERBOSE default=false value=true +optparse.define short=P long=report-path desc="Path for storing reports and profiles" variable=REPORT_PATH default="/core" source $( optparse.build ) @@ -45,18 +53,27 @@ INSTALL_PREFIX="/usr/" DATA_DIR="/var/lib/mysql/data" CMAKE_BIN_NAME=cmake CTEST_BIN_NAME=ctest +CONFIG_DIR="/etc/my.cnf.d" + +if [[ $OS = 'Ubuntu' || $OS = 'Debian' ]]; then + CONFIG_DIR="/etc/mysql/mariadb.conf.d" +fi + select_branch() { + cd $SCRIPT_LOCATION + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + if [[ ! " ${BRANCHES[*]} " =~ " ${BRANCH} " ]]; then - if [[ $BRANCH = 'none' ]]; then + if [[ $BRANCH = "" ]]; 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 [[ $BRANCH != $CURRENT_BRANCH ]]; then + message "Selecting $BRANCH branch for Columnstore" + git checkout $BRANCH + fi message "Turning off Columnstore submodule auto update via gitconfig" cd $MDB_SOURCE_PATH @@ -64,8 +81,6 @@ select_branch() cd - fi - cd $SCRIPT_LOCATION - CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) cd - message "Columnstore will be built from $color_yellow$CURRENT_BRANCH$color_normal branch" } @@ -136,7 +151,9 @@ clean_old_installation() rm -rf /var/lib/columnstore/local/ rm -f /var/lib/columnstore/storagemanager/storagemanager-lock rm -f /var/lib/columnstore/storagemanager/cs-initialized + rm -rf /var/log/mariadb/columnstore/* rm -rf /tmp/* + rm -rf $REPORT_PATH rm -rf /var/lib/mysql rm -rf /var/run/mysqld rm -rf $DATA_DIR @@ -161,7 +178,8 @@ build() -DWITH_WSREP=OFF -DWITH_SSL=system -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX - -DCMAKE_EXPORT_COMPILE_COMMANDS=1" + -DCMAKE_EXPORT_COMPILE_COMMANDS=1 + " if [[ $SKIP_UNIT_TESTS = true ]] ; then @@ -172,11 +190,21 @@ build() message "Buiding with unittests" fi + if [[ $ASAN = true ]] ; then + warn "Building with ASAN" + MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DWITH_ASAN=ON -DWITH_COLUMNSTORE_ASAN=ON -DWITH_COLUMNSTORE_REPORT_PATH=${REPORT_PATH}" + fi + if [[ $WITHOUT_COREDUMPS = true ]] ; then warn "Cores are not dumped" - else MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DWITH_COREDUMPS=ON" + echo "${REPORT_PATH}/core_%e.%p" | sudo tee /proc/sys/kernel/core_pattern + fi + + if [[ $MAKEFILE_VERBOSE = true ]] ; then + warn "Verbosing Makefile Commands" + MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" fi if [[ $RUN_BENCHMARKS = true ]] ; then @@ -197,7 +225,6 @@ build() message "Buiding without microbenchmarks" fi - cd $MDB_SOURCE_PATH if [[ $SKIP_SUBMODULES = true ]] ; then @@ -228,11 +255,13 @@ build() 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 + ${CMAKE_BIN_NAME} -DCMAKE_BUILD_TYPE=$MCS_BUILD_TYPE $MDB_CMAKE_FLAGS && \ | + make -j $CPUS + message "Installing silently" + make -j $CPUS install > /dev/null if [ $? -ne 0 ]; then - error "!!!! BUILD FAILED" + error "!!!! BUILD FAILED !!!!" exit 1 fi cd - @@ -259,7 +288,7 @@ run_unit_tests() else message "Running unittests" cd $MDB_SOURCE_PATH - ${CTEST_BIN_NAME} . -R columnstore: -j $(nproc) + ${CTEST_BIN_NAME} . -R columnstore: -j $(nproc) --progress cd - fi } @@ -271,14 +300,56 @@ run_microbenchmarks_tests() else message "Runnning microbenchmarks" cd $MDB_SOURCE_PATH - ${CTEST_BIN_NAME} . -V -R columnstore_microbenchmarks: -j $(nproc) + ${CTEST_BIN_NAME} . -V -R columnstore_microbenchmarks: -j $(nproc) --progress cd - fi } +disable_plugins_for_bootstrap() +{ + find /etc -type f -exec sed -i 's/plugin-load-add=auth_gssapi.so//g' {} + + find /etc -type f -exec sed -i 's/plugin-load-add=ha_columnstore.so//g' {} + +} + +enable_columnstore_back() +{ + echo plugin-load-add=ha_columnstore.so >> $CONFIG_DIR/columnstore.cnf +} + +fix_config_files() +{ + message Fixing config files + + THREAD_STACK_SIZE="20M" + + SYSTEMD_SERVICE_DIR="/usr/lib/systemd/system" + if [[ $ASAN = true ]] ; then + COLUMNSTORE_CONFIG=$CONFIG_DIR/columnstore.cnf + if grep -q thread_stack $COLUMNSTORE_CONFIG; then + warn "MDB Server has thread_stack settings on $COLUMNSTORE_CONFIG check it's compatibility with ASAN" + else + echo "thread_stack = ${THREAD_STACK_SIZE}" >> $COLUMNSTORE_CONFIG + message "thread_stack was set to ${THREAD_STACK_SIZE} in $COLUMNSTORE_CONFIG" + fi + + MDB_SERVICE_FILE=$SYSTEMD_SERVICE_DIR/mariadb.service + if grep -q ASAN $MDB_SERVICE_FILE; then + warn "MDB Server has ASAN options in $MDB_SERVICE_FILE, check it's compatibility" + else + echo Environment="'ASAN_OPTIONS=abort_on_error=1:disable_coredump=0,print_stats=false,detect_odr_violation=0,check_initialization_order=1,detect_stack_use_after_return=1,atexit=false,log_path=${ASAN_PATH}'" >> $MDB_SERVICE_FILE + message "ASAN options were added to $MDB_SERVICE_FILE" + fi + fi + systemctl daemon-reload +} + install() { message "Installing MariaDB" + disable_plugins_for_bootstrap + + mkdir -p $REPORT_PATH + chmod 777 $REPORT_PATH check_user_and_group @@ -288,10 +359,15 @@ install() 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 + mkdir -p /var/lib/mysql + chown mysql:mysql /var/lib/mysql + message "Running mysql_install_db" - mysql_install_db --rpm --user=mysql + sudo -u mysql mysql_install_db --rpm --user=mysql > /dev/null 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 + enable_columnstore_back + mkdir -p /etc/columnstore cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/oam/etc/Columnstore.xml /etc/columnstore/Columnstore.xml @@ -308,7 +384,7 @@ socket=/run/mysqld/mysqld.sock" > /etc/my.cnf.d/socket.cnf' > /etc/mysql/debian.cnf fi - systemctl daemon-reload + fix_config_files if [ -d "/etc/mysql/mariadb.conf.d/" ]; then message "Copying configs from /etc/mysql/mariadb.conf.d/ to /etc/my.cnf.d" @@ -345,9 +421,23 @@ socket=/run/mysqld/mysqld.sock" > /etc/my.cnf.d/socket.cnf' chmod 777 /var/log/mariadb/columnstore } + +smoke() +{ + message "Creating test database" + mariadb -e "create database if not exists test;" + message "Selecting magic numbers" + MAGIC=`mysql -N test < $MDB_SOURCE_PATH/storage/columnstore/columnstore/tests/scripts/smoke.sql` + if [[ $MAGIC == '42' ]] ; then + message "Great answer correct" + else + warn "Smoke failed, answer is '$MAGIC'" + fi +} + select_branch -if [[ $SKIP_DEPS = false ]] ; then +if [[ $INSTALL_DEPS = true ]] ; then install_deps fi @@ -358,4 +448,6 @@ run_unit_tests run_microbenchmarks_tests install start_service +smoke + message "$color_green FINISHED $color_normal" diff --git a/datatypes/mcs_decimal.h b/datatypes/mcs_decimal.h index 85907ee21..fb687fc17 100644 --- a/datatypes/mcs_decimal.h +++ b/datatypes/mcs_decimal.h @@ -165,6 +165,27 @@ const int128_t mcs_pow_10_128[20] = { 100000000000000000000000000000000000000_xxl, }; +const long long columnstore_precision[19] = {0, + 9, + 99, + 999, + 9999, + 99999, + 999999, + 9999999, + 99999999, + 999999999, + 9999999999LL, + 99999999999LL, + 999999999999LL, + 9999999999999LL, + 99999999999999LL, + 999999999999999LL, + 9999999999999999LL, + 99999999999999999LL, + 999999999999999999LL}; + + const int128_t ConversionRangeMaxValue[20] = {9999999999999999999_xxl, 99999999999999999999_xxl, 999999999999999999999_xxl, diff --git a/dbcon/ddlpackageproc/libddlpackageproc.rc b/dbcon/ddlpackageproc/libddlpackageproc.rc deleted file mode 100644 index abf70abc2..000000000 --- a/dbcon/ddlpackageproc/libddlpackageproc.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB DDL API" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "libddlpackageproc" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "libddlpackageproc.dll" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/dbcon/dmlpackageproc/libdmlpackageproc.rc b/dbcon/dmlpackageproc/libdmlpackageproc.rc deleted file mode 100644 index c8bbca741..000000000 --- a/dbcon/dmlpackageproc/libdmlpackageproc.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB DML API" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "libdmlpackageproc" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "libdmlpackageproc.dll" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/dbcon/execplan/CMakeLists.txt b/dbcon/execplan/CMakeLists.txt index e8d4d4585..6542a87c5 100755 --- a/dbcon/execplan/CMakeLists.txt +++ b/dbcon/execplan/CMakeLists.txt @@ -51,6 +51,6 @@ add_library(execplan SHARED ${execplan_LIB_SRCS}) add_dependencies(execplan loggingcpp) -target_link_libraries(execplan ${NETSNMP_LIBRARIES} ${MARIADB_STRING_LIBS} ${ENGINE_DT_LIB}) +target_link_libraries(execplan messageqcpp ${NETSNMP_LIBRARIES} ${MARIADB_STRING_LIBS} ${ENGINE_DT_LIB}) install(TARGETS execplan DESTINATION ${ENGINE_LIBDIR} COMPONENT columnstore-engine) diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 0d716ecc2..007024efd 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -54,6 +54,7 @@ using namespace joblist; #include "bytestream.h" #include "messagequeue.h" +#include "messagequeuepool.h" using namespace messageqcpp; #include "configcpp.h" diff --git a/dbcon/joblist/libjoblist.rc b/dbcon/joblist/libjoblist.rc deleted file mode 100644 index 7b0e36a47..000000000 --- a/dbcon/joblist/libjoblist.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB Job List API" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "libjoblist.dll" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "libjoblist.dll" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/dbcon/joblist/primitivemsg.h b/dbcon/joblist/primitivemsg.h index eb0c051d1..479e1535a 100644 --- a/dbcon/joblist/primitivemsg.h +++ b/dbcon/joblist/primitivemsg.h @@ -29,6 +29,7 @@ #include "blocksize.h" #include "calpontsystemcatalog.h" #include "joblisttypes.h" +#include #include @@ -711,7 +712,7 @@ const uint8_t ROUND_POS = 0x01; // actual value larger/longer than the stored v const uint8_t ROUND_NEG = 0x80; // actual value less than the stored value // Tied to ColByScanRequestHeader and ColByScanRangeRequestHeader. Check other headers if modifying. -struct NewColRequestHeader +struct /*alignas(utils::MAXCOLUMNWIDTH)*/ NewColRequestHeader { ISMPacketHeader ism; PrimitiveHeader hdr; diff --git a/dbcon/joblist/tupleannexstep.cpp b/dbcon/joblist/tupleannexstep.cpp index b95d90f16..c4aeff34e 100644 --- a/dbcon/joblist/tupleannexstep.cpp +++ b/dbcon/joblist/tupleannexstep.cpp @@ -298,7 +298,6 @@ void TupleAnnexStep::join() uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs) { - RGData rgDataOut; bool more = false; uint32_t rowCount = 0; @@ -306,18 +305,18 @@ uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs) { bs.restart(); - more = fOutputDL->next(fOutputIterator, &rgDataOut); + more = fOutputDL->next(fOutputIterator, &fRgDataOut); if (more && !cancelled()) { - fRowGroupDeliver.setData(&rgDataOut); + fRowGroupDeliver.setData(&fRgDataOut); fRowGroupDeliver.serializeRGData(bs); rowCount = fRowGroupDeliver.getRowCount(); } else { while (more) - more = fOutputDL->next(fOutputIterator, &rgDataOut); + more = fOutputDL->next(fOutputIterator, &fRgDataOut); fEndOfResult = true; } @@ -327,7 +326,7 @@ uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs) handleException(std::current_exception(), logging::ERR_IN_DELIVERY, logging::ERR_ALWAYS_CRITICAL, "TupleAnnexStep::nextBand()"); while (more) - more = fOutputDL->next(fOutputIterator, &rgDataOut); + more = fOutputDL->next(fOutputIterator, &fRgDataOut); fEndOfResult = true; } @@ -335,8 +334,8 @@ uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs) if (fEndOfResult) { // send an empty / error band - rgDataOut.reinit(fRowGroupDeliver, 0); - fRowGroupDeliver.setData(&rgDataOut); + fRgDataOut.reinit(fRowGroupDeliver, 0); + fRowGroupDeliver.setData(&fRgDataOut); fRowGroupDeliver.resetRowGroup(0); fRowGroupDeliver.setStatus(status()); fRowGroupDeliver.serializeRGData(bs); diff --git a/dbcon/joblist/tupleannexstep.h b/dbcon/joblist/tupleannexstep.h index dcdc064c3..4443d3641 100644 --- a/dbcon/joblist/tupleannexstep.h +++ b/dbcon/joblist/tupleannexstep.h @@ -118,6 +118,7 @@ class TupleAnnexStep : public JobStep, public TupleDeliveryStep rowgroup::RowGroup fRowGroupIn; rowgroup::RowGroup fRowGroupOut; rowgroup::RowGroup fRowGroupDeliver; + rowgroup::RGData fRgDataOut; rowgroup::Row fRowIn; rowgroup::Row fRowOut; diff --git a/dbcon/joblist/windowfunctionstep.cpp b/dbcon/joblist/windowfunctionstep.cpp index ab7b8ca89..0e6c57991 100644 --- a/dbcon/joblist/windowfunctionstep.cpp +++ b/dbcon/joblist/windowfunctionstep.cpp @@ -1054,7 +1054,7 @@ void WindowFunctionStep::doPostProcessForSelect() for (int64_t i = begin; i < end; i++) { - if (rgData.rowData.get() == NULL) + if (!rgData.hasRowData()) { rgCapacity = ((rowsLeft > 8192) ? 8192 : rowsLeft); rowsLeft -= rgCapacity; diff --git a/dbcon/mysql/ha_mcs.cpp b/dbcon/mysql/ha_mcs.cpp index 2ce38f2d3..a9c319f6d 100644 --- a/dbcon/mysql/ha_mcs.cpp +++ b/dbcon/mysql/ha_mcs.cpp @@ -1941,7 +1941,7 @@ int ha_mcs_cache::flush_insert_cache() int error, error2; ha_maria* from = cache_handler; uchar* record = table->record[0]; - ulonglong copied_rows = 0; + [[maybe_unused]] ulonglong copied_rows = 0; DBUG_ENTER("flush_insert_cache"); DBUG_ASSERT(from->file->state->records == share->cached_rows); diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index 794169477..9bd7f2908 100644 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -2962,7 +2962,7 @@ SimpleColumn* getSmallestColumn(boost::shared_ptr csc, CalpontSelectExecutionPlan::ReturnedColumnList::const_iterator iter; - ReturnedColumn* rc; + ReturnedColumn* rc = nullptr; for (iter = cols.begin(); iter != cols.end(); iter++) { diff --git a/dbcon/mysql/ha_mcs_partition.cpp b/dbcon/mysql/ha_mcs_partition.cpp index 65fb95c70..d817b464b 100644 --- a/dbcon/mysql/ha_mcs_partition.cpp +++ b/dbcon/mysql/ha_mcs_partition.cpp @@ -569,7 +569,7 @@ extern "C" void calshowpartitions_deinit(UDF_INIT* initid) { - delete initid->ptr; + delete[] initid->ptr; } const char* calshowpartitions(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length, @@ -1164,7 +1164,7 @@ extern "C" void calshowpartitionsbyvalue_deinit(UDF_INIT* initid) { - delete initid->ptr; + delete[] initid->ptr; } const char* calshowpartitionsbyvalue(UDF_INIT* initid, UDF_ARGS* args, char* result, diff --git a/ddlproc/DDLProc.rc b/ddlproc/DDLProc.rc deleted file mode 100644 index cb8b93952..000000000 --- a/ddlproc/DDLProc.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB DDL Processor" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "DDLProc" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "DDLProc.exe" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/debian/mariadb-plugin-columnstore.install b/debian/mariadb-plugin-columnstore.install index 5b271e07f..85ebdea7b 100644 --- a/debian/mariadb-plugin-columnstore.install +++ b/debian/mariadb-plugin-columnstore.install @@ -70,7 +70,6 @@ usr/lib/*/libjoiner.so usr/lib/*/liblibmysql_client.so usr/lib/*/libloggingcpp.so usr/lib/*/libmarias3.so -usr/lib/*/libmessageqcpp.so usr/lib/*/liboamcpp.so usr/lib/*/libquerystats.so usr/lib/*/libquerytele.so diff --git a/dmlproc/DMLProc.rc b/dmlproc/DMLProc.rc deleted file mode 100644 index d240733d8..000000000 --- a/dmlproc/DMLProc.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB DML Processor" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "DMLProc" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "DMLProc.exe" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/oam/install_scripts/CMakeLists.txt b/oam/install_scripts/CMakeLists.txt index 1614cb36d..e61184af4 100644 --- a/oam/install_scripts/CMakeLists.txt +++ b/oam/install_scripts/CMakeLists.txt @@ -8,6 +8,34 @@ if (WITH_COREDUMPS) endif (WITH_COREDUMPS) +SET(LD_PRELOAD_STRING "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}')") +SET(ALLOC_CONFIG "MALLOC_CONF=''") +SET(PRIMPROC_ALLOC_CONFIG ${ALLOC_CONFIG}) +SET(DMLPROC_ALLOC_CONFIG ${ALLOC_CONFIG}) +SET(DDLPROC_ALLOC_CONFIG ${ALLOC_CONFIG}) +SET(WRITEENGINE_ALLOC_CONFIG ${ALLOC_CONFIG}) +SET(CONTROLLERNODE_ALLOC_CONFIG ${ALLOC_CONFIG}) +SET(WORKERNODE_ALLOC_CONFIG ${ALLOC_CONFIG}) +SET(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG}) + + +if (WITH_COLUMNSTORE_ASAN) + SET(ASAN_PATH "/tmp/asan") + if (WITH_COLUMNSTORE_REPORT_PATH) + SET(ASAN_PATH "${WITH_COLUMNSTORE_REPORT_PATH}/asan") + endif (WITH_COLUMNSTORE_REPORT_PATH) + + + SET(LD_PRELOAD_STRING "") + SET(ALLOC_CONFIG "ASAN_OPTIONS=abort_on_error=1:disable_coredump=0,print_stats=false,detect_odr_violation=0,check_initialization_order=1,detect_stack_use_after_return=1,atexit=false,log_path=${ASAN_PATH}") + SET(PRIMPROC_ALLOC_CONFIG ${ALLOC_CONFIG}) + SET(DMLPROC_ALLOC_CONFIG ${ALLOC_CONFIG}) + SET(DDLPROC_ALLOC_CONFIG ${ALLOC_CONFIG}) + SET(WRITEENGINE_ALLOC_CONFIG ${ALLOC_CONFIG}) + SET(CONTROLLERNODE_ALLOC_CONFIG ${ALLOC_CONFIG}) + SET(WORKERNODE_ALLOC_CONFIG ${ALLOC_CONFIG}) + SET(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG}) +endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/columnstore-post-install.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstore-post-install" @ONLY) diff --git a/oam/install_scripts/mcs-controllernode.service.in b/oam/install_scripts/mcs-controllernode.service.in index 6827ada95..62b2ae4cb 100644 --- a/oam/install_scripts/mcs-controllernode.service.in +++ b/oam/install_scripts/mcs-controllernode.service.in @@ -13,7 +13,7 @@ Group=@DEFAULT_GROUP@ LimitNOFILE=65536 LimitNPROC=65536 LimitCORE=@CORE_DUMPS@ - +Environment="@CONTROLLERNODE_ALLOC_CONFIG@" ExecStart=@ENGINE_BINDIR@/controllernode ExecStop=@ENGINE_BINDIR@/mcs-stop-controllernode.sh $MAINPID diff --git a/oam/install_scripts/mcs-ddlproc.service.in b/oam/install_scripts/mcs-ddlproc.service.in index 1ba9275c9..5cc3f1003 100644 --- a/oam/install_scripts/mcs-ddlproc.service.in +++ b/oam/install_scripts/mcs-ddlproc.service.in @@ -14,6 +14,7 @@ LimitNOFILE=65536 LimitNPROC=65536 LimitCORE=@CORE_DUMPS@ +Environment="@DDLPROC_ALLOC_CONFIG@" ExecStart=@ENGINE_BINDIR@/DDLProc Restart=on-failure diff --git a/oam/install_scripts/mcs-dmlproc.service.in b/oam/install_scripts/mcs-dmlproc.service.in index 95ebe2f0d..0eb33b765 100644 --- a/oam/install_scripts/mcs-dmlproc.service.in +++ b/oam/install_scripts/mcs-dmlproc.service.in @@ -14,6 +14,7 @@ LimitNOFILE=65536 LimitNPROC=65536 LimitCORE=@CORE_DUMPS@ +Environment="@DMLPROC_ALLOC_CONFIG@" ExecStart=@ENGINE_BINDIR@/DMLProc Restart=on-failure diff --git a/oam/install_scripts/mcs-primproc.service.in b/oam/install_scripts/mcs-primproc.service.in index 3a2ada382..9ceba1512 100644 --- a/oam/install_scripts/mcs-primproc.service.in +++ b/oam/install_scripts/mcs-primproc.service.in @@ -16,7 +16,7 @@ LimitNPROC=65536 LimitCORE=@CORE_DUMPS@ ExecStartPre=/usr/bin/env bash -c "ldconfig -p | grep -m1 libjemalloc > /dev/null || echo 'Please install jemalloc to avoid ColumnStore performance degradation and unexpected service interruptions.'" -ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/PrimProc" +ExecStart=/usr/bin/env bash -c "@PRIMPROC_ALLOC_CONFIG@ @LD_PRELOAD_STRING@ exec @ENGINE_BINDIR@/PrimProc" Restart=on-failure TimeoutStopSec=2 diff --git a/oam/install_scripts/mcs-storagemanager.service.in b/oam/install_scripts/mcs-storagemanager.service.in index 87eb28e17..7752fa285 100644 --- a/oam/install_scripts/mcs-storagemanager.service.in +++ b/oam/install_scripts/mcs-storagemanager.service.in @@ -10,5 +10,5 @@ LimitNOFILE=65536 LimitNPROC=65536 LimitCORE=@CORE_DUMPS@ -ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/StorageManager" +ExecStart=/usr/bin/env bash -c "@STORAGEMANAGER_ALLOC_CONFIG@ @LD_PRELOAD_STRING@ exec @ENGINE_BINDIR@/StorageManager" SuccessExitStatus=255 diff --git a/oam/install_scripts/mcs-workernode.service.in b/oam/install_scripts/mcs-workernode.service.in index 9827ba872..b1cf7310f 100644 --- a/oam/install_scripts/mcs-workernode.service.in +++ b/oam/install_scripts/mcs-workernode.service.in @@ -11,6 +11,7 @@ LimitNOFILE=65536 LimitNPROC=65536 LimitCORE=@CORE_DUMPS@ +Environment="@WORKERNODE_ALLOC_CONFIG@" ExecStart=@ENGINE_BINDIR@/workernode DBRM_Worker%i ExecStopPost=@ENGINE_BINDIR@/mcs-savebrm.py ExecStopPost=/usr/bin/env bash -c "clearShm > /dev/null 2>&1" diff --git a/oam/install_scripts/mcs-writeengineserver.service.in b/oam/install_scripts/mcs-writeengineserver.service.in index 7b92e4da2..de225af5e 100644 --- a/oam/install_scripts/mcs-writeengineserver.service.in +++ b/oam/install_scripts/mcs-writeengineserver.service.in @@ -14,7 +14,7 @@ LimitNOFILE=65536 LimitNPROC=65536 LimitCORE=@CORE_DUMPS@ -ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/WriteEngineServer" +ExecStart=/usr/bin/env bash -c "@WRITEENGINE_ALLOC_CONFIG@ @LD_PRELOAD_STRING@ exec @ENGINE_BINDIR@/WriteEngineServer" Restart=on-failure TimeoutStopSec=20 diff --git a/oam/oamcpp/liboamcpp.rc b/oam/oamcpp/liboamcpp.rc deleted file mode 100644 index 00c76ea9c..000000000 --- a/oam/oamcpp/liboamcpp.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB OAM API" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "liboamcpp" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "liboamcpp.dll" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/primitives/primproc/PrimProc.rc b/primitives/primproc/PrimProc.rc deleted file mode 100644 index 54535710f..000000000 --- a/primitives/primproc/PrimProc.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB Primitive Processor" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "PrimProc" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "PrimProc.exe" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/primitives/primproc/batchprimitiveprocessor.cpp b/primitives/primproc/batchprimitiveprocessor.cpp index f9255d274..863b25d1b 100644 --- a/primitives/primproc/batchprimitiveprocessor.cpp +++ b/primitives/primproc/batchprimitiveprocessor.cpp @@ -931,7 +931,7 @@ void BatchPrimitiveProcessor::initProcessor() strValues.reset(new utils::NullString[LOGICAL_BLOCK_RIDS]); outMsgSize = defaultBufferSize; - outputMsg.reset(reinterpret_cast(aligned_alloc(utils::MAXCOLUMNWIDTH, outMsgSize))); + outputMsg.reset(new(std::align_val_t(MAXCOLUMNWIDTH)) uint8_t[outMsgSize]); if (ot == ROW_GROUP) { diff --git a/primitives/primproc/batchprimitiveprocessor.h b/primitives/primproc/batchprimitiveprocessor.h index 24ab96fbe..ed152d117 100644 --- a/primitives/primproc/batchprimitiveprocessor.h +++ b/primitives/primproc/batchprimitiveprocessor.h @@ -232,7 +232,7 @@ class BatchPrimitiveProcessor /* Common space for primitive data */ alignas(utils::MAXCOLUMNWIDTH) uint8_t blockData[BLOCK_SIZE * utils::MAXCOLUMNWIDTH]; uint8_t blockDataAux[BLOCK_SIZE * execplan::AUX_COL_WIDTH]; - boost::scoped_array outputMsg; + std::unique_ptr outputMsg; uint32_t outMsgSize; std::vector filterSteps; diff --git a/primitives/primproc/columncommand.cpp b/primitives/primproc/columncommand.cpp index fa2a880a7..6f7480074 100644 --- a/primitives/primproc/columncommand.cpp +++ b/primitives/primproc/columncommand.cpp @@ -631,7 +631,8 @@ void ColumnCommand::fillInPrimitiveMessageHeader(const int8_t outputType, const size_t inputMsgBufSize = baseMsgLength + (LOGICAL_BLOCK_RIDS * sizeof(primitives::RIDType)); if (!inputMsg) - inputMsg.reset(reinterpret_cast(aligned_alloc(utils::MAXCOLUMNWIDTH, inputMsgBufSize))); + inputMsg.reset(new(std::align_val_t(utils::MAXCOLUMNWIDTH)) uint8_t[inputMsgBufSize]); + primMsg = (NewColRequestHeader*)inputMsg.get(); outMsg = (ColResultHeader*)bpp->outputMsg.get(); diff --git a/primitives/primproc/columncommand.h b/primitives/primproc/columncommand.h index 19a4da597..cc08f6edb 100644 --- a/primitives/primproc/columncommand.h +++ b/primitives/primproc/columncommand.h @@ -30,6 +30,8 @@ #pragma once +#include +#include "columnwidth.h" #include "command.h" #include "calpontsystemcatalog.h" @@ -164,7 +166,7 @@ class ColumnCommand : public Command bool _isScan; - boost::scoped_array inputMsg; + std::unique_ptr inputMsg; NewColRequestHeader* primMsg; ColResultHeader* outMsg; diff --git a/primitives/primproc/serviceexemgr.h b/primitives/primproc/serviceexemgr.h index 905f77b0a..d605d557d 100644 --- a/primitives/primproc/serviceexemgr.h +++ b/primitives/primproc/serviceexemgr.h @@ -370,9 +370,9 @@ namespace exemgr // shared by multiple threads per session. ThreadCntPerSessionMap_t threadCntPerSessionMap_; std::mutex threadCntPerSessionMapMutex_; - ActiveStatementCounter* statementsRunningCount_; - joblist::DistributedEngineComm* dec_; - joblist::ResourceManager* rm_; + ActiveStatementCounter* statementsRunningCount_ = nullptr; + joblist::DistributedEngineComm* dec_ = nullptr; + joblist::ResourceManager* rm_ = nullptr; // Its attributes are set in Child() querytele::QueryTeleServerParms teleServerParms_; std::vector localNetIfaceSins_; diff --git a/primitives/primproc/sqlfrontsessionthread.cpp b/primitives/primproc/sqlfrontsessionthread.cpp index 5b43746f0..69cead754 100644 --- a/primitives/primproc/sqlfrontsessionthread.cpp +++ b/primitives/primproc/sqlfrontsessionthread.cpp @@ -248,7 +248,7 @@ void SQLFrontSessionThread::analyzeTableExecute(messageqcpp::ByteStream& bs, job auto rowCount = jl->projectTable(dummyTableOid, bs); while (rowCount) { - auto outRG = (static_cast(jl.get()))->getOutputRowGroup(); + auto const& outRG = (static_cast(jl.get()))->getOutputRowGroup(); statisticsManager->collectSample(outRG); rowCount = jl->projectTable(dummyTableOid, bs); } @@ -894,7 +894,7 @@ void SQLFrontSessionThread::operator()() std::unique_lock scoped(jlMutex); destructing++; std::thread bgdtor( - [jl, &jlMutex, &jlCleanupDone, stmtID, &li, &destructing, &msgLog] + [jl, &jlMutex, &jlCleanupDone, stmtID, li, &destructing, &msgLog] { std::unique_lock scoped(jlMutex); const_cast(jl).reset(); // this happens second; does real destruction diff --git a/storage-manager/src/Config.h b/storage-manager/src/Config.h index 30c485751..b7e9a75b1 100644 --- a/storage-manager/src/Config.h +++ b/storage-manager/src/Config.h @@ -17,7 +17,17 @@ #pragma once +#ifndef __clang__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include + +#ifndef __clang__ + #pragma GCC diagnostic pop +#endif + #include #include #include diff --git a/storage-manager/src/MetadataFile.cpp b/storage-manager/src/MetadataFile.cpp index 820e7fe06..b4fb327f8 100644 --- a/storage-manager/src/MetadataFile.cpp +++ b/storage-manager/src/MetadataFile.cpp @@ -22,7 +22,16 @@ #include #include #define BOOST_SPIRIT_THREADSAFE +#ifndef __clang__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include + +#ifndef __clang__ + #pragma GCC diagnostic pop +#endif #include #include #include diff --git a/storage-manager/src/S3Storage.cpp b/storage-manager/src/S3Storage.cpp index a07c79863..34ad1f9d6 100644 --- a/storage-manager/src/S3Storage.cpp +++ b/storage-manager/src/S3Storage.cpp @@ -27,7 +27,16 @@ #include #include #define BOOST_SPIRIT_THREADSAFE +#ifndef __clang__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include + +#ifndef __clang__ + #pragma GCC diagnostic pop +#endif #include #include "Utilities.h" diff --git a/tests/scripts/fullmtr.sh b/tests/scripts/fullmtr.sh index bf992b82d..d10bd8187 100644 --- a/tests/scripts/fullmtr.sh +++ b/tests/scripts/fullmtr.sh @@ -3,14 +3,14 @@ mysql -e "create database if not exists test;" SOCKET=`mysql -e "show variables like 'socket';" | grep socket | cut -f2` cd /usr/share/mysql/mysql-test -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/setup ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/basic | tee $CURRENT_DIR/mtr.basic.log 2>&1 -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/bugfixes | tee $CURRENT_DIR/mtr.bugfixes.log 2>&1 -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/devregression | tee $CURRENT_DIR/mtr.devregression.log 2>&1 -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/autopilot | tee $CURRENT_DIR/mtr.autopilot.log 2>&1 -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/extended | tee $CURRENT_DIR/mtr.extended.log 2>&1 -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/multinode | tee $CURRENT_DIR/mtr.multinode.log 2>&1 -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/oracle | tee $CURRENT_DIR/mtr.multinode.log 2>&1 -./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/1pmonly | tee $CURRENT_DIR/mtr.1pmonly.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/setup | tee $CURRENT_DIR/mtr.setup.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/bugfixes | tee $CURRENT_DIR/mtr.bugfixes.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/devregression | tee $CURRENT_DIR/mtr.devregression.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/autopilot | tee $CURRENT_DIR/mtr.autopilot.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/extended | tee $CURRENT_DIR/mtr.extended.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/multinode | tee $CURRENT_DIR/mtr.multinode.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/oracle | tee $CURRENT_DIR/mtr.oracle.log 2>&1 +./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/1pmonly | tee $CURRENT_DIR/mtr.1pmonly.log 2>&1 cd - diff --git a/tests/scripts/smoke.sql b/tests/scripts/smoke.sql new file mode 100644 index 000000000..3236cc0f9 --- /dev/null +++ b/tests/scripts/smoke.sql @@ -0,0 +1,5 @@ +DROP TABLE IF EXISTS smoke_table; +CREATE TABLE smoke_table(a int) ENGINE COLUMNSTORE; +INSERT INTO smoke_table VALUES(42); +SELECT * FROM smoke_table; +DROP TABLE smoke_table; diff --git a/tools/dbloadxml/colxml.rc b/tools/dbloadxml/colxml.rc deleted file mode 100644 index 017a2d66a..000000000 --- a/tools/dbloadxml/colxml.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB Bulk Load Utility" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "colxml" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "colxml.exe" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/utils/common/columnwidth.h b/utils/common/columnwidth.h index 60d161068..0c060ae89 100644 --- a/utils/common/columnwidth.h +++ b/utils/common/columnwidth.h @@ -21,8 +21,16 @@ namespace utils { -const uint8_t MAXLEGACYWIDTH = 8ULL; -const uint8_t MAXCOLUMNWIDTH = 16ULL; +constexpr uint8_t MAXLEGACYWIDTH = 8ULL; +constexpr uint8_t MAXCOLUMNWIDTH = 16ULL; + +struct AlignedDeleter +{ + void operator()(uint8_t* ptr) + { + operator delete[](ptr, std::align_val_t(utils::MAXCOLUMNWIDTH)); + }; +}; inline bool isWide(uint8_t width) { diff --git a/utils/configcpp/configcpp.cpp b/utils/configcpp/configcpp.cpp index df77f8600..33b08364e 100644 --- a/utils/configcpp/configcpp.cpp +++ b/utils/configcpp/configcpp.cpp @@ -69,15 +69,17 @@ const fs::path defaultConfigFilePath(configDefaultFileName); namespace config { -Config* globConfigInstancePtr = nullptr; -Config::configMap_t Config::fInstanceMap; boost::mutex Config::fInstanceMapMutex; +Config::configMap_t Config::fInstanceMap; // duplicate to that in the Config class boost::mutex Config::fXmlLock; // duplicate to that in the Config class boost::mutex Config::fWriteXmlLock; std::atomic_bool globHasConfig; +ConfigUniqPtr globConfigInstancePtr; + + void Config::checkAndReloadConfig() { struct stat statbuf; @@ -105,20 +107,20 @@ Config* Config::makeConfig(const string& cf) if (globConfigInstancePtr) { globConfigInstancePtr->checkAndReloadConfig(); - return globConfigInstancePtr; + return globConfigInstancePtr.get(); } // Make this configurable at least at compile-time. std::string configFilePath = std::string(MCSSYSCONFDIR) + std::string("/columnstore/") + configDefaultFileName; - globConfigInstancePtr = new Config(configFilePath); + globConfigInstancePtr.reset(new Config(configFilePath)); globHasConfig.store(true, std::memory_order_relaxed); - return globConfigInstancePtr; + return globConfigInstancePtr.get(); } boost::mutex::scoped_lock lk(fInstanceMapMutex); globConfigInstancePtr->checkAndReloadConfig(); - return globConfigInstancePtr; + return globConfigInstancePtr.get(); } boost::mutex::scoped_lock lk(fInstanceMapMutex); @@ -526,21 +528,6 @@ void Config::writeConfigFile(messageqcpp::ByteStream msg) const /* static */ void Config::deleteInstanceMap() { - boost::mutex::scoped_lock lk(fInstanceMapMutex); - - for (Config::configMap_t::iterator iter = fInstanceMap.begin(); iter != fInstanceMap.end(); ++iter) - { - Config* instance = iter->second; - delete instance; - } - - fInstanceMap.clear(); - - if (globConfigInstancePtr) - { - delete globConfigInstancePtr; - globConfigInstancePtr = nullptr; - } } /* static */ @@ -643,4 +630,18 @@ std::string Config::getTempFileDir(Config::TempDirPurpose what) return {}; } +void Config::ConfigDeleter::operator()(Config* config) +{ + boost::mutex::scoped_lock lk(fInstanceMapMutex); + + for (Config::configMap_t::iterator iter = fInstanceMap.begin(); iter != fInstanceMap.end(); ++iter) + { + Config* instance = iter->second; + delete instance; + } + + fInstanceMap.clear(); + delete config; +} + } // namespace config diff --git a/utils/configcpp/configcpp.h b/utils/configcpp/configcpp.h index 10ce3cfff..e170e26f3 100644 --- a/utils/configcpp/configcpp.h +++ b/utils/configcpp/configcpp.h @@ -56,6 +56,11 @@ namespace config class Config { public: + struct ConfigDeleter + { + void operator()(Config* config); + }; + /** @brief Config factory method * * Creates a singleton Config object @@ -249,8 +254,14 @@ class Config * */ void checkAndReloadConfig(); + }; + + +using ConfigUniqPtr = std::unique_ptr; + + } // namespace config #undef EXPORT diff --git a/utils/configcpp/libconfigcpp.rc b/utils/configcpp/libconfigcpp.rc deleted file mode 100644 index b3e02fb95..000000000 --- a/utils/configcpp/libconfigcpp.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB Config API" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "libconfigcpp" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "libconfigcpp.dll" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/utils/configcpp/xmlparser.cpp b/utils/configcpp/xmlparser.cpp index 37b6bddea..e36b7c094 100644 --- a/utils/configcpp/xmlparser.cpp +++ b/utils/configcpp/xmlparser.cpp @@ -150,6 +150,7 @@ void XMLParser::setConfig(xmlDocPtr doc, const string& section, const string& na { xmlAddChild(cur2, xmlNewText((const xmlChar*)"\t")); cur3 = cur2->xmlChildrenNode; + xmlFree(cur3->content); } else { diff --git a/utils/dataconvert/dataconvert.cpp b/utils/dataconvert/dataconvert.cpp index cc009338b..c82f98f19 100644 --- a/utils/dataconvert/dataconvert.cpp +++ b/utils/dataconvert/dataconvert.cpp @@ -48,26 +48,6 @@ using namespace logging; namespace { -const int64_t columnstore_precision[19] = {0, - 9, - 99, - 999, - 9999, - 99999, - 999999, - 9999999, - 99999999, - 999999999, - 9999999999LL, - 99999999999LL, - 999999999999LL, - 9999999999999LL, - 99999999999999LL, - 999999999999999LL, - 9999999999999999LL, - 99999999999999999LL, - 999999999999999999LL}; - template bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)) { @@ -475,25 +455,16 @@ void number_int_value(const string& data, cscDataType typeCode, if ((typeCode == datatypes::SystemCatalog::DECIMAL) || (typeCode == datatypes::SystemCatalog::UDECIMAL) || (ct.scale > 0)) { - T rangeUp, rangeLow; - - if (ct.precision < 19) + auto precision = + ct.precision == rowgroup::MagicPrecisionForCountAgg ? datatypes::INT128MAXPRECISION : ct.precision; + if (precision > datatypes::INT128MAXPRECISION || precision < 0) { - rangeUp = (T)columnstore_precision[ct.precision]; - } - else - { - auto precision = - ct.precision == rowgroup::MagicPrecisionForCountAgg ? datatypes::INT128MAXPRECISION : ct.precision; - if (precision > datatypes::INT128MAXPRECISION || precision < 0) - { - throw QueryDataExcept("Unsupported precision " + std::to_string(precision) + " converting DECIMAL ", - dataTypeErr); - } - rangeUp = datatypes::ConversionRangeMaxValue[ct.precision - 19]; + throw QueryDataExcept("Unsupported precision " + std::to_string(precision) + " converting DECIMAL ", + dataTypeErr); } - rangeLow = -rangeUp; + T rangeUp = dataconvert::decimalRangeUp(precision); + T rangeLow = -rangeUp; if (intVal > rangeUp) { @@ -2849,7 +2820,8 @@ int64_t DataConvert::stringToTime(const string& data) { if (!hasDate) { - day = strtol(data.substr(0, pos).c_str(), &end, 10); + std::string tmpDataSegment = data.substr(0, pos); + day = strtol(tmpDataSegment.c_str(), &end, 10); if (*end != '\0') return -1; diff --git a/utils/dataconvert/dataconvert.h b/utils/dataconvert/dataconvert.h index e755796d7..136b6df0b 100644 --- a/utils/dataconvert/dataconvert.h +++ b/utils/dataconvert/dataconvert.h @@ -104,6 +104,7 @@ const int64_t IDB_pow[19] = {1, 100000000000000000LL, 1000000000000000000LL}; + const int32_t SECS_PER_MIN = 60; const int32_t MINS_PER_HOUR = 60; const int32_t HOURS_PER_DAY = 24; @@ -1553,6 +1554,20 @@ inline int128_t strtoll128(const char* data, bool& saturate, char** ep) return res; } + +template +T decimalRangeUp(int32_t precision) +{ + if (precision < 19) + { + return (T)datatypes::columnstore_precision[precision]; + } + else + { + return datatypes::ConversionRangeMaxValue[precision - 19]; + } +} + template <> inline int128_t string_to_ll(const std::string& data, bool& bSaturate) { diff --git a/utils/funcexp/func_cast.cpp b/utils/funcexp/func_cast.cpp index c95403756..65f4036c0 100644 --- a/utils/funcexp/func_cast.cpp +++ b/utils/funcexp/func_cast.cpp @@ -1072,7 +1072,6 @@ IDB_Decimal Func_cast_decimal::getDecimalVal(Row& row, FunctionParm& parm, bool& if (decimal.isTSInt128ByPrecision()) { int128_t max_number_decimal = datatypes::ConversionRangeMaxValue[max_length - 19]; - uint128_t uval = parm[0]->data()->getUintVal(row, isNull); if (uval > (uint128_t)datatypes::Decimal::maxInt128) diff --git a/utils/funcexp/func_date_add.cpp b/utils/funcexp/func_date_add.cpp index 5c877b3a7..6c5e27bb6 100644 --- a/utils/funcexp/func_date_add.cpp +++ b/utils/funcexp/func_date_add.cpp @@ -591,6 +591,12 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ if (-day < month_length[monthSave]) { + if (monthSave == 0) + { + monthSave = 12; + tmpYear--; + } + month--; monthSave--; @@ -613,6 +619,12 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ // BUG 5448 - changed from '==' to '<=' if (day <= 0) { + if (monthSave == 0) + { + monthSave = 12; + tmpYear--; + } + month--; monthSave--; @@ -635,6 +647,17 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ break; } + if (monthSave == 0) + { + monthSave = 12; + tmpYear--; + + if (isLeapYear(tmpYear)) + month_length[2] = 29; + else + month_length[2] = 28; + } + month--; monthSave--; diff --git a/utils/funcexp/func_json_unquote.cpp b/utils/funcexp/func_json_unquote.cpp index 267e1c8b0..5063022fe 100644 --- a/utils/funcexp/func_json_unquote.cpp +++ b/utils/funcexp/func_json_unquote.cpp @@ -37,7 +37,7 @@ std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, b if (unlikely(jsEg.s.error) || jsEg.value_type != JSON_VALUE_STRING) return js.safeString(); - char* buf = (char*)alloca(jsEg.value_len); + char* buf = (char*)alloca(jsEg.value_len + 1); if ((strLen = json_unescape(cs, jsEg.value, jsEg.value + jsEg.value_len, &my_charset_utf8mb3_general_ci, (uchar*)buf, (uchar*)(buf + jsEg.value_len))) >= 0) { diff --git a/utils/idbdatafile/IDBFactory.cpp b/utils/idbdatafile/IDBFactory.cpp index b3d2e0feb..ce32158e4 100644 --- a/utils/idbdatafile/IDBFactory.cpp +++ b/utils/idbdatafile/IDBFactory.cpp @@ -47,15 +47,10 @@ bool IDBFactory::installDefaultPlugins() // protect these methods since we are changing our static data structure boost::mutex::scoped_lock lock(fac_guard); - s_plugins[IDBDataFile::BUFFERED] = - FileFactoryEnt(IDBDataFile::BUFFERED, "buffered", new BufferedFileFactory(), new PosixFileSystem()); - s_plugins[IDBDataFile::UNBUFFERED] = FileFactoryEnt(IDBDataFile::UNBUFFERED, "unbuffered", - new UnbufferedFileFactory(), new PosixFileSystem()); - - // TODO: use the installPlugin fcn below instead of declaring this statically, then remove the dependency - // IDBDatafile -> cloudio - // s_plugins[IDBDataFile::CLOUD] = FileFactoryEnt(IDBDataFile::CLOUD, "cloud", new SMFileFactory(), new - // SMFileSystem()); + s_plugins.emplace(IDBDataFile::BUFFERED, FileFactoryEnt(IDBDataFile::BUFFERED, "buffered", new BufferedFileFactory(), + new PosixFileSystem())); + s_plugins.emplace(IDBDataFile::UNBUFFERED, FileFactoryEnt(IDBDataFile::UNBUFFERED, "unbuffered", + new UnbufferedFileFactory(), new PosixFileSystem())); return false; } @@ -86,7 +81,7 @@ bool IDBFactory::installPlugin(const std::string& plugin) } FileFactoryEnt ent = (*(FileFactoryEntryFunc)functor)(); - s_plugins[ent.type] = ent; + s_plugins.emplace(ent.type, std::move(ent)); std::ostringstream oss; oss << "IDBFactory::installPlugin: installed filesystem plugin " << plugin; @@ -112,7 +107,7 @@ IDBDataFile* IDBFactory::open(IDBDataFile::Types type, const char* fname, const throw std::runtime_error(oss.str()); } - return s_plugins[type].factory->open(fname, mode, opts, colWidth); + return s_plugins.at(type).factory->open(fname, mode, opts, colWidth); } IDBFileSystem& IDBFactory::getFs(IDBDataFile::Types type) @@ -124,7 +119,14 @@ IDBFileSystem& IDBFactory::getFs(IDBDataFile::Types type) throw std::runtime_error(oss.str()); } - return *(s_plugins[type].filesystem); + return *(s_plugins.at(type).filesystem); } +FileFactoryEnt::~FileFactoryEnt() +{ + delete filesystem; + delete factory; +} + + } // namespace idbdatafile diff --git a/utils/idbdatafile/IDBFactory.h b/utils/idbdatafile/IDBFactory.h index ab17111e7..da4809db5 100644 --- a/utils/idbdatafile/IDBFactory.h +++ b/utils/idbdatafile/IDBFactory.h @@ -31,21 +31,31 @@ class IDBFileSystem; struct FileFactoryEnt { - FileFactoryEnt() : type(IDBDataFile::UNKNOWN), name("unknown"), factory(0), filesystem(0) - { - ; - } - FileFactoryEnt(IDBDataFile::Types t, const std::string& n, FileFactoryBase* f, IDBFileSystem* fs) : type(t), name(n), factory(f), filesystem(fs) { ; } - IDBDataFile::Types type; - std::string name; - FileFactoryBase* factory; - IDBFileSystem* filesystem; + FileFactoryEnt(const FileFactoryEnt&) = delete; + FileFactoryEnt& operator=(const FileFactoryEnt&) = delete; + FileFactoryEnt& operator=(FileFactoryEnt&&) = delete; + FileFactoryEnt(FileFactoryEnt&& temporary) + : factory(temporary.factory) + , filesystem(temporary.filesystem) + { + temporary.factory = nullptr; + temporary.filesystem = nullptr; + } + + + + ~FileFactoryEnt(); + + IDBDataFile::Types type = IDBDataFile::UNKNOWN; + std::string name = "unknown"; + FileFactoryBase* factory = nullptr; + IDBFileSystem* filesystem = nullptr; }; typedef FileFactoryEnt (*FileFactoryEntryFunc)(); @@ -101,8 +111,8 @@ class IDBFactory static FactoryMap s_plugins; - IDBFactory(); - virtual ~IDBFactory(); + IDBFactory() = delete; + ~IDBFactory() = delete; }; inline const std::string& IDBFactory::name(IDBDataFile::Types type) @@ -112,7 +122,7 @@ inline const std::string& IDBFactory::name(IDBDataFile::Types type) throw std::runtime_error("unknown plugin type in IDBFactory::name"); } - return s_plugins[type].name; + return s_plugins.at(type).name; } } // namespace idbdatafile diff --git a/utils/messageqcpp/CMakeLists.txt b/utils/messageqcpp/CMakeLists.txt index fcc2577de..1516d948d 100644 --- a/utils/messageqcpp/CMakeLists.txt +++ b/utils/messageqcpp/CMakeLists.txt @@ -14,7 +14,7 @@ set(messageqcpp_LIB_SRCS bytestreampool.cpp ) -add_library(messageqcpp SHARED ${messageqcpp_LIB_SRCS}) +add_library(messageqcpp STATIC ${messageqcpp_LIB_SRCS}) add_dependencies(messageqcpp loggingcpp) diff --git a/utils/messageqcpp/messagequeuepool.cpp b/utils/messageqcpp/messagequeuepool.cpp index 7d6891b6b..0671e02b4 100644 --- a/utils/messageqcpp/messagequeuepool.cpp +++ b/utils/messageqcpp/messagequeuepool.cpp @@ -15,23 +15,51 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include +#include #include "messagequeuepool.h" #include "messagequeue.h" +#include +#include + + namespace messageqcpp { -std::mutex& getQueueMutex() +using ClientMapType = std::multimap>; + +struct LockedClientMap { - static std::mutex queueMutex; - return queueMutex; + LockedClientMap() + { + } + ~LockedClientMap() + { + } + ClientMapType clientMap; + std::mutex queueMutex; +}; + +static int clientMapNiftyCounter; + +static typename std::aligned_storage::type clientMapBuf; + +auto& lockedMap = reinterpret_cast(clientMapBuf); + + +LockedClientMapInitilizer::LockedClientMapInitilizer () +{ + if (clientMapNiftyCounter++ == 0) new (&lockedMap) LockedClientMap (); // placement new +} +LockedClientMapInitilizer::~LockedClientMapInitilizer () +{ + if (--clientMapNiftyCounter == 0) (&lockedMap)->~LockedClientMap(); } -// Make linker happy -std::multimap MessageQueueClientPool::clientMap; // 300 seconds idle until cleanup #define MAX_IDLE_TIME 300 @@ -43,7 +71,7 @@ static uint64_t TimeSpecToSeconds(struct timespec* ts) MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& dnOrIp, uint64_t port) { - std::scoped_lock lock(getQueueMutex()); + auto lock = std::scoped_lock(lockedMap.queueMutex); std::ostringstream oss; oss << dnOrIp << "_" << port; @@ -63,16 +91,17 @@ MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& dnOrI clock_gettime(CLOCK_MONOTONIC, &now); uint64_t nowSeconds = TimeSpecToSeconds(&now); - newClientObject->client = new MessageQueueClient(dnOrIp, port); + newClientObject->client.reset(new MessageQueueClient(dnOrIp, port)); newClientObject->inUse = true; newClientObject->lastUsed = nowSeconds; - clientMap.insert(std::pair(searchString, newClientObject)); - return newClientObject->client; + lockedMap.clientMap.emplace(std::move(searchString), std::move(newClientObject)); + return newClientObject->client.get(); } MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& module) { - std::scoped_lock lock(getQueueMutex()); + auto lock = std::scoped_lock(lockedMap.queueMutex); + MessageQueueClient* returnClient = MessageQueueClientPool::findInPool(module); @@ -83,16 +112,19 @@ MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& modul } // We didn't find one, create new one - ClientObject* newClientObject = new ClientObject(); + auto newClientObject = std::make_unique(); struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); uint64_t nowSeconds = TimeSpecToSeconds(&now); - newClientObject->client = new MessageQueueClient(module); + + + newClientObject->client.reset(new MessageQueueClient(module)); newClientObject->inUse = true; newClientObject->lastUsed = nowSeconds; - clientMap.insert(std::pair(module, newClientObject)); - return newClientObject->client; + auto result = newClientObject->client.get(); + lockedMap.clientMap.emplace(std::move(module), std::move(newClientObject)); + return result; } MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search) @@ -102,40 +134,37 @@ MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search uint64_t nowSeconds = TimeSpecToSeconds(&now); MessageQueueClient* returnClient = NULL; - std::multimap::iterator it = clientMap.begin(); + auto it = lockedMap.clientMap.begin(); + // Scan pool - while (it != clientMap.end()) + while (it != lockedMap.clientMap.end()) { - ClientObject* clientObject = it->second; + ClientObject* clientObject = it->second.get(); uint64_t elapsedTime = nowSeconds - clientObject->lastUsed; // If connection hasn't been used for MAX_IDLE_TIME we probably don't need it so drop it // Don't drop in use connections that have been in use a long time if ((elapsedTime >= MAX_IDLE_TIME) && (!clientObject->inUse)) { - delete clientObject->client; - delete clientObject; // Do this so we don't invalidate current interator - std::multimap::iterator toDelete = it; + auto toDelete = it; it++; - clientMap.erase(toDelete); + lockedMap.clientMap.erase(toDelete); continue; } if (!clientObject->inUse) { - MessageQueueClient* client = clientObject->client; + MessageQueueClient* client = clientObject->client.get(); // If the unused socket isn't connected or has data pending read, destroy it if (!client->isConnected() || client->hasData()) { - delete client; - delete clientObject; // Do this so we don't invalidate current interator - std::multimap::iterator toDelete = it; + auto toDelete = it; it++; - clientMap.erase(toDelete); + lockedMap.clientMap.erase(toDelete); continue; } } @@ -145,7 +174,7 @@ MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search { if ((returnClient == NULL) && (!clientObject->inUse)) { - returnClient = clientObject->client; + returnClient = clientObject->client.get(); clientObject->inUse = true; return returnClient; } @@ -165,12 +194,12 @@ void MessageQueueClientPool::releaseInstance(MessageQueueClient* client) if (client == NULL) return; - std::scoped_lock lock(getQueueMutex()); - std::multimap::iterator it = clientMap.begin(); + auto lock = std::scoped_lock(lockedMap.queueMutex); + auto it = lockedMap.clientMap.begin(); - while (it != clientMap.end()) + while (it != lockedMap.clientMap.end()) { - if (it->second->client == client) + if (it->second->client.get() == client) { struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); @@ -193,16 +222,15 @@ void MessageQueueClientPool::deleteInstance(MessageQueueClient* client) if (client == NULL) return; - std::scoped_lock lock(getQueueMutex()); - std::multimap::iterator it = clientMap.begin(); - while (it != clientMap.end()) + auto lock = std::scoped_lock(lockedMap.queueMutex); + auto it = lockedMap.clientMap.begin(); + + while (it != lockedMap.clientMap.end()) { - if (it->second->client == client) + if (it->second->client.get() == client) { - delete it->second->client; - delete it->second; - clientMap.erase(it); + lockedMap.clientMap.erase(it); return; } diff --git a/utils/messageqcpp/messagequeuepool.h b/utils/messageqcpp/messagequeuepool.h index 418f0a87b..17899b76a 100644 --- a/utils/messageqcpp/messagequeuepool.h +++ b/utils/messageqcpp/messagequeuepool.h @@ -19,18 +19,24 @@ #include #include "messagequeue.h" +#include + +#include namespace messageqcpp { + + +static struct LockedClientMapInitilizer { + LockedClientMapInitilizer (); + ~LockedClientMapInitilizer (); +} clientMapInitilizer; // static initializer for every translation unit + struct ClientObject { - MessageQueueClient* client; - uint64_t lastUsed; - bool inUse; - - ClientObject() : client(NULL), lastUsed(0), inUse(false) - { - } + std::unique_ptr client; + uint64_t lastUsed = 0; + bool inUse = false; }; class MessageQueueClientPool @@ -45,8 +51,6 @@ class MessageQueueClientPool private: MessageQueueClientPool(){}; ~MessageQueueClientPool(){}; - - static std::multimap clientMap; }; } // namespace messageqcpp diff --git a/utils/rowgroup/rowgroup.cpp b/utils/rowgroup/rowgroup.cpp index 0f9826759..a316faa54 100644 --- a/utils/rowgroup/rowgroup.cpp +++ b/utils/rowgroup/rowgroup.cpp @@ -50,19 +50,7 @@ namespace rowgroup { using cscType = execplan::CalpontSystemCatalog::ColDataType; -StringStore::StringStore() : empty(true), fUseStoreStringMutex(false) -{ -} -StringStore::StringStore(const StringStore&) -{ - throw logic_error("Don't call StringStore copy ctor"); -} - -StringStore& StringStore::operator=(const StringStore&) -{ - throw logic_error("Don't call StringStore operator="); -} StringStore::~StringStore() { @@ -86,10 +74,10 @@ StringStore::~StringStore() uint64_t StringStore::storeString(const uint8_t* data, uint32_t len) { - MemChunk* lastMC = NULL; + MemChunk* lastMC = nullptr; uint64_t ret = 0; - empty = false; // At least a NULL is being stored. + empty = false; // At least a nullptr is being stored. // Sometimes the caller actually wants "" to be returned....... argggghhhh...... // if (len == 0) @@ -121,7 +109,7 @@ uint64_t StringStore::storeString(const uint8_t* data, uint32_t len) } else { - if ((lastMC == NULL) || (lastMC->capacity - lastMC->currentSize < (len + 4))) + if ((lastMC == nullptr) || (lastMC->capacity - lastMC->currentSize < (len + 4))) { // mem usage debugging // if (lastMC) @@ -215,20 +203,12 @@ void StringStore::clear() empty = true; } -UserDataStore::UserDataStore() : fUseUserDataMutex(false) -{ -} - -UserDataStore::~UserDataStore() -{ -} - uint32_t UserDataStore::storeUserData(mcsv1sdk::mcsv1Context& context, boost::shared_ptr data, uint32_t len) { uint32_t ret = 0; - if (len == 0 || data == NULL) + if (len == 0 || data == nullptr) { return numeric_limits::max(); } @@ -305,7 +285,7 @@ void UserDataStore::deserialize(ByteStream& bs) } mcsv1sdk::mcsv1_UDAF::ReturnCode rc; - mcsv1sdk::UserData* userData = NULL; + mcsv1sdk::UserData* userData = nullptr; rc = funcIter->second->createUserData(userData, vStoreData[i].length); if (rc != mcsv1sdk::mcsv1_UDAF::SUCCESS) @@ -323,10 +303,6 @@ void UserDataStore::deserialize(ByteStream& bs) return; } -RGData::RGData() -{ - // cout << "rgdata++ = " << __sync_add_and_fetch(&rgDataCount, 1) << endl; -} RGData::RGData(const RowGroup& rg, uint32_t rowCount) { @@ -336,6 +312,9 @@ RGData::RGData(const RowGroup& rg, uint32_t rowCount) if (rg.usesStringTable() && rowCount > 0) strings.reset(new StringStore()); + userDataStore.reset(); + + #ifdef VALGRIND /* In a PM-join, we can serialize entire tables; not every value has been * filled in yet. Need to look into that. Valgrind complains that @@ -354,6 +333,8 @@ RGData::RGData(const RowGroup& rg) if (rg.usesStringTable()) strings.reset(new StringStore()); + userDataStore.reset(); + #ifdef VALGRIND /* In a PM-join, we can serialize entire tables; not every value has been * filled in yet. Need to look into that. Valgrind complains that @@ -366,6 +347,7 @@ RGData::RGData(const RowGroup& rg) void RGData::reinit(const RowGroup& rg, uint32_t rowCount) { rowData.reset(new uint8_t[rg.getDataSize(rowCount)]); + userDataStore.reset(); if (rg.usesStringTable()) strings.reset(new StringStore()); @@ -386,16 +368,6 @@ void RGData::reinit(const RowGroup& rg) reinit(rg, 8192); } -RGData::RGData(const RGData& r) : rowData(r.rowData), strings(r.strings), userDataStore(r.userDataStore) -{ - // cout << "rgdata++ = " << __sync_add_and_fetch(&rgDataCount, 1) << endl; -} - -RGData::~RGData() -{ - // cout << "rgdata-- = " << __sync_sub_and_fetch(&rgDataCount, 1) << endl; -} - void RGData::serialize(ByteStream& bs, uint32_t amount) const { // cout << "serializing!\n"; @@ -464,6 +436,7 @@ void RGData::clear() { rowData.reset(); strings.reset(); + userDataStore.reset(); } // UserDataStore is only used for UDAF. @@ -478,10 +451,6 @@ UserDataStore* RGData::getUserDataStore() return userDataStore.get(); } -Row::Row() : data(NULL), strings(NULL), userDataStore(NULL) -{ -} - Row::Row(const Row& r) : columnCount(r.columnCount) , baseRid(r.baseRid) @@ -501,11 +470,7 @@ Row::Row(const Row& r) , hasLongStringField(r.hasLongStringField) , sTableThreshold(r.sTableThreshold) , forceInline(r.forceInline) - , userDataStore(NULL) -{ -} - -Row::~Row() + , userDataStore(nullptr) { } @@ -1023,7 +988,7 @@ bool Row::equals(const Row& r2, uint32_t lastCol) const const CHARSET_INFO* Row::getCharset(uint32_t col) const { - if (charsets[col] == NULL) + if (charsets[col] == nullptr) { const_cast(charsets)[col] = &datatypes::Charset(charsetNumbers[col]).getCharset(); } @@ -1031,14 +996,6 @@ const CHARSET_INFO* Row::getCharset(uint32_t col) const } RowGroup::RowGroup() - : columnCount(0) - , data(NULL) - , rgData(NULL) - , strings(NULL) - , useStringTable(true) - , hasCollation(false) - , hasLongStringField(false) - , sTableThreshold(20) { // 1024 is too generous to waste. oldOffsets.reserve(10); @@ -1057,7 +1014,7 @@ RowGroup::RowGroup(uint32_t colCount, const vector& positions, const v const vector& cprecision, uint32_t stringTableThreshold, bool stringTable, const vector& forceInlineData) : columnCount(colCount) - , data(NULL) + , data(nullptr) , oldOffsets(positions) , oids(roids) , keys(tkeys) @@ -1065,8 +1022,8 @@ RowGroup::RowGroup(uint32_t colCount, const vector& positions, const v , charsetNumbers(csNumbers) , scale(cscale) , precision(cprecision) - , rgData(NULL) - , strings(NULL) + , rgData(nullptr) + , strings(nullptr) , sTableThreshold(stringTableThreshold) { uint32_t i; @@ -1107,8 +1064,8 @@ RowGroup::RowGroup(uint32_t colCount, const vector& positions, const v useStringTable = (stringTable && hasLongStringField); offsets = (useStringTable ? &stOffsets[0] : &oldOffsets[0]); - // Set all the charsets to NULL for jit initialization. - charsets.insert(charsets.begin(), charsetNumbers.size(), NULL); + // Set all the charsets to nullptr for jit initialization. + charsets.insert(charsets.begin(), charsetNumbers.size(), nullptr); } RowGroup::RowGroup(const RowGroup& r) @@ -1176,14 +1133,6 @@ RowGroup& RowGroup::operator=(const RowGroup& r) } RowGroup::RowGroup(ByteStream& bs) - : columnCount(0) - , data(nullptr) - , rgData(nullptr) - , strings(nullptr) - , useStringTable(true) - , hasCollation(false) - , hasLongStringField(false) - , sTableThreshold(20) { this->deserialize(bs); } @@ -1254,22 +1203,13 @@ void RowGroup::deserialize(ByteStream& bs) else if (!useStringTable && !oldOffsets.empty()) offsets = &oldOffsets[0]; - // Set all the charsets to NULL for jit initialization. - charsets.insert(charsets.begin(), charsetNumbers.size(), NULL); + // Set all the charsets to nullptr for jit initialization. + charsets.insert(charsets.begin(), charsetNumbers.size(), nullptr); } void RowGroup::serializeRGData(ByteStream& bs) const { - // cout << "****** serializing\n" << toString() << en - // if (useStringTable || !hasLongStringField) rgData->serialize(bs, getDataSize()); - // else { - // uint64_t size; - // RGData *compressed = convertToStringTable(&size); - // compressed->serialize(bs, size); - // if (compressed != rgData) - // delete compressed; - // } } uint32_t RowGroup::getDataSize() const @@ -1354,7 +1294,7 @@ string RowGroup::toString(const std::vector& used) const // os << "strings = " << hex << (int64_t) strings << "\n"; // os << "data = " << (int64_t) data << "\n" << dec; - if (data != NULL) + if (data != nullptr) { Row r; initRow(&r); @@ -1580,7 +1520,7 @@ void RowGroup::addToSysDataList(execplan::CalpontSystemCatalog::NJLSysDataList& const CHARSET_INFO* RowGroup::getCharset(uint32_t col) { - if (charsets[col] == NULL) + if (charsets[col] == nullptr) { charsets[col] = &datatypes::Charset(charsetNumbers[col]).getCharset(); } diff --git a/utils/rowgroup/rowgroup.h b/utils/rowgroup/rowgroup.h index 02f498f58..f34c95558 100644 --- a/utils/rowgroup/rowgroup.h +++ b/utils/rowgroup/rowgroup.h @@ -132,7 +132,11 @@ inline T derefFromTwoVectorPtrs(const std::vector* outer, const std::vector> mem; // To store strings > 64KB (BLOB/TEXT) std::vector> longStrings; - bool empty; - bool fUseStoreStringMutex; //@bug6065, make StringStore::storeString() thread safe + bool empty = true; + bool fUseStoreStringMutex = false; //@bug6065, make StringStore::storeString() thread safe boost::mutex fMutex; }; @@ -214,8 +215,13 @@ class UserDataStore }; public: - UserDataStore(); - virtual ~UserDataStore(); + UserDataStore() = default; + virtual ~UserDataStore() = default; + UserDataStore(const UserDataStore&) = delete; + UserDataStore(UserDataStore&&) = delete; + UserDataStore& operator=(const UserDataStore&) = delete; + UserDataStore& operator=(UserDataStore&&) = delete; + void serialize(messageqcpp::ByteStream&) const; void deserialize(messageqcpp::ByteStream&); @@ -237,12 +243,10 @@ class UserDataStore boost::shared_ptr getUserData(uint32_t offset) const; private: - UserDataStore(const UserDataStore&); - UserDataStore& operator=(const UserDataStore&); std::vector vStoreData; - bool fUseUserDataMutex; + bool fUseUserDataMutex = false; boost::mutex fMutex; }; @@ -254,13 +258,16 @@ class Row; class RGData { public: - RGData(); // useless unless followed by an = or a deserialize operation + RGData() = default; // useless unless followed by an = or a deserialize operation RGData(const RowGroup& rg, uint32_t rowCount); // allocates memory for rowData explicit RGData(const RowGroup& rg); - RGData(const RGData&); - virtual ~RGData(); + RGData& operator=(const RGData&) = default; + RGData& operator=(RGData&&) = default; + RGData(const RGData&) = default; + RGData(RGData&&) = default; + virtual ~RGData() = default; + - inline RGData& operator=(const RGData&); // amount should be the # returned by RowGroup::getDataSize() void serialize(messageqcpp::ByteStream&, uint32_t amount) const; @@ -274,7 +281,7 @@ class RGData void clear(); void reinit(const RowGroup& rg); void reinit(const RowGroup& rg, uint32_t rowCount); - inline void setStringStore(boost::shared_ptr& ss) + inline void setStringStore(std::shared_ptr& ss) { strings = ss; } @@ -307,18 +314,21 @@ class RGData return (userDataStore ? (userDataStore->useUserDataMutex()) : false); } - boost::shared_array rowData; - boost::shared_ptr strings; - boost::shared_ptr userDataStore; + bool hasRowData() const + { + return !!rowData; + } private: - // boost::shared_array rowData; - // boost::shared_ptr strings; + std::shared_ptr rowData; + std::shared_ptr strings; + std::shared_ptr userDataStore; // Need sig to support backward compat. RGData can deserialize both forms. static const uint32_t RGDATA_SIG = 0xffffffff; // won't happen for 'old' Rowgroup data friend class RowGroup; + friend class RowGroupStorage; }; class Row @@ -326,28 +336,26 @@ class Row public: struct Pointer { - inline Pointer() : data(NULL), strings(NULL), userDataStore(NULL) - { - } + inline Pointer() = default; // Pointer(uint8_t*) implicitly makes old code compatible with the string table impl; - inline Pointer(uint8_t* d) : data(d), strings(NULL), userDataStore(NULL) + inline Pointer(uint8_t* d) : data(d) { } - inline Pointer(uint8_t* d, StringStore* s) : data(d), strings(s), userDataStore(NULL) + inline Pointer(uint8_t* d, StringStore* s) : data(d), strings(s) { } inline Pointer(uint8_t* d, StringStore* s, UserDataStore* u) : data(d), strings(s), userDataStore(u) { } - uint8_t* data; - StringStore* strings; - UserDataStore* userDataStore; + uint8_t* data = nullptr; + StringStore* strings = nullptr; + UserDataStore* userDataStore = nullptr; }; - Row(); + Row() = default; Row(const Row&); - ~Row(); + ~Row() = default; Row& operator=(const Row&); bool operator==(const Row&) const; @@ -500,7 +508,7 @@ class Row template inline void setBinaryField_offset(const T* value, uint32_t width, uint32_t colIndex); // support VARBINARY - // Add 2-byte length at the CHARSET_INFO*beginning of the field. NULL and zero length field are + // Add 2-byte length at the CHARSET_INFO*beginning of the field. nullptr and zero length field are // treated the same, could use one of the length bit to distinguish these two cases. inline void setVarBinaryField(const utils::NullString& val, uint32_t colIndex); // No string construction is necessary for better performance. @@ -598,31 +606,32 @@ class Row const CHARSET_INFO* getCharset(uint32_t col) const; - private: - uint32_t columnCount; - uint64_t baseRid; +private: + inline bool inStringTable(uint32_t col) const; + +private: + uint32_t columnCount = 0; + uint64_t baseRid = 0; // Note, the mem behind these pointer fields is owned by RowGroup not Row - uint32_t* oldOffsets; - uint32_t* stOffsets; - uint32_t* offsets; - uint32_t* colWidths; - execplan::CalpontSystemCatalog::ColDataType* types; - uint32_t* charsetNumbers; - CHARSET_INFO** charsets; - uint8_t* data; - uint32_t* scale; - uint32_t* precision; + uint32_t* oldOffsets = nullptr; + uint32_t* stOffsets = nullptr; + uint32_t* offsets = nullptr; + uint32_t* colWidths = nullptr; + execplan::CalpontSystemCatalog::ColDataType* types = nullptr; + uint32_t* charsetNumbers = nullptr; + CHARSET_INFO** charsets = nullptr; + uint8_t* data = nullptr; + uint32_t* scale = nullptr; + uint32_t* precision = nullptr; - StringStore* strings; - bool useStringTable; - bool hasCollation; - bool hasLongStringField; - uint32_t sTableThreshold; + StringStore* strings = nullptr; + bool useStringTable = true; + bool hasCollation = false; + bool hasLongStringField = false; + uint32_t sTableThreshold = 20; boost::shared_array forceInline; - inline bool inStringTable(uint32_t col) const; - - UserDataStore* userDataStore; // For UDAF + UserDataStore* userDataStore = nullptr; // For UDAF friend class RowGroup; }; @@ -1538,9 +1547,6 @@ class RowGroup : public messageqcpp::Serializeable inline bool usesStringTable() const; inline void setUseStringTable(bool); - // RGData *convertToInlineData(uint64_t *size = NULL) const; // caller manages the memory returned by - // this void convertToInlineDataInPlace(); RGData *convertToStringTable(uint64_t *size = NULL) - // const; void convertToStringTableInPlace(); void serializeRGData(messageqcpp::ByteStream&) const; inline uint32_t getStringTableThreshold() const; @@ -1576,17 +1582,17 @@ class RowGroup : public messageqcpp::Serializeable const uint16_t& blockNum); inline void getLocation(uint32_t* partNum, uint16_t* segNum, uint8_t* extentNum, uint16_t* blockNum); - inline void setStringStore(boost::shared_ptr); + inline void setStringStore(std::shared_ptr); const CHARSET_INFO* getCharset(uint32_t col); private: - uint32_t columnCount; - uint8_t* data; + uint32_t columnCount = 0; + uint8_t* data = nullptr; std::vector oldOffsets; // inline data offsets std::vector stOffsets; // string table offsets - uint32_t* offsets; // offsets either points to oldOffsets or stOffsets + uint32_t* offsets = nullptr; // offsets either points to oldOffsets or stOffsets std::vector colWidths; // oids: the real oid of the column, may have duplicates with alias. // This oid is necessary for front-end to decide the real column width. @@ -1604,12 +1610,12 @@ class RowGroup : public messageqcpp::Serializeable std::vector precision; // string table impl - RGData* rgData; - StringStore* strings; // note, strings and data belong to rgData - bool useStringTable; - bool hasCollation; - bool hasLongStringField; - uint32_t sTableThreshold; + RGData* rgData = nullptr; + StringStore* strings = nullptr; // note, strings and data belong to rgData + bool useStringTable = true; + bool hasCollation = false; + bool hasLongStringField = false; + uint32_t sTableThreshold = 20; boost::shared_array forceInline; static const uint32_t headerSize = 18; @@ -1646,7 +1652,7 @@ every row, they're a measurable performance penalty */ inline uint32_t RowGroup::getRowCount() const { // idbassert(data); - // if (!data) throw std::logic_error("RowGroup::getRowCount(): data is NULL!"); + // if (!data) throw std::logic_error("RowGroup::getRowCount(): data is nullptr!"); return *((uint32_t*)&data[rowCountOffset]); } @@ -1677,8 +1683,8 @@ inline void RowGroup::getRow(uint32_t rowNum, Row* r) const inline void RowGroup::setData(uint8_t* d) { data = d; - strings = NULL; - rgData = NULL; + strings = nullptr; + rgData = nullptr; setUseStringTable(false); } @@ -1712,7 +1718,7 @@ inline void RowGroup::setUseStringTable(bool b) offsets = &oldOffsets[0]; if (!useStringTable) - strings = NULL; + strings = nullptr; } inline uint64_t RowGroup::getBaseRid() const @@ -1772,7 +1778,7 @@ inline uint32_t RowGroup::getRowSizeWithStrings() const inline uint64_t RowGroup::getSizeWithStrings(uint64_t n) const { - if (strings == NULL) + if (strings == nullptr) return getDataSize(n); else return getDataSize(n) + strings->getSize(); @@ -1896,7 +1902,7 @@ inline uint32_t RowGroup::getStringTableThreshold() const return sTableThreshold; } -inline void RowGroup::setStringStore(boost::shared_ptr ss) +inline void RowGroup::setStringStore(std::shared_ptr ss) { if (useStringTable) { @@ -2123,7 +2129,7 @@ inline const uint8_t* StringStore::getPointer(uint64_t off) const inline bool StringStore::isNullValue(uint64_t off) const { - if (off == std::numeric_limits::max()) + if (off == std::numeric_limits::max()) return true; return false; } @@ -2190,14 +2196,6 @@ inline uint64_t StringStore::getSize() const return ret; } -inline RGData& RGData::operator=(const RGData& r) -{ - rowData = r.rowData; - strings = r.strings; - userDataStore = r.userDataStore; - return *this; -} - inline void RGData::getRow(uint32_t num, Row* row) { uint32_t size = row->getSize(); diff --git a/utils/udfsdk/libudf_mysql.rc b/utils/udfsdk/libudf_mysql.rc deleted file mode 100644 index f5420aa25..000000000 --- a/utils/udfsdk/libudf_mysql.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB UDF API" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "libudfsdk" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "libudfsdk.dll" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/utils/udfsdk/libudfsdk.rc b/utils/udfsdk/libudfsdk.rc deleted file mode 100644 index f5420aa25..000000000 --- a/utils/udfsdk/libudfsdk.rc +++ /dev/null @@ -1,102 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB, Inc." - VALUE "FileDescription", "InfiniDB UDF API" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "libudfsdk" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "libudfsdk.dll" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/versioning/BRM/slavecomm.cpp b/versioning/BRM/slavecomm.cpp index 180b09f31..a9e88decc 100644 --- a/versioning/BRM/slavecomm.cpp +++ b/versioning/BRM/slavecomm.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "messagequeue.h" #include "bytestream.h" @@ -57,21 +58,18 @@ void timespec_sub(const struct timespec& tv1, const struct timespec& tv2, double namespace BRM { -SlaveComm::SlaveComm(string hostname, SlaveDBRMNode* s) - : slave(s) - , currentSaveFile(NULL) - , journalh(NULL) +SlaveComm::SlaveComm(string hostname) { config::Config* config = config::Config::makeConfig(); string tmp; - + slave = std::make_unique(); bool tellUser = true; for (;;) { try { - server = new MessageQueueServer(hostname); + server = std::make_unique(hostname); break; } catch (runtime_error& re) @@ -133,8 +131,8 @@ SlaveComm::SlaveComm(string hostname, SlaveDBRMNode* s) journalName = savefile + "_journal"; const char* filename = journalName.c_str(); - journalh = IDBDataFile::open(IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "a", 0); - if (journalh == NULL) + journalh.reset(IDBDataFile::open(IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "a", 0)); + if (journalh == nullptr) throw runtime_error("Could not open the BRM journal for writing!"); } else @@ -162,8 +160,6 @@ SlaveComm::SlaveComm(string hostname, SlaveDBRMNode* s) } SlaveComm::SlaveComm() - : currentSaveFile(NULL) - , journalh(NULL) { config::Config* config = config::Config::makeConfig(); @@ -192,23 +188,9 @@ SlaveComm::SlaveComm() server = NULL; standalone = true; printOnly = false; - slave = new SlaveDBRMNode(); + slave = std::make_unique(); } -SlaveComm::~SlaveComm() -{ - delete server; - server = NULL; - - if (firstSlave) - { - delete currentSaveFile; - currentSaveFile = NULL; - } - - delete journalh; - journalh = NULL; -} void SlaveComm::stop() { @@ -1946,8 +1928,7 @@ void SlaveComm::do_confirm() { if (!currentSaveFile) { - currentSaveFile = - IDBDataFile::open(IDBPolicy::getType(tmp.c_str(), IDBPolicy::WRITEENG), tmp.c_str(), "wb", 0); + currentSaveFile.reset(IDBDataFile::open(IDBPolicy::getType(tmp.c_str(), IDBPolicy::WRITEENG), tmp.c_str(), "wb", 0)); } if (currentSaveFile == NULL) @@ -1970,7 +1951,7 @@ void SlaveComm::do_confirm() if (err < (int)relative.length()) { ostringstream os; - os << "WorkerComm: currentfile write() returned " << err << " file pointer is " << currentSaveFile; + os << "WorkerComm: currentfile write() returned " << err << " file pointer is " << currentSaveFile.get(); if (err < 0) os << " errno: " << strerror(errno); @@ -1979,13 +1960,13 @@ void SlaveComm::do_confirm() } currentSaveFile->flush(); - delete currentSaveFile; - currentSaveFile = NULL; + + currentSaveFile = nullptr; saveFileToggle = !saveFileToggle; - delete journalh; - journalh = IDBDataFile::open(IDBPolicy::getType(journalName.c_str(), IDBPolicy::WRITEENG), - journalName.c_str(), "w+b", 0); + ; + journalh.reset(IDBDataFile::open(IDBPolicy::getType(journalName.c_str(), IDBPolicy::WRITEENG), + journalName.c_str(), "w+b", 0)); if (!journalh) throw runtime_error("Could not open the BRM journal for writing!"); @@ -2245,7 +2226,6 @@ void SlaveComm::do_ownerCheck(ByteStream& msg) master.write(reply); } -// FIXME: needs to be refactored along with SessionManagerServer::lookupProcessStatus() bool SlaveComm::processExists(const uint32_t pid, const string& pname) { string stat; @@ -2278,7 +2258,6 @@ bool SlaveComm::processExists(const uint32_t pid, const string& pname) return true; } - void SlaveComm::do_dmlLockLBIDRanges(ByteStream& msg) { ByteStream reply; diff --git a/versioning/BRM/slavecomm.h b/versioning/BRM/slavecomm.h index 48a2f5b54..18ad2af15 100644 --- a/versioning/BRM/slavecomm.h +++ b/versioning/BRM/slavecomm.h @@ -54,8 +54,10 @@ class SlaveComm EXPORT SlaveComm(); /** Use this ctor to have it connected to the rest of the DBRM system */ - EXPORT SlaveComm(std::string hostname, SlaveDBRMNode* s); // hostname = 'DBRM_WorkerN' - EXPORT ~SlaveComm(); + EXPORT SlaveComm(std::string hostname); // hostname = 'DBRM_WorkerN' + EXPORT ~SlaveComm() {}; + + SlaveDBRMNode& getSlaveNode() { return *slave; } EXPORT void run(); EXPORT void stop(); @@ -112,15 +114,15 @@ class SlaveComm void saveDelta(); bool processExists(const uint32_t pid, const std::string& pname); - messageqcpp::MessageQueueServer* server; + std::unique_ptr server; messageqcpp::IOSocket master; - SlaveDBRMNode* slave; + std::unique_ptr slave; std::string savefile; bool release, die, firstSlave, saveFileToggle, takeSnapshot, doSaveDelta, standalone, printOnly; messageqcpp::ByteStream delta; - idbdatafile::IDBDataFile* currentSaveFile; + std::unique_ptr currentSaveFile; std::string journalName; - idbdatafile::IDBDataFile* journalh; + std::unique_ptr journalh; int64_t snapshotInterval, journalCount; struct timespec MSG_TIMEOUT; }; diff --git a/versioning/BRM/slavenode.cpp b/versioning/BRM/slavenode.cpp index db66e4309..d1c2a73da 100644 --- a/versioning/BRM/slavenode.cpp +++ b/versioning/BRM/slavenode.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include "slavedbrmnode.h" @@ -39,7 +40,7 @@ using namespace BRM; using namespace std; -SlaveComm* comm; +std::unique_ptr comm; bool die = false; boost::thread_group monitorThreads; @@ -120,12 +121,11 @@ int ServiceWorkerNode::Child() { setupChildSignalHandlers(); - SlaveDBRMNode slave; ShmKeys keys; try { - comm = new SlaveComm(std::string(m_nodename), &slave); + comm = std::make_unique(std::string(m_nodename)); NotifyServiceStarted(); } catch (exception& e) @@ -139,12 +139,12 @@ int ServiceWorkerNode::Child() } /* Start 4 threads to monitor write lock state */ - monitorThreads.create_thread(RWLockMonitor(&die, slave.getEMFLLockStatus(), keys.KEYRANGE_EMFREELIST_BASE)); - monitorThreads.create_thread(RWLockMonitor(&die, slave.getEMLockStatus(), keys.KEYRANGE_EXTENTMAP_BASE)); - monitorThreads.create_thread(RWLockMonitor(&die, slave.getVBBMLockStatus(), keys.KEYRANGE_VBBM_BASE)); - monitorThreads.create_thread(RWLockMonitor(&die, slave.getVSSLockStatus(), keys.KEYRANGE_VSS_BASE)); + monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getEMFLLockStatus(), keys.KEYRANGE_EMFREELIST_BASE)); + monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getEMLockStatus(), keys.KEYRANGE_EXTENTMAP_BASE)); + monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getVBBMLockStatus(), keys.KEYRANGE_VBBM_BASE)); + monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getVSSLockStatus(), keys.KEYRANGE_VSS_BASE)); monitorThreads.create_thread( - RWLockMonitor(&die, slave.getEMIndexLockStatus(), keys.KEYRANGE_EXTENTMAP_INDEX_BASE)); + RWLockMonitor(&die, comm->getSlaveNode().getEMIndexLockStatus(), keys.KEYRANGE_EXTENTMAP_INDEX_BASE)); try { diff --git a/writeengine/build/startdbrm b/writeengine/build/startdbrm deleted file mode 100755 index 3b4a68ca7..000000000 --- a/writeengine/build/startdbrm +++ /dev/null @@ -1,2 +0,0 @@ -nohup controlernode & -nohup workernode DBRM_Worker1 & diff --git a/writeengine/build/we_rules.mak b/writeengine/build/we_rules.mak deleted file mode 100644 index bc750d7f6..000000000 --- a/writeengine/build/we_rules.mak +++ /dev/null @@ -1,48 +0,0 @@ -IPCS_CLEANUP=$(EXPORT_ROOT)/bin/dbrm stop; ipcs-pat -d > /dev/null; sleep 2; $(EXPORT_ROOT)/bin/dbrm start; - -CPPFLAGS=-I. -I$(EXPORT_ROOT)/include -I/usr/include/libxml2 - -CXXFLAGS+=$(DEBUG_FLAGS) -D_FILE_OFFSET_BITS=64 -Wall -fpic -LLIBS=-L. -L$(EXPORT_ROOT)/lib -lxml2 -lrwlock -lconfigcpp -lmessageqcpp -lbrm -lboost_thread \ - -lloggingcpp -lboost_date_time -lboost_filesystem -TLIBS=$(LLIBS) -lcppunit -ldl -GLIBS=$(TLIBS:-lcppunit=) - -LIBDIR=../obj -LOBJS_SHARED= \ - $(LIBDIR)/we_blockop.o \ - $(LIBDIR)/we_brm.o \ - $(LIBDIR)/we_bulkrollbackmgr.o \ - $(LIBDIR)/we_bulkrollbackfile.o \ - $(LIBDIR)/we_bulkrollbackfilecompressed.o \ - $(LIBDIR)/we_bulkrollbackfilecompressedhdfs.o \ - $(LIBDIR)/we_cache.o \ - $(LIBDIR)/we_chunkmanager.o \ - $(LIBDIR)/we_config.o \ - $(LIBDIR)/we_confirmhdfsdbfile.o \ - $(LIBDIR)/we_convertor.o \ - $(LIBDIR)/we_dbfileop.o \ - $(LIBDIR)/we_dbrootextenttracker.o \ - $(LIBDIR)/we_define.o \ - $(LIBDIR)/we_fileop.o \ - $(LIBDIR)/we_log.o \ - $(LIBDIR)/we_rbmetawriter.o \ - $(LIBDIR)/we_simplesyslog.o \ - $(LIBDIR)/we_stats.o - -LOBJS_INDEX= \ - $(LIBDIR)/we_freemgr.o \ - $(LIBDIR)/we_indexlist.o \ - $(LIBDIR)/we_indexlist_common.o \ - $(LIBDIR)/we_indexlist_find_delete.o \ - $(LIBDIR)/we_indexlist_multiple_narray.o \ - $(LIBDIR)/we_indexlist_narray.o \ - $(LIBDIR)/we_indexlist_update_hdr_sub.o \ - $(LIBDIR)/we_indextree.o - -LOBJS_DCTNRY= $(LIBDIR)/we_dctnry.o -LOBJS_XML= $(LIBDIR)/we_xmlop.o \ - $(LIBDIR)/we_xmljob.o \ - $(LIBDIR)/we_xmlgendata.o \ - $(LIBDIR)/we_xmlgenproc.o - diff --git a/writeengine/bulk/cpimport.rc b/writeengine/bulk/cpimport.rc deleted file mode 100644 index d0ef7a6fb..000000000 --- a/writeengine/bulk/cpimport.rc +++ /dev/null @@ -1,100 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "InfiniDB" - VALUE "FileDescription", "InfiniDB Bulk Loader" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "cpimport" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "cpimport.exe" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/writeengine/bulk/we_bulkloadbuffer.cpp b/writeengine/bulk/we_bulkloadbuffer.cpp index 9d9278370..2b32deab3 100644 --- a/writeengine/bulk/we_bulkloadbuffer.cpp +++ b/writeengine/bulk/we_bulkloadbuffer.cpp @@ -2415,12 +2415,10 @@ void BulkLoadBuffer::tokenize(const boost::ptr_vector& columnsInfo, //------------------------------------------------------------------ case FLD_PARSE_ENCLOSED_STATE: { - char next = *(p + 1); - if ((p + 1 < pEndOfData) && - (((c == ESCAPE_CHAR) && ((next == STRING_ENCLOSED_CHAR) || (next == ESCAPE_CHAR) || - (next == LINE_FEED) || (next == CARRIAGE_RETURN))) || - ((c == STRING_ENCLOSED_CHAR) && (next == STRING_ENCLOSED_CHAR)))) + (((c == ESCAPE_CHAR) && ((*(p + 1) == STRING_ENCLOSED_CHAR) || (*(p + 1) == ESCAPE_CHAR) || + (*(p + 1) == LINE_FEED) || (*(p + 1) == CARRIAGE_RETURN))) || + ((c == STRING_ENCLOSED_CHAR) && (*(p + 1) == STRING_ENCLOSED_CHAR)))) { // Create/save original data before stripping out bytes if (rawDataRowLength == 0) @@ -2515,7 +2513,7 @@ void BulkLoadBuffer::tokenize(const boost::ptr_vector& columnsInfo, // cout << "triming ... " << endl; char* tmp = p; - while (*(--tmp) == ' ') + while (tmp != lastRowHead && *(--tmp) == ' ') { // cout << "offset is " << offset < FileOp::m_DbRootAddExtentMutexes; +/*static*/ std::map FileOp::m_DbRootAddExtentMutexes; // in 1 call to fwrite(), during initialization // StopWatch timer; @@ -993,7 +993,7 @@ int FileOp::initColumnExtent(IDBDataFile* pFile, uint16_t dbRoot, int nBlocks, c Stats::startParseEvent(WE_STATS_WAIT_TO_CREATE_COL_EXTENT); #endif - boost::mutex::scoped_lock lk(*m_DbRootAddExtentMutexes[dbRoot]); + boost::mutex::scoped_lock lk(m_DbRootAddExtentMutexes[dbRoot]); #ifdef PROFILE if (bExpandExtent) @@ -1714,7 +1714,7 @@ int FileOp::initDctnryExtent(IDBDataFile* pFile, uint16_t dbRoot, int nBlocks, u Stats::startParseEvent(WE_STATS_WAIT_TO_CREATE_DCT_EXTENT); #endif - boost::mutex::scoped_lock lk(*m_DbRootAddExtentMutexes[dbRoot]); + boost::mutex::scoped_lock lk(m_DbRootAddExtentMutexes[dbRoot]); #ifdef PROFILE if (bExpandExtent) @@ -1809,33 +1809,13 @@ void FileOp::initDbRootExtentMutexes() for (size_t i = 0; i < rootIds.size(); i++) { - boost::mutex* pM = new boost::mutex; - m_DbRootAddExtentMutexes[rootIds[i]] = pM; + m_DbRootAddExtentMutexes.emplace(std::piecewise_construct, + std::forward_as_tuple(rootIds[i]), + std::forward_as_tuple()); } } } -/*********************************************************** - * DESCRIPTION: - * Cleans up memory allocated to the DBRoot extent mutexes. Calling - * this function is not necessary, but it is provided for completeness, - * to complement initDbRootExtentMutexes(), and to provide a way to - * free up memory at the end of program execution. - ***********************************************************/ -/* static */ -void FileOp::removeDbRootExtentMutexes() -{ - boost::mutex::scoped_lock lk(m_createDbRootMutexes); - - std::map::iterator k = m_DbRootAddExtentMutexes.begin(); - - while (k != m_DbRootAddExtentMutexes.end()) - { - delete k->second; - ++k; - } -} - /*********************************************************** * DESCRIPTION: * Write out (reinitialize) a partial extent in a column file. diff --git a/writeengine/shared/we_fileop.h b/writeengine/shared/we_fileop.h index 7a5d8a03a..e93d15897 100644 --- a/writeengine/shared/we_fileop.h +++ b/writeengine/shared/we_fileop.h @@ -443,7 +443,6 @@ class FileOp : public BlockOp, public WeUIDGID execplan::CalpontSystemCatalog::ColDataType colDataType); static void initDbRootExtentMutexes(); - static void removeDbRootExtentMutexes(); int writeInitialCompColumnChunk(IDBDataFile* pFile, int nBlocksAllocated, int nRows, const uint8_t* emptyVal, int width, BRM::LBID_t lbid, @@ -457,7 +456,7 @@ class FileOp : public BlockOp, public WeUIDGID static boost::mutex m_createDbRootMutexes; // Mutexes used to serialize extent creation within each DBRoot - static std::map m_DbRootAddExtentMutexes; + static std::map m_DbRootAddExtentMutexes; // protect race condition in creating directories static boost::mutex m_mkdirMutex; diff --git a/writeengine/shared/we_type.h b/writeengine/shared/we_type.h index 27ebd9970..0997e746a 100644 --- a/writeengine/shared/we_type.h +++ b/writeengine/shared/we_type.h @@ -400,8 +400,8 @@ struct JobColumn /** @brief Job Column Structure */ int compressionType; /** @brief compression type */ bool autoIncFlag; /** @brief auto increment flag */ DctnryStruct dctnry; /** @brief dictionary structure */ - int64_t fMinIntSat; /** @brief For integer type, the min saturation value */ - uint64_t fMaxIntSat; /** @brief For integer type, the max saturation value */ + int128_t fMinIntSat; /** @brief For integer type, the min saturation value */ + uint128_t fMaxIntSat; /** @brief For integer type, the max saturation value */ double fMinDblSat; /** @brief for float/double, the min saturation value */ double fMaxDblSat; /** @brief for float/double, the max saturation value */ bool fWithDefault; /** @brief With default */ diff --git a/writeengine/splitter/splitter.rc b/writeengine/splitter/splitter.rc deleted file mode 100644 index ff6051a6f..000000000 --- a/writeengine/splitter/splitter.rc +++ /dev/null @@ -1,101 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,6,0,0 - PRODUCTVERSION 4,6,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "InfiniDB Bulk Loader" - VALUE "FileVersion", "4.6.0-0" - VALUE "InternalName", "splitter" - VALUE "LegalCopyright", "Copyright (C) 2014" - VALUE "OriginalFilename", "cpimport.exe" - VALUE "ProductName", "InfiniDB" - VALUE "ProductVersion", "4.6.0.0 Beta" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/writeengine/splitter/we_cmdargs.cpp b/writeengine/splitter/we_cmdargs.cpp index 27efb1d37..32d126346 100644 --- a/writeengine/splitter/we_cmdargs.cpp +++ b/writeengine/splitter/we_cmdargs.cpp @@ -464,7 +464,7 @@ bool WECmdArgs::str2PmList(std::string& PmList, VecInts& V) if (aLen > 0) { - strncpy(aBuff, PmList.c_str(), BUFLEN); + strncpy(aBuff, PmList.c_str(), BUFLEN - 1); aBuff[BUFLEN - 1] = 0; } else diff --git a/writeengine/wrapper/writeengine.cpp b/writeengine/wrapper/writeengine.cpp index 474e7825d..a2d5f5388 100644 --- a/writeengine/wrapper/writeengine.cpp +++ b/writeengine/wrapper/writeengine.cpp @@ -65,6 +65,7 @@ using namespace idbdatafile; #include "dataconvert.h" #include "string_prefixes.h" +#include "mcs_decimal.h" namespace WriteEngine //#define PROFILE 1 @@ -919,7 +920,7 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid, Column refCol; ColType newColType; ColType refColType; - boost::scoped_array defVal(new char[MAX_COLUMN_BOUNDARY]); + boost::scoped_array defVal(new char[datatypes::MAXDECIMALWIDTH]); ColumnOp* colOpNewCol = m_colOp[op(compressionType)]; ColumnOp* refColOp = m_colOp[op(refCompressionType)]; Dctnry* dctnry = m_dctnry[op(compressionType)]; @@ -994,6 +995,29 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid, return rc; } +// TODO: Get rid of this +void emptyValueToAny(boost::any* any, const uint8_t* emptyValue, int colWidth) +{ + switch (colWidth) + { + case 16: + *any = *(uint128_t*)emptyValue; + break; + case 8: + *any = *(uint64_t*)emptyValue; + break; + case 4: + *any = *(uint32_t*)emptyValue; + break; + case 2: + *any = *(uint16_t*)emptyValue; + break; + default: + *any = *emptyValue; + } +} + + int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector& colExtentsColType, vector& colExtentsStruct, vector& colOldValueList, vector& ridLists, const int32_t tableOid, bool hasAUXCol) @@ -1034,10 +1058,7 @@ int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector const uint8_t* emptyVal = m_colOp[op(curColStruct.fCompressionType)]->getEmptyRowValue( curColStruct.colDataType, curColStruct.colWidth); - if (curColStruct.colWidth == datatypes::MAXDECIMALWIDTH) - curTuple.data = *(int128_t*)emptyVal; - else - curTuple.data = *(int64_t*)emptyVal; + emptyValueToAny(&curTuple.data, emptyVal, curColStruct.colWidth); curTupleList.push_back(curTuple); colValueList.push_back(curTupleList); diff --git a/writeengine/xml/we_xmljob.cpp b/writeengine/xml/we_xmljob.cpp index e5e9d6111..25471e609 100644 --- a/writeengine/xml/we_xmljob.cpp +++ b/writeengine/xml/we_xmljob.cpp @@ -21,6 +21,7 @@ *******************************************************************************/ /** @file */ +#include "mcs_basic_types.h" #define WRITEENGINEXMLJOB_DLLEXPORT #include "we_xmljob.h" #undef WRITEENGINEXMLJOB_DLLEXPORT @@ -46,28 +47,6 @@ using namespace execplan; namespace WriteEngine { -// Maximum saturation value for DECIMAL types based on precision -// TODO MCOL-641 add support here. see dataconvert.cpp -const long long columnstore_precision[19] = {0, - 9, - 99, - 999, - 9999, - 99999, - 999999, - 9999999, - 99999999, - 999999999, - 9999999999LL, - 99999999999LL, - 999999999999LL, - 9999999999999LL, - 99999999999999LL, - 999999999999999LL, - 9999999999999999LL, - 99999999999999999LL, - 999999999999999999LL}; - //------------------------------------------------------------------------------ // Constructor //------------------------------------------------------------------------------ @@ -695,13 +674,14 @@ void XMLJob::initSatLimits(JobColumn& curColumn) const } else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::DECIMAL]) { - curColumn.fMinIntSat = -columnstore_precision[curColumn.precision]; - curColumn.fMaxIntSat = columnstore_precision[curColumn.precision]; + curColumn.fMaxIntSat = dataconvert::decimalRangeUp(curColumn.precision); + curColumn.fMinIntSat = -curColumn.fMaxIntSat; + } else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::UDECIMAL]) { curColumn.fMinIntSat = 0; - curColumn.fMaxIntSat = columnstore_precision[curColumn.precision]; + curColumn.fMaxIntSat = dataconvert::decimalRangeUp(curColumn.precision); } else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::FLOAT]) {