diff --git a/README b/README index 541e8872f..bc8efde2c 100644 --- a/README +++ b/README @@ -1,9 +1,9 @@ This is MariaDB ColumnStore 1.2 -MariaDB ColumnStore 1.2 is the development version of MariaDB ColumnStore. +MariaDB ColumnStore 1.2 is the GA version of MariaDB ColumnStore. It is built by porting InfiniDB 4.6.7 on MariaDB 10.2 and adding entirely new features not found anywhere else. -MariaDB ColumnStore 1.2 is a pre-release. +MariaDB ColumnStore 1.2 is a GA. Additional features will be pushed in future releases. A few things to notice: diff --git a/README.md b/README.md index d9e21c977..5e4c33b6d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # MariaDB ColumnStore Storage/Execution engine 1.2 -MariaDB ColumnStore 1.2 is the development version of MariaDB ColumnStore. +MariaDB ColumnStore 1.2 is the GA version of MariaDB ColumnStore. It is built by porting InfiniDB 4.6.7 on MariaDB 10.2 and adding entirely new features not found anywhere else. -# MariaDB ColumnStore 1.2 is a pre-release. +# MariaDB ColumnStore 1.2 is a GA release. - Do not use pre-releases on production systems. diff --git a/dbcon/execplan/windowfunctioncolumn.cpp b/dbcon/execplan/windowfunctioncolumn.cpp index 5c84ff2d1..b1377880f 100644 --- a/dbcon/execplan/windowfunctioncolumn.cpp +++ b/dbcon/execplan/windowfunctioncolumn.cpp @@ -233,7 +233,8 @@ WindowFunctionColumn::WindowFunctionColumn( const WindowFunctionColumn& rhs, con fFunctionName(rhs.functionName()), fFunctionParms(rhs.functionParms()), fPartitions (rhs.partitions()), - fOrderBy (rhs.orderBy()) + fOrderBy (rhs.orderBy()), + udafContext(rhs.getUDAFContext()) {} const string WindowFunctionColumn::toString() const diff --git a/dbcon/execplan/windowfunctioncolumn.h b/dbcon/execplan/windowfunctioncolumn.h index 3fc983e55..47c82b805 100644 --- a/dbcon/execplan/windowfunctioncolumn.h +++ b/dbcon/execplan/windowfunctioncolumn.h @@ -140,6 +140,10 @@ public: { return udafContext; } + const mcsv1sdk::mcsv1Context& getUDAFContext() const + { + return udafContext; + } private: /** diff --git a/dbcon/mysql/ha_calpont.cpp b/dbcon/mysql/ha_calpont.cpp index 03289ba60..6ea5f85a6 100644 --- a/dbcon/mysql/ha_calpont.cpp +++ b/dbcon/mysql/ha_calpont.cpp @@ -1161,9 +1161,9 @@ void check_walk(const Item* item, void* arg) { case Item::FUNC_ITEM: { - Item_func* ifp = (Item_func*)item; + const Item_func* ifp = static_cast(item); - if ( ifp->functype() != Item_func::EQ_FUNC ) + if ( ifp->functype() != Item_func::EQ_FUNC ) // NON-equi JOIN { if ( ifp->argument_count() == 2 && ifp->arguments()[0]->type() == Item::FIELD_ITEM && @@ -1178,11 +1178,36 @@ void check_walk(const Item* item, void* arg) return; } } + else // IN + correlated subquery + { + if ( ifp->functype() == Item_func::NOT_FUNC + && ifp->arguments()[0]->type() == Item::EXPR_CACHE_ITEM ) + { + check_walk(ifp->arguments()[0], arg); + } + } + } + break; + } + + case Item::EXPR_CACHE_ITEM: // IN + correlated subquery + { + const Item_cache_wrapper* icw = static_cast(item); + if ( icw->get_orig_item()->type() == Item::FUNC_ITEM ) + { + const Item_func *ifp = static_cast(icw->get_orig_item()); + if ( ifp->argument_count() == 2 && + ( ifp->arguments()[0]->type() == Item::Item::SUBSELECT_ITEM + || ifp->arguments()[1]->type() == Item::Item::SUBSELECT_ITEM )) + { + *unsupported_feature = true; + return; + } } break; } - case Item::COND_ITEM: + case Item::COND_ITEM: // OR in cods is unsupported yet { Item_cond* icp = (Item_cond*)item; if ( is_cond_or(icp) ) @@ -1198,8 +1223,6 @@ void check_walk(const Item* item, void* arg) } } -#include - /*@brief create_calpont_group_by_handler- Creates handler*/ /*********************************************************** * DESCRIPTION: @@ -1221,24 +1244,25 @@ static group_by_handler* create_calpont_group_by_handler(THD* thd, Query* query) { ha_calpont_group_by_handler* handler = NULL; - LEX* lex = thd->lex; - SELECT_LEX *select_lex = &lex->select_lex; + // same as thd->lex->current_select + SELECT_LEX *select_lex = query->from->select_lex; // Create a handler if query is valid. See comments for details. if ( thd->infinidb_vtable.vtable_state == THD::INFINIDB_DISABLE_VTABLE && ( thd->variables.infinidb_vtable_mode == 0 || thd->variables.infinidb_vtable_mode == 2 ) - && ( query->group_by || thd->lex->select_lex.with_sum_func ) ) + && ( query->group_by || select_lex->with_sum_func ) ) { bool unsupported_feature = false; // Impossible HAVING or WHERE - if ( ( select_lex->having && select_lex->having_value == Item::COND_FALSE ) - || ( select_lex->cond_value && select_lex->cond_value == Item::COND_FALSE ) ) + if ( ( query->having && select_lex->having_value == Item::COND_FALSE ) + || ( select_lex->cond_count > 0 + && select_lex->cond_value == Item::COND_FALSE ) ) { unsupported_feature = true; } - // Unsupported JOIN conditions check. + // Unsupported conditions check. if ( !unsupported_feature ) { JOIN *join = select_lex->join; @@ -1248,7 +1272,7 @@ create_calpont_group_by_handler(THD* thd, Query* query) icp = reinterpret_cast(join->conds); if ( unsupported_feature == false - && join->table_count > 1 && icp ) + && icp ) { icp->traverse_cond(check_walk, &unsupported_feature, Item::POSTFIX); } @@ -1265,8 +1289,6 @@ create_calpont_group_by_handler(THD* thd, Query* query) } } - std::cerr << "create_calpont_group_by_handler handler " << handler << std::endl; - return handler; } diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index a872ace4f..914743a25 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -3813,7 +3813,7 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS FuncExp* funcexp = FuncExp::instance(); string funcName = "case_simple"; - if (strcasecmp(((Item_func_case*)item)->case_type(), "searched") == 0) + if (item->functype() == Item_func::CASE_SEARCHED_FUNC) { funcName = "case_searched"; } @@ -3857,7 +3857,7 @@ FunctionColumn* buildCaseFunction(Item_func* item, gp_walk_info& gwi, bool& nonS // some cpu cycles trying to build a ReturnedColumn as below. // Every even numbered arg is a WHEN. In between are the THEN. // An odd number of args indicates an ELSE residing in the last spot. - if (funcName == "case_searched" && + if ((item->functype() == Item_func::CASE_SEARCHED_FUNC) && (i < arg_offset)) { // MCOL-1472 Nested CASE with an ISNULL predicate. We don't want the predicate @@ -8248,13 +8248,11 @@ int cp_get_table_plan(THD* thd, SCSEP& csep, cal_table_info& ti) int cp_get_group_plan(THD* thd, SCSEP& csep, cal_impl_if::cal_group_info& gi) { - LEX* lex = thd->lex; - idbassert(lex != 0); - SELECT_LEX select_lex = lex->select_lex; + SELECT_LEX *select_lex = gi.groupByTables->select_lex; gp_walk_info gwi; gwi.thd = thd; - int status = getGroupPlan(gwi, select_lex, csep, gi); + int status = getGroupPlan(gwi, *select_lex, csep, gi); #ifdef DEBUG_WALK_COND cerr << "---------------- cp_get_group_plan EXECUTION PLAN ----------------" << endl; diff --git a/genii.vpw b/genii.vpw index 686b01ed7..417da26ce 100644 --- a/genii.vpw +++ b/genii.vpw @@ -4,12 +4,9 @@ - - - diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index 79fb0cff5..b5610bf11 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -427,12 +427,9 @@ + - - - - 1 0 diff --git a/oam/etc/Columnstore.xml.singleserver b/oam/etc/Columnstore.xml.singleserver index 75e741ada..0c291579a 100644 --- a/oam/etc/Columnstore.xml.singleserver +++ b/oam/etc/Columnstore.xml.singleserver @@ -419,12 +419,9 @@ + 50 - - - - 1 0 diff --git a/oam/install_scripts/columnstoreAlias b/oam/install_scripts/columnstoreAlias index 255eb7e7e..623cf26b8 100644 --- a/oam/install_scripts/columnstoreAlias +++ b/oam/install_scripts/columnstoreAlias @@ -4,7 +4,7 @@ alias mcsmysql='/usr/local/mariadb/columnstore/mysql/bin/mysql --defaults-extra- alias ma=/usr/local/mariadb/columnstore/bin/mcsadmin alias mcsadmin=/usr/local/mariadb/columnstore/bin/mcsadmin alias cpimport=/usr/local/mariadb/columnstore/bin/cpimport -alias home='cd /usr/local/mariadb/columnstore' +alias mcshome='cd /usr/local/mariadb/columnstore' alias log='cd /var/log/mariadb/columnstore/' alias core='cd /var/log/mariadb/columnstore/corefiles' alias tmsg='tail -f /var/log/messages' @@ -14,4 +14,4 @@ alias terror='tail -f /var/log/mariadb/columnstore/err.log' alias twarning='tail -f /var/log/mariadb/columnstore/warning.log' alias tcrit='tail -f /var/log/mariadb/columnstore/crit.log' alias dbrm='cd /usr/local/mariadb/columnstore/data1/systemFiles/dbrm' -alias module='cat /usr/local/mariadb/columnstore/local/module' +alias mcsmodule='cat /usr/local/mariadb/columnstore/local/module' diff --git a/oam/install_scripts/post-install b/oam/install_scripts/post-install index 6fac1eaae..d82bbb953 100755 --- a/oam/install_scripts/post-install +++ b/oam/install_scripts/post-install @@ -315,14 +315,6 @@ if [ -z "aws" ]; then $installdir/bin/MCSgetCredentials.sh >/dev/null 2>&1 fi -#log install message -test -f $installdir/post/functions && . $installdir/post/functions -if [ $user = "root" ]; then - $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****" -else - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****" -fi - #setup hadoop hadoop=`which hadoop 2>/dev/null` if [ -z "$hadoop" ]; then diff --git a/oam/install_scripts/syslogSetup.sh b/oam/install_scripts/syslogSetup.sh index e2d690fb4..babbd1c88 100755 --- a/oam/install_scripts/syslogSetup.sh +++ b/oam/install_scripts/syslogSetup.sh @@ -11,12 +11,26 @@ prefix=/usr/local installdir=$prefix/mariadb/columnstore syslog_conf=nofile rsyslog7=0 +non_root_user=no user=`whoami 2>/dev/null` +#set default names groupname=adm username=syslog +# determine username/groupname + +if [ -f /var/log/messages ]; then + username=`stat -c "%U %G" /var/log/messages | awk '{print $1}'` + groupname=`stat -c "%U %G" /var/log/messages | awk '{print $2}'` +fi + +if [ -f /var/log/syslog ]; then + username=`stat -c "%U %G" /var/log/syslog | awk '{print $1}'` + groupname=`stat -c "%U %G" /var/log/syslog | awk '{print $2}'` +fi + for arg in "$@"; do if [ `expr -- "$arg" : '--prefix='` -eq 9 ]; then prefix="`echo $arg | awk -F= '{print $2}'`" @@ -28,6 +42,7 @@ for arg in "$@"; do user="`echo $arg | awk -F= '{print $2}'`" groupname=$user username=$user + non_root_user=yes elif [ `expr -- "$arg" : '--..*'` -ge 3 ]; then echo "ignoring unknown argument: $arg" 1>&2 elif [ `expr -- "$arg" : '--'` -eq 2 ]; then @@ -157,12 +172,17 @@ fi } makeDir() { - test -d /var/log/mariadb/columnstore || mkdir -p /var/log/mariadb/columnstore >/dev/null 2>&1 - test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1 - test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1 - test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1 - chmod 777 -R /var/log/mariadb/columnstore - chown $user:$user -R /var/log/mariadb + if [ ! -d /var/log/mariadb/columnstore ]; then + mkdir -p /var/log/mariadb/columnstore >/dev/null 2>&1 + test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1 + test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1 + test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1 + chown $username:$groupname -R /var/log/mariadb + else + test -d /var/log/mariadb/columnstore/archive || mkdir /var/log/mariadb/columnstore/archive >/dev/null 2>&1 + test -d /var/log/mariadb/columnstore/corefiles || mkdir /var/log/mariadb/columnstore/corefiles >/dev/null 2>&1 + test -d /var/log/mariadb/columnstore/trace || mkdir /var/log/mariadb/columnstore/trace >/dev/null 2>&1 + fi } install() { @@ -170,15 +190,15 @@ makeDir checkSyslog if [ ! -z "$syslog_conf" ] ; then $installdir/bin/setConfig -d Installation SystemLogConfigFile ${syslog_conf} >/dev/null 2>&1 - if [ $user != "root" ]; then - chown $user:$user /home/$user/mariadb/columnstore/etc/* - fi + if [ $non_root_user == "yes" ]; then + chown $user:$user $installdir/etc/Columnstore.xml* + fi + rm -f ${syslog_conf}.columnstoreSave if [ "$syslog_conf" == /etc/rsyslog.d/columnstore.conf ] || [ "$syslog_conf" == /etc/rsyslog.d/49-columnstore.conf ]; then i=1 else - rm -f ${syslog_conf}.columnstoreSave cp ${syslog_conf} ${syslog_conf}.columnstoreSave >/dev/null 2>&1 sed -i '/# MariaDB/,$d' ${syslog_conf}.columnstoreSave > /dev/null 2>&1 fi @@ -188,21 +208,6 @@ if [ ! -z "$syslog_conf" ] ; then #set the syslog for ColumnStore logging # remove older version incase it was installed by previous build rm -rf /etc/rsyslog.d/columnstore.conf - - # determine username/groupname - - if [ -f /var/log/messages ]; then - user=`stat -c "%U %G" /var/log/messages | awk '{print $1}'` - group=`stat -c "%U %G" /var/log/messages | awk '{print $2}'` - fi - - if [ -f /var/log/syslog ]; then - user=`stat -c "%U %G" /var/log/syslog | awk '{print $1}'` - group=`stat -c "%U %G" /var/log/syslog | awk '{print $2}'` - fi - - # set permissions - chown $user:$group -R /var/log/mariadb > /dev/null 2>&1 if [ $rsyslog7 == 1 ]; then rm -f /etc/rsyslog.d/49-columnstore.conf @@ -210,16 +215,41 @@ if [ ! -z "$syslog_conf" ] ; then sed -i -e s/groupname/$groupname/g ${syslog_conf} sed -i -e s/username/$username/g ${syslog_conf} + chmod 644 ${syslog_conf} else cp ${columnstoreSyslogFile} ${syslog_conf} fi fi - # install Columnstore Log Rotate File - cp $installdir/bin/columnstoreLogRotate /etc/logrotate.d/columnstore > /dev/null 2>&1 - chmod 644 /etc/logrotate.d/columnstore - restartSyslog + + # install Columnstore Log Rotate File + if [ -d /etc/logrotate.d ]; then + cp $installdir/bin/columnstoreLogRotate /etc/logrotate.d/columnstore > /dev/null 2>&1 + chmod 644 /etc/logrotate.d/columnstore + + #do the logrotate to start with a fresh log file during install + logrotate -f /etc/logrotate.d/columnstore > /dev/null 2>&1 + fi + + #log install message and find the least permission that allows logging to work + CHMOD_LIST=("750" "770" "775" "777") + for CHMOD in "${CHMOD_LIST[@]}"; do + chmod $CHMOD /var/log/mariadb + chmod $CHMOD /var/log/mariadb/columnstore + chmod $CHMOD /var/log/mariadb/columnstore/archive + chmod $CHMOD /var/log/mariadb/columnstore/corefiles + chmod $CHMOD /var/log/mariadb/columnstore/trace + + test -f $installdir/post/functions && . $installdir/post/functions + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$installdir/lib $installdir/bin/cplogger -i 19 "***** MariaDB Columnstore Installed *****" + + if [ -f /var/log/mariadb/columnstore/info.log ]; then + if [ -s /var/log/mariadb/columnstore/info.log ]; then + exit 0 + fi + fi + done fi } @@ -233,7 +263,7 @@ if [ ! -z "$syslog_conf" ] ; then if [ $? -eq 0 ]; then if [ -f ${syslog_conf}.columnstoreSave ] ; then #uninstall the syslog for ColumnStore logging - v -f ${syslog_conf} ${syslog_conf}.ColumnStoreBackup + mv -f ${syslog_conf} ${syslog_conf}.ColumnStoreBackup mv -f ${syslog_conf}.columnstoreSave ${syslog_conf} >/dev/null 2>&1 if [ ! -f ${syslog_conf} ] ; then cp ${syslog_conf}.ColumnStoreBackup ${syslog_conf} @@ -252,7 +282,6 @@ if [ ! -z "$syslog_conf" ] ; then rm -f /etc/logrotate.d/columnstore restartSyslog - fi } diff --git a/oam/oamcpp/oamcpp.vpj b/oam/oamcpp/oamcpp.vpj index ce008c9d5..45ed51878 100644 --- a/oam/oamcpp/oamcpp.vpj +++ b/oam/oamcpp/oamcpp.vpj @@ -1,225 +1,225 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oamapps/hardwareMonitor/HardwareMonitor.vpj b/oamapps/hardwareMonitor/HardwareMonitor.vpj index 6e48fd6cf..a376e6628 100644 --- a/oamapps/hardwareMonitor/HardwareMonitor.vpj +++ b/oamapps/hardwareMonitor/HardwareMonitor.vpj @@ -1,218 +1,218 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oamapps/postConfigure/mycnfUpgrade.cpp b/oamapps/postConfigure/mycnfUpgrade.cpp index a7c7308bc..7f785153e 100644 --- a/oamapps/postConfigure/mycnfUpgrade.cpp +++ b/oamapps/postConfigure/mycnfUpgrade.cpp @@ -54,38 +54,39 @@ using namespace std; using namespace oam; -/* MCOL-1844. On an upgrade, the user may have customized options in their old + +/* MCOL-1844. On an upgrade, the user may have customized options in their old * myCnf-include-args.text file. Merge it with the packaged version, and then process as we * have before. */ string rtrim(const string &in) { - string::const_reverse_iterator rbegin = in.rbegin(); - while (rbegin != in.rend() && isspace(*rbegin)) - ++rbegin; - return string(in.begin(), rbegin.base()); + string::const_reverse_iterator rbegin = in.rbegin(); + while (rbegin != in.rend() && isspace(*rbegin)) + ++rbegin; + return string(in.begin(), rbegin.base()); } -void mergeMycnfIncludeArgs() +void mergeMycnfIncludeArgs() { - string userArgsFilename = startup::StartUp::installDir() + "/bin/myCnf-include-args.text.rpmsave"; - string packagedArgsFilename = startup::StartUp::installDir() + "/bin/myCnf-include-args.text"; - ifstream userArgs(userArgsFilename.c_str()); - fstream packagedArgs(packagedArgsFilename.c_str(), ios::in); + string userArgsFilename = startup::StartUp::installDir() + "/bin/myCnf-include-args.text.rpmsave"; + string packagedArgsFilename = startup::StartUp::installDir() + "/bin/myCnf-include-args.text"; + ifstream userArgs(userArgsFilename.c_str()); + fstream packagedArgs(packagedArgsFilename.c_str(), ios::in); - if (!userArgs || !packagedArgs) - return; + if (!userArgs || !packagedArgs) + return; - // de-dup the args and comments in both files - set argMerger; - set comments; - string line; - while (getline(packagedArgs, line)) { - line = rtrim(line); - if (line[0] == '#') - comments.insert(line); - else if (line.size() > 0) - argMerger.insert(line); - } + // de-dup the args and comments in both files + set argMerger; + set comments; + string line; + while (getline(packagedArgs, line)) { + line = rtrim(line); + if (line[0] == '#') + comments.insert(line); + else if (line.size() > 0) + argMerger.insert(line); + } while (getline(userArgs, line)) { line = rtrim(line); if (line[0] == '#') @@ -93,17 +94,17 @@ void mergeMycnfIncludeArgs() else if (line.size() > 0) argMerger.insert(line); } - userArgs.close(); - packagedArgs.close(); + userArgs.close(); + packagedArgs.close(); - // write the merged version, comments first. They'll get ordered - // alphabetically but, meh. - packagedArgs.open(packagedArgsFilename.c_str(), ios::out | ios::trunc); - for (set::iterator it = comments.begin(); it != comments.end(); it++) - packagedArgs << *it << endl; - for (set::iterator it = argMerger.begin(); it != argMerger.end(); it++) - packagedArgs << *it << endl; - packagedArgs.close(); + // write the merged version, comments first. They'll get ordered + // alphabetically but, meh. + packagedArgs.open(packagedArgsFilename.c_str(), ios::out | ios::trunc); + for (set::iterator it = comments.begin(); it != comments.end(); it++) + packagedArgs << *it << endl; + for (set::iterator it = argMerger.begin(); it != argMerger.end(); it++) + packagedArgs << *it << endl; + packagedArgs.close(); } int main(int argc, char* argv[]) @@ -142,9 +143,9 @@ int main(int argc, char* argv[]) exit (1); } - // MCOL-1844. The user may have added options to their myCnf-include-args file. Merge - // myCnf-include-args.text with myCnf-include-args.text.rpmsave, save in myCnf-include-args.text - mergeMycnfIncludeArgs(); + // MCOL-1844. The user may have added options to their myCnf-include-args file. Merge + // myCnf-include-args.text with myCnf-include-args.text.rpmsave, save in myCnf-include-args.text + mergeMycnfIncludeArgs(); //include arguments file string includeFile = startup::StartUp::installDir() + "/bin/myCnf-include-args.text"; @@ -218,7 +219,7 @@ int main(int argc, char* argv[]) ofstream newFile (mycnfFile.c_str()); //create new file - int fd = open(mycnfFile.c_str(), O_RDWR | O_CREAT, 0666); + int fd = open(mycnfFile.c_str(), O_RDWR|O_CREAT, 0644); copy(lines.begin(), lines.end(), ostream_iterator(newFile, "\n")); newFile.close(); diff --git a/oamapps/postConfigure/postConfigure.vpj b/oamapps/postConfigure/postConfigure.vpj index 81d372dee..cc89393af 100644 --- a/oamapps/postConfigure/postConfigure.vpj +++ b/oamapps/postConfigure/postConfigure.vpj @@ -1,223 +1,223 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oamapps/replayTransactionLog/ReplayTransactionLog.vpj b/oamapps/replayTransactionLog/ReplayTransactionLog.vpj index 034df4c88..ce3154c21 100644 --- a/oamapps/replayTransactionLog/ReplayTransactionLog.vpj +++ b/oamapps/replayTransactionLog/ReplayTransactionLog.vpj @@ -1,216 +1,216 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oamapps/resourceMonitor/resourceMonitor.vpj b/oamapps/resourceMonitor/resourceMonitor.vpj index b8c69a721..c88870832 100644 --- a/oamapps/resourceMonitor/resourceMonitor.vpj +++ b/oamapps/resourceMonitor/resourceMonitor.vpj @@ -1,216 +1,216 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oamapps/serverMonitor/ServerMonitor.vpj b/oamapps/serverMonitor/ServerMonitor.vpj index a5e5909e2..212a1cf81 100644 --- a/oamapps/serverMonitor/ServerMonitor.vpj +++ b/oamapps/serverMonitor/ServerMonitor.vpj @@ -1,237 +1,237 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/primitives/blockcache/blockcache.vpj b/primitives/blockcache/blockcache.vpj index 672753473..da41e8eb5 100644 --- a/primitives/blockcache/blockcache.vpj +++ b/primitives/blockcache/blockcache.vpj @@ -1,236 +1,236 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/primitives/primproc/primproc.cpp b/primitives/primproc/primproc.cpp index 3957cc783..2e88493a0 100644 --- a/primitives/primproc/primproc.cpp +++ b/primitives/primproc/primproc.cpp @@ -391,7 +391,7 @@ int main(int argc, char* argv[]) int serverQueueSize = 10; int processorWeight = 8 * 1024; int processorQueueSize = 10 * 1024; - int BRPBlocksPct = 70; + int64_t BRPBlocksPct = 70; uint32_t BRPBlocks = 1887437; int BRPThreads = 16; int cacheCount = 1; @@ -503,16 +503,10 @@ int main(int argc, char* argv[]) } string strBlockPct = cf->getConfig(dbbc, "NumBlocksPct"); - string strBlockAbs = cf->getConfig(dbbc, "NumBlocksInMB"); - bool usePct = !(strBlockPct.empty()); // which to use. Prefer Pct if both are specified. - - if (usePct) - temp = atoi(strBlockPct.c_str()); - else - temp = atoi(strBlockAbs.c_str()); + temp = atoi(strBlockPct.c_str()); #ifdef _MSC_VER - /* TODO: implement handling for NumBlocksInMB */ + /* TODO: implement handling for the 'm' or 'g' chars in NumBlocksPct */ if (temp > 0) BRPBlocksPct = temp; @@ -532,19 +526,21 @@ int main(int argc, char* argv[]) } #else - if (usePct) - { - if (temp > 0) - BRPBlocksPct = temp; - BRPBlocks = ((BRPBlocksPct / 100.0) * (double) cg.getTotalMemory()) / 8192; + bool absCache = false; + if (temp > 0) { + BRPBlocksPct = temp; + /* MCOL-1847. Did the user specify this as an absolute? */ + int len = strBlockPct.length(); + if ((strBlockPct[len-1] >= 'a' && strBlockPct[len-1] <= 'z') || + (strBlockPct[len-1] >= 'A' && strBlockPct[len-1] <= 'Z')) { + absCache = true; + BRPBlocksPct = Config::fromText(strBlockPct); + } } + if (absCache) + BRPBlocks = BRPBlocksPct / 8192; else - { - if (temp > 0) - BRPBlocks = temp * 128; // 128 blocks per MB. - else - BRPBlocks = 131072; // 1GB, why not. - } + BRPBlocks = ((BRPBlocksPct / 100.0) * (double) cg.getTotalMemory()) / 8192; #endif #if 0 temp = toInt(cf->getConfig(dbbc, "NumThreads")); diff --git a/procmgr/processmanager.cpp b/procmgr/processmanager.cpp index 3203c67b2..f21459f22 100644 --- a/procmgr/processmanager.cpp +++ b/procmgr/processmanager.cpp @@ -9176,7 +9176,11 @@ int ProcessManager::getDBRMData(messageqcpp::IOSocket fIos, std::string moduleNa char line[200]; oldFile.getline(line, 200); - currentDbrmFile = line; + // MCOL-1558. Handle absolute and relative paths. + if (line[0] == '/') + currentDbrmFile = line; + else + currentDbrmFile = DBRMroot.substr(0, DBRMroot.find_last_of('/') + 1) + line; } else { diff --git a/procmgr/procmgr.vpj b/procmgr/procmgr.vpj index ab587c6a7..443588442 100644 --- a/procmgr/procmgr.vpj +++ b/procmgr/procmgr.vpj @@ -1,221 +1,221 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/procmon/procmon.vpj b/procmon/procmon.vpj index 0c8c399a8..bb0c6c9fa 100644 --- a/procmon/procmon.vpj +++ b/procmon/procmon.vpj @@ -1,220 +1,220 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/configMgt/autoConfigure.vpj b/tools/configMgt/autoConfigure.vpj index 5d788fe40..edd1497f5 100644 --- a/tools/configMgt/autoConfigure.vpj +++ b/tools/configMgt/autoConfigure.vpj @@ -1,321 +1,321 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/batchloader/batchloader.vpj b/utils/batchloader/batchloader.vpj index 16d7753ee..c48a19007 100644 --- a/utils/batchloader/batchloader.vpj +++ b/utils/batchloader/batchloader.vpj @@ -1,218 +1,218 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/cacheutils/cacheutils.vpj b/utils/cacheutils/cacheutils.vpj index eaefca217..2a8bec873 100644 --- a/utils/cacheutils/cacheutils.vpj +++ b/utils/cacheutils/cacheutils.vpj @@ -1,218 +1,218 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/clusterTester/columnstoreClusterTester.sh b/utils/clusterTester/columnstoreClusterTester.sh index 887ed9af7..7e507dbff 100755 --- a/utils/clusterTester/columnstoreClusterTester.sh +++ b/utils/clusterTester/columnstoreClusterTester.sh @@ -334,7 +334,6 @@ checkSSH() checkRemoteDir() { - if [ "$USER" != "root" ]; then # Non-root User directory permissions check # @@ -342,23 +341,22 @@ checkRemoteDir() echo "** Run Non-root User directory permissions check on remote nodes (/dev/shm)" echo "" - `$COLUMNSTORE_INSTALL_DIR/bin/remote_command.sh $ipadd $PASSWORD 'touch /dev/shm/cs_check' 1 > ${tmpDir}/remote_command_check 2>&1` - rc="$?" - if [ $rc -eq 0 ] || ( [ $rc -eq 2 ] && [ $OS == "suse12" ] ) ; then - `grep "Permission denied" ${tmpDir}/remote_command_check > /dev/null 2>&1` - if [ "$?" -eq 0 ]; then - echo "$ipadd Node permission test on /dev/shm : ${bold}Failed${normal}, change permissions to 777 and re-test" - pass=false - REPORTPASS=false - else - echo "$ipadd Node permission test on /dev/shm : Passed" - fi - else - echo "Error running remote_command.sh to $ipadd Node, check ${tmpDir}/remote_command_check" - pass=false - REPORTPASS=false - fi - done + `$COLUMNSTORE_INSTALL_DIR/bin/remote_command.sh $ipadd $PASSWORD 'touch /dev/shm/cs_check' 1 > ${tmpDir}/remote_command_check 2>&1` + rc="$?" + if [ $rc -eq 0 ] || ( [ $rc -eq 2 ] && [ $OS == "suse12" ] ) ; then + `grep "Permission denied" ${tmpDir}/remote_command_check > /dev/null 2>&1` + if [ "$?" -eq 0 ]; then + echo "$ipadd Node permission test on /dev/shm : ${bold}Failed${normal}, change permissions to 777 and re-test" + pass=false + REPORTPASS=false + else + echo "$ipadd Node permission test on /dev/shm : Passed" + fi + else + echo "Error running remote_command.sh to $ipadd Node, check ${tmpDir}/remote_command_check" + pass=false + REPORTPASS=false + fi if ! $pass; then checkContinue diff --git a/utils/compress/compress.vpj b/utils/compress/compress.vpj index 860ce8693..02ecfff14 100644 --- a/utils/compress/compress.vpj +++ b/utils/compress/compress.vpj @@ -1,231 +1,231 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/configcpp/configcpp.vpj b/utils/configcpp/configcpp.vpj index d8dff4d13..73b33cfb3 100644 --- a/utils/configcpp/configcpp.vpj +++ b/utils/configcpp/configcpp.vpj @@ -1,229 +1,229 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/dataconvert/dataconvert.vpj b/utils/dataconvert/dataconvert.vpj index d38ab71c0..e2b2b9763 100644 --- a/utils/dataconvert/dataconvert.vpj +++ b/utils/dataconvert/dataconvert.vpj @@ -1,227 +1,227 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/dataconvert/tdriver.vpj b/utils/dataconvert/tdriver.vpj index 2e665c68c..4b6a8630a 100644 --- a/utils/dataconvert/tdriver.vpj +++ b/utils/dataconvert/tdriver.vpj @@ -1,221 +1,221 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/ddlcleanup/ddlcleanup.vpj b/utils/ddlcleanup/ddlcleanup.vpj index 777a12f05..b207dd826 100644 --- a/utils/ddlcleanup/ddlcleanup.vpj +++ b/utils/ddlcleanup/ddlcleanup.vpj @@ -1,218 +1,218 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/funcexp/func_concat_ws.cpp b/utils/funcexp/func_concat_ws.cpp index 767544291..d5519fd4f 100644 --- a/utils/funcexp/func_concat_ws.cpp +++ b/utils/funcexp/func_concat_ws.cpp @@ -97,7 +97,7 @@ string Func_concat_ws::getStrVal(Row& row, string tmp; for ( uint32_t i = 1 ; i < parm.size() ; i++) { - string(stringValue(parm[i], row, isNull).c_str(), tmp); + stringValue(parm[i], row, isNull, tmp); str += tmp; if (isNull) diff --git a/utils/idbdatafile/idbdatafile.vpj b/utils/idbdatafile/idbdatafile.vpj index cacaa56bc..cd2d7e77c 100644 --- a/utils/idbdatafile/idbdatafile.vpj +++ b/utils/idbdatafile/idbdatafile.vpj @@ -1,245 +1,245 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/idbhdfs/idbhdfs.vpj b/utils/idbhdfs/idbhdfs.vpj index 7bac0bf8e..a3704675d 100644 --- a/utils/idbhdfs/idbhdfs.vpj +++ b/utils/idbhdfs/idbhdfs.vpj @@ -1,230 +1,230 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/multicast/multicast.vpj b/utils/multicast/multicast.vpj index 963327b70..42a806ce0 100644 --- a/utils/multicast/multicast.vpj +++ b/utils/multicast/multicast.vpj @@ -1,231 +1,231 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/regr/corr.cpp b/utils/regr/corr.cpp index f8d645ad4..3c819b86d 100644 --- a/utils/regr/corr.cpp +++ b/utils/regr/corr.cpp @@ -61,8 +61,8 @@ mcsv1_UDAF::ReturnCode corr::init(mcsv1Context* context, context->setUserDataSize(sizeof(corr_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/covar_pop.cpp b/utils/regr/covar_pop.cpp index 539497b6a..51d9a036f 100644 --- a/utils/regr/covar_pop.cpp +++ b/utils/regr/covar_pop.cpp @@ -59,8 +59,8 @@ mcsv1_UDAF::ReturnCode covar_pop::init(mcsv1Context* context, context->setUserDataSize(sizeof(covar_pop_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/covar_samp.cpp b/utils/regr/covar_samp.cpp index f3e16ffc4..b0ebb168b 100644 --- a/utils/regr/covar_samp.cpp +++ b/utils/regr/covar_samp.cpp @@ -59,8 +59,8 @@ mcsv1_UDAF::ReturnCode covar_samp::init(mcsv1Context* context, context->setUserDataSize(sizeof(covar_samp_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; @@ -136,7 +136,7 @@ mcsv1_UDAF::ReturnCode covar_samp::evaluate(mcsv1Context* context, static_any::a { struct covar_samp_data* data = (struct covar_samp_data*)context->getUserData()->data; double N = data->cnt; - if (N > 0) + if (N > 1) { double sumx = data->sumx; double sumy = data->sumy; @@ -145,6 +145,11 @@ mcsv1_UDAF::ReturnCode covar_samp::evaluate(mcsv1Context* context, static_any::a double covar_samp = (sumxy - ((sumx * sumy) / N)) / (N - 1); valOut = covar_samp; } + else + if (N == 1) + { + valOut = 0; + } return mcsv1_UDAF::SUCCESS; } diff --git a/utils/regr/regr_intercept.cpp b/utils/regr/regr_intercept.cpp index 7b0ccb943..6d4c35a47 100644 --- a/utils/regr/regr_intercept.cpp +++ b/utils/regr/regr_intercept.cpp @@ -60,8 +60,8 @@ mcsv1_UDAF::ReturnCode regr_intercept::init(mcsv1Context* context, context->setUserDataSize(sizeof(regr_intercept_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; @@ -145,12 +145,11 @@ mcsv1_UDAF::ReturnCode regr_intercept::evaluate(mcsv1Context* context, static_an double sumy = data->sumy; double sumx2 = data->sumx2; double sumxy = data->sumxy; - double slope = 0.0; - double variance = (N * sumx2) - (sumx * sumx); - if (variance != 0) + double numerator = sumy * sumx2 - sumx * sumxy; + double var_pop = (N * sumx2) - (sumx * sumx); + if (var_pop != 0) { - slope = ((N * sumxy) - (sumx * sumy)) / variance; - valOut = (sumy - (slope * sumx)) / N; + valOut = numerator / var_pop; } } return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/regr_r2.cpp b/utils/regr/regr_r2.cpp index f8c923ee8..34e8888e8 100644 --- a/utils/regr/regr_r2.cpp +++ b/utils/regr/regr_r2.cpp @@ -61,8 +61,8 @@ mcsv1_UDAF::ReturnCode regr_r2::init(mcsv1Context* context, context->setUserDataSize(sizeof(regr_r2_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/regr_slope.cpp b/utils/regr/regr_slope.cpp index 721ab6a22..da178673a 100644 --- a/utils/regr/regr_slope.cpp +++ b/utils/regr/regr_slope.cpp @@ -60,8 +60,8 @@ mcsv1_UDAF::ReturnCode regr_slope::init(mcsv1Context* context, context->setUserDataSize(sizeof(regr_slope_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; @@ -141,14 +141,16 @@ mcsv1_UDAF::ReturnCode regr_slope::evaluate(mcsv1Context* context, static_any::a double N = data->cnt; if (N > 0) { + // COVAR_POP(y, x) / VAR_POP(x) double sumx = data->sumx; double sumy = data->sumy; double sumx2 = data->sumx2; double sumxy = data->sumxy; - double variance = (N * sumx2) - (sumx * sumx); - if (variance != 0) + double covar_pop = N * sumxy - sumx * sumy; + double var_pop = N * sumx2 - sumx * sumx; + if (var_pop != 0) { - double slope = ((N * sumxy) - (sumx * sumy)) / variance; + double slope = covar_pop / var_pop; valOut = slope; } } diff --git a/utils/regr/regr_sxx.cpp b/utils/regr/regr_sxx.cpp index a11b06a7d..3f06af61b 100644 --- a/utils/regr/regr_sxx.cpp +++ b/utils/regr/regr_sxx.cpp @@ -58,8 +58,8 @@ mcsv1_UDAF::ReturnCode regr_sxx::init(mcsv1Context* context, context->setUserDataSize(sizeof(regr_sxx_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/regr_sxy.cpp b/utils/regr/regr_sxy.cpp index e3df580b6..e6d005597 100644 --- a/utils/regr/regr_sxy.cpp +++ b/utils/regr/regr_sxy.cpp @@ -59,8 +59,8 @@ mcsv1_UDAF::ReturnCode regr_sxy::init(mcsv1Context* context, context->setUserDataSize(sizeof(regr_sxy_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/regr_syy.cpp b/utils/regr/regr_syy.cpp index 3b0ec7c8d..d0841f723 100644 --- a/utils/regr/regr_syy.cpp +++ b/utils/regr/regr_syy.cpp @@ -58,8 +58,8 @@ mcsv1_UDAF::ReturnCode regr_syy::init(mcsv1Context* context, context->setUserDataSize(sizeof(regr_syy_data)); context->setResultType(CalpontSystemCatalog::DOUBLE); context->setColWidth(8); - context->setScale(colTypes[0].scale + 8); - context->setPrecision(19); + context->setScale(DECIMAL_NOT_SPECIFIED); + context->setPrecision(0); context->setRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS); return mcsv1_UDAF::SUCCESS; diff --git a/utils/regr/regrmysql.cpp b/utils/regr/regrmysql.cpp index 822d05ca6..08f46bb11 100644 --- a/utils/regr/regrmysql.cpp +++ b/utils/regr/regrmysql.cpp @@ -581,12 +581,13 @@ extern "C" double sumy = data->sumy; double sumx2 = data->sumx2; double sumxy = data->sumxy; + double slope = 0; double variance = (N * sumx2) - (sumx * sumx); if (variance) { - double slope = ((N * sumxy) - (sumx * sumy)) / variance; - return (sumy - (slope * sumx)) / N; + slope = ((N * sumxy) - (sumx * sumy)) / variance; } + return (sumy - (slope * sumx)) / N; } *is_null = 1; return 0; diff --git a/utils/rowgroup/rowaggregation.cpp b/utils/rowgroup/rowaggregation.cpp index d08781c07..8a80ca683 100644 --- a/utils/rowgroup/rowaggregation.cpp +++ b/utils/rowgroup/rowaggregation.cpp @@ -1673,11 +1673,10 @@ void RowAggregation::updateEntry(const Row& rowIn) { for (uint64_t i = 0; i < fFunctionCols.size(); i++) { - SP_ROWAGG_FUNC_t pFunctionCol = fFunctionCols[i]; - int64_t colIn = pFunctionCol->fInputColumnIndex; - int64_t colOut = pFunctionCol->fOutputColumnIndex; + int64_t colIn = fFunctionCols[i]->fInputColumnIndex; + int64_t colOut = fFunctionCols[i]->fOutputColumnIndex; - switch (pFunctionCol->fAggFunction) + switch (fFunctionCols[i]->fAggFunction) { case ROWAGG_COUNT_COL_NAME: @@ -1691,7 +1690,7 @@ void RowAggregation::updateEntry(const Row& rowIn) case ROWAGG_MIN: case ROWAGG_MAX: case ROWAGG_SUM: - doMinMaxSum(rowIn, colIn, colOut, pFunctionCol->fAggFunction); + doMinMaxSum(rowIn, colIn, colOut, fFunctionCols[i]->fAggFunction); break; case ROWAGG_AVG: @@ -1708,7 +1707,7 @@ void RowAggregation::updateEntry(const Row& rowIn) case ROWAGG_BIT_OR: case ROWAGG_BIT_XOR: { - doBitOp(rowIn, colIn, colOut, pFunctionCol->fAggFunction); + doBitOp(rowIn, colIn, colOut, fFunctionCols[i]->fAggFunction); break; } @@ -1731,7 +1730,7 @@ void RowAggregation::updateEntry(const Row& rowIn) { std::ostringstream errmsg; errmsg << "RowAggregation: function (id = " << - (uint64_t) pFunctionCol->fAggFunction << ") is not supported."; + (uint64_t) fFunctionCols[i]->fAggFunction << ") is not supported."; cerr << errmsg.str() << endl; throw logging::QueryDataExcept(errmsg.str(), logging::aggregateFuncErr); break; @@ -2015,7 +2014,6 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, for (uint32_t i = 0; i < paramCount; ++i) { - SP_ROWAGG_FUNC_t pFunctionCol = fFunctionCols[funcColsIdx]; mcsv1sdk::ColumnDatum& datum = valsIn[i]; // Turn on NULL flags based on the data dataFlags[i] = 0; @@ -2024,9 +2022,9 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, // to acces the constant value rather than a row value. cc = NULL; - if (pFunctionCol->fpConstCol) + if (fFunctionCols[funcColsIdx]->fpConstCol) { - cc = dynamic_cast(pFunctionCol->fpConstCol.get()); + cc = dynamic_cast(fFunctionCols[funcColsIdx]->fpConstCol.get()); } if ((cc && cc->type() == ConstantColumn::NULLDATA) @@ -2243,9 +2241,8 @@ void RowAggregation::doUDAF(const Row& rowIn, int64_t colIn, int64_t colOut, && fFunctionCols[funcColsIdx + 1]->fAggFunction == ROWAGG_MULTI_PARM) { ++funcColsIdx; - SP_ROWAGG_FUNC_t pFunctionCol = fFunctionCols[funcColsIdx]; - colIn = pFunctionCol->fInputColumnIndex; - colOut = pFunctionCol->fOutputColumnIndex; + colIn = fFunctionCols[funcColsIdx]->fInputColumnIndex; + colOut = fFunctionCols[funcColsIdx]->fOutputColumnIndex; } else { diff --git a/utils/rwlock/rwlock.vpj b/utils/rwlock/rwlock.vpj index cb1007232..3d2e45619 100644 --- a/utils/rwlock/rwlock.vpj +++ b/utils/rwlock/rwlock.vpj @@ -1,222 +1,222 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/startup/startup.vpj b/utils/startup/startup.vpj index 3fc1d2480..8f2340702 100644 --- a/utils/startup/startup.vpj +++ b/utils/startup/startup.vpj @@ -1,222 +1,222 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/udfsdk/avg_mode.cpp b/utils/udfsdk/avg_mode.cpp index 5429183d9..dba0859fb 100644 --- a/utils/udfsdk/avg_mode.cpp +++ b/utils/udfsdk/avg_mode.cpp @@ -69,65 +69,13 @@ mcsv1_UDAF::ReturnCode avg_mode::nextValue(mcsv1Context* context, ColumnDatum* v { static_any::any& valIn = valsIn[0].columnData; MODE_DATA& data = static_cast(context->getUserData())->mData; - DATATYPE val = 0.0; if (valIn.empty()) { return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn.compatible(charTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(scharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(shortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(intTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(longTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(llTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ucharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ushortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(uintTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ulongTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ullTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(floatTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(doubleTypeId)) - { - val = valIn.cast(); - } + DATATYPE val = convertAnyTo(valIn); // For decimal types, we need to move the decimal point. uint32_t scale = valsIn[0].scale; @@ -190,65 +138,13 @@ mcsv1_UDAF::ReturnCode avg_mode::dropValue(mcsv1Context* context, ColumnDatum* v { static_any::any& valIn = valsDropped[0].columnData; MODE_DATA& data = static_cast(context->getUserData())->mData; - DATATYPE val = 0.0; if (valIn.empty()) { return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn.compatible(charTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(scharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(shortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(intTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(longTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(llTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ucharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ushortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(uintTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ulongTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ullTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(floatTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(doubleTypeId)) - { - val = valIn.cast(); - } + DATATYPE val = convertAnyTo(valIn); // For decimal types, we need to move the decimal point. uint32_t scale = valsDropped[0].scale; diff --git a/utils/udfsdk/avgx.cpp b/utils/udfsdk/avgx.cpp index 5af852967..15548db36 100644 --- a/utils/udfsdk/avgx.cpp +++ b/utils/udfsdk/avgx.cpp @@ -75,69 +75,13 @@ mcsv1_UDAF::ReturnCode avgx::nextValue(mcsv1Context* context, ColumnDatum* valsI { static_any::any& valIn_x = valsIn[0].columnData; struct avgx_data* data = (struct avgx_data*)context->getUserData()->data; - DATATYPE val = 0.0; if (valIn_x.empty()) { return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn_x.compatible(longTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(charTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(scharTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(shortTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(intTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(longTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(llTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ucharTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ushortTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(uintTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ulongTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ullTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(floatTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(doubleTypeId)) - { - val = valIn_x.cast(); - } + DATATYPE val = convertAnyTo(valIn_x); // For decimal types, we need to move the decimal point. uint32_t scale = valsIn[0].scale; @@ -183,65 +127,13 @@ mcsv1_UDAF::ReturnCode avgx::dropValue(mcsv1Context* context, ColumnDatum* valsD { static_any::any& valIn_x = valsDropped[0].columnData; struct avgx_data* data = (struct avgx_data*)context->getUserData()->data; - DATATYPE val = 0.0; if (valIn_x.empty()) { return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn_x.compatible(charTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(scharTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(shortTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(intTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(longTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(llTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ucharTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ushortTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(uintTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ulongTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(ullTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(floatTypeId)) - { - val = valIn_x.cast(); - } - else if (valIn_x.compatible(doubleTypeId)) - { - val = valIn_x.cast(); - } + DATATYPE val = convertAnyTo(valIn_x); // For decimal types, we need to move the decimal point. uint32_t scale = valsDropped[0].scale; diff --git a/utils/udfsdk/docs/source/usage/sourcefile.rst b/utils/udfsdk/docs/source/usage/sourcefile.rst old mode 100644 new mode 100755 index 5c43f29e4..ce0aa0d6f --- a/utils/udfsdk/docs/source/usage/sourcefile.rst +++ b/utils/udfsdk/docs/source/usage/sourcefile.rst @@ -124,9 +124,9 @@ nextValue() nextValue() is called from the PM for aggregate usage and the UM for Analytic usage. -valsIn contains a vector of all the parameters from the function call in the SQL query (In Columndtore 1.1, this will always contain exactly one entry). +valsIn contains a vector of all the parameters from the function call in the SQL query. -Depending on your function, you may wish to be able to handle many different types of input. A good way to handle this is to have a series of if..else..if statements comparing the input type and dealing with each separately. For instace, if you want to handle multiple numeric types, you might use:: +Depending on your function, you may wish to be able to handle many different types of input. There's a helper template function convertAnyTo() which will convert the input static:any value to the designated type. For Example, if your internal accumulater is of type double, you might use:: static_any::any& valIn = valsDropped[0].columnData; AVGData& data = static_cast(context->getUserData())->mData; @@ -137,21 +137,7 @@ Depending on your function, you may wish to be able to handle many different typ return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn.compatible(charTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(scharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(shortTypeId)) - { - val = valIn.cast(); - } - . - . - . + val = convertAnyTo(valIn); Once you've gotten your data in a format you like, then do your aggregation. For AVG, you might see:: diff --git a/utils/udfsdk/median.cpp b/utils/udfsdk/median.cpp index 9c7e72dc3..2d4750e4d 100644 --- a/utils/udfsdk/median.cpp +++ b/utils/udfsdk/median.cpp @@ -69,65 +69,13 @@ mcsv1_UDAF::ReturnCode median::nextValue(mcsv1Context* context, ColumnDatum* val { static_any::any& valIn = valsIn[0].columnData; MEDIAN_DATA& data = static_cast(context->getUserData())->mData; - DATATYPE val = 0.0; if (valIn.empty()) { return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn.compatible(charTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(scharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(shortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(intTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(longTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(llTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ucharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ushortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(uintTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ulongTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ullTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(floatTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(doubleTypeId)) - { - val = valIn.cast(); - } + DATATYPE val = convertAnyTo(valIn); // For decimal types, we need to move the decimal point. uint32_t scale = valsIn[0].scale; @@ -215,65 +163,13 @@ mcsv1_UDAF::ReturnCode median::dropValue(mcsv1Context* context, ColumnDatum* val { static_any::any& valIn = valsDropped[0].columnData; MEDIAN_DATA& data = static_cast(context->getUserData())->mData; - DATATYPE val = 0.0; if (valIn.empty()) { return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn.compatible(charTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(scharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(shortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(intTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(longTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(llTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ucharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ushortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(uintTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ulongTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ullTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(floatTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(doubleTypeId)) - { - val = valIn.cast(); - } + DATATYPE val = convertAnyTo(valIn); // For decimal types, we need to move the decimal point. uint32_t scale = valsDropped[0].scale; diff --git a/utils/udfsdk/ssq.cpp b/utils/udfsdk/ssq.cpp index 20fdc33db..74b60b5f6 100644 --- a/utils/udfsdk/ssq.cpp +++ b/utils/udfsdk/ssq.cpp @@ -85,65 +85,13 @@ mcsv1_UDAF::ReturnCode ssq::nextValue(mcsv1Context* context, ColumnDatum* valsIn { static_any::any& valIn = valsIn[0].columnData; struct ssq_data* data = (struct ssq_data*)context->getUserData()->data; - DATATYPE val = 0.0; if (context->isParamNull(0) || valIn.empty()) { return mcsv1_UDAF::SUCCESS; } - if (valIn.compatible(charTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(scharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(shortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(intTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(longTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(llTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ucharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ushortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(uintTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ulongTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ullTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(floatTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(doubleTypeId)) - { - val = valIn.cast(); - } + DATATYPE val = convertAnyTo(valIn); // For decimal types, we need to move the decimal point. uint32_t scale = valsIn[0].scale; @@ -186,65 +134,13 @@ mcsv1_UDAF::ReturnCode ssq::dropValue(mcsv1Context* context, ColumnDatum* valsDr { static_any::any& valIn = valsDropped[0].columnData; struct ssq_data* data = (struct ssq_data*)context->getUserData()->data; - DATATYPE val = 0.0; if (valIn.empty()) { return mcsv1_UDAF::SUCCESS; // Ought not happen when UDAF_IGNORE_NULLS is on. } - if (valIn.compatible(charTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(scharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(shortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(intTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(longTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(llTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ucharTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ushortTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(uintTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ulongTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(ullTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(floatTypeId)) - { - val = valIn.cast(); - } - else if (valIn.compatible(doubleTypeId)) - { - val = valIn.cast(); - } + DATATYPE val = convertAnyTo(valIn); // For decimal types, we need to move the decimal point. uint32_t scale = valsDropped[0].scale; diff --git a/utils/udfsdk/udfsdk.vpj b/utils/udfsdk/udfsdk.vpj index 1096f8431..65db73610 100755 --- a/utils/udfsdk/udfsdk.vpj +++ b/utils/udfsdk/udfsdk.vpj @@ -205,6 +205,7 @@ + @@ -217,6 +218,7 @@ + diff --git a/utils/windowfunction/wf_udaf.cpp b/utils/windowfunction/wf_udaf.cpp index f9e38d9a1..eabd121db 100644 --- a/utils/windowfunction/wf_udaf.cpp +++ b/utils/windowfunction/wf_udaf.cpp @@ -481,6 +481,7 @@ bool WF_udaf::dropValues(int64_t b, int64_t e) } } + WindowFunctionType::resetData(); return true; } diff --git a/utils/windowfunction/windowfunction.cpp b/utils/windowfunction/windowfunction.cpp index a62d42042..c46259e4a 100644 --- a/utils/windowfunction/windowfunction.cpp +++ b/utils/windowfunction/windowfunction.cpp @@ -192,18 +192,33 @@ void WindowFunction::operator()() // values leaving the window and nextValue for those entering, rather // than a resetData() and then iterating over the entire window. // Built-in functions may have this functionality added in the future. - if (fFunctionType->dropValues(prevFrame.first, w.first)) + // If b > e then the frame is entirely outside of the partition + // and there's no values to drop + if (b <= e) { - b = firstTime ? w.first : prevFrame.second + 1; + if (!firstTime) + { + if (fFunctionType->dropValues(prevFrame.first, w.first)) + { + // Adjust the beginning of the frame for nextValue + // to start where the previous frame left off. + b = prevFrame.second + 1; + } + else + { + // dropValues failed or doesn't exist + // so calculate the entire frame. + fFunctionType->resetData(); + } + } + else + { + fFunctionType->resetData(); + firstTime = false; + } } - else - { - fFunctionType->resetData(); - } - - fFunctionType->operator()(b, e, i); + fFunctionType->operator()(b, e, i); // UDAnF: Calls nextValue and evaluate prevFrame = w; - firstTime = false; } } } @@ -218,7 +233,7 @@ void WindowFunction::operator()() } catch (...) { - fStep->handleException("unknow exception", logging::ERR_EXECUTE_WINDOW_FUNCTION); + fStep->handleException("unknown exception", logging::ERR_EXECUTE_WINDOW_FUNCTION); } } diff --git a/versioning/BRM/brm.vpj b/versioning/BRM/brm.vpj index 5f28016da..07d034a19 100644 --- a/versioning/BRM/brm.vpj +++ b/versioning/BRM/brm.vpj @@ -1,305 +1,305 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/writeengine/bulk/bulk.vpj b/writeengine/bulk/bulk.vpj index 402a35a27..de86cdd04 100644 --- a/writeengine/bulk/bulk.vpj +++ b/writeengine/bulk/bulk.vpj @@ -1,301 +1,301 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/writeengine/bulk/we_bulkloadbuffer.cpp b/writeengine/bulk/we_bulkloadbuffer.cpp index 877f0b033..da568f9a6 100644 --- a/writeengine/bulk/we_bulkloadbuffer.cpp +++ b/writeengine/bulk/we_bulkloadbuffer.cpp @@ -31,8 +31,6 @@ #include #include -#include - #include "we_bulkload.h" #include "we_bulkloadbuffer.h" #include "we_brm.h" @@ -370,18 +368,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, { errno = 0; - if (iequals(field, "true")) - { - fVal = 1; - } - else - { #ifdef _MSC_VER - fVal = (float)strtod( field, 0 ); + fVal = (float)strtod( field, 0 ); #else - fVal = strtof( field, 0 ); + fVal = strtof( field, 0 ); #endif - } if (errno == ERANGE) { @@ -414,6 +405,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, fVal = minFltSat; bufStats.satCount++; } + if ( fVal == 0 + && isTrueWord(const_cast(field), fieldLength) ) + { + fVal = 1; + } } } @@ -474,14 +470,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, { errno = 0; - if (iequals(field, "true")) - { - dVal = 1; - } - else - { - dVal = strtod(field, 0); - } + dVal = strtod(field, 0); if (errno == ERANGE) { @@ -514,6 +503,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, dVal = column.fMinDblSat; bufStats.satCount++; } + else if (dVal == 0 + && isTrueWord(const_cast(field), fieldLength)) + { + dVal = 1; + } } } @@ -629,12 +623,6 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, } else { - if (iequals(field, "true")) - { - strcpy(field, "1"); - fieldLength = 1; - } - if ( (column.dataType == CalpontSystemCatalog::DECIMAL ) || (column.dataType == CalpontSystemCatalog::UDECIMAL) ) { @@ -664,6 +652,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, origVal = static_cast(column.fMaxIntSat); bSatVal = true; } + else if ( origVal == 0 + && isTrueWord(const_cast(field), fieldLength) ) + { + origVal = 1; + } if (bSatVal) bufStats.satCount++; @@ -722,15 +715,8 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, { errno = 0; - if (iequals(field, "true")) - { - origVal = 1; - } - else - { - origVal = strtoll(field, 0, 10); - } - + origVal = strtoll(field, 0, 10); + if (errno == ERANGE) bSatVal = true; } @@ -747,6 +733,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, origVal = static_cast(column.fMaxIntSat); bSatVal = true; } + else if ( origVal == 0 + && isTrueWord(const_cast(field), fieldLength) ) + { + origVal = 1; + } if (bSatVal) bufStats.satCount++; @@ -805,12 +796,12 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, } else { - if (iequals(field, "true")) + if (isTrueWord(const_cast(field), fieldLength)) { strcpy(field, "1"); fieldLength = 1; } - + if ( (column.dataType == CalpontSystemCatalog::DECIMAL ) || (column.dataType == CalpontSystemCatalog::UDECIMAL)) { @@ -898,14 +889,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, { errno = 0; - if (iequals(field, "true")) - { - origVal = 1; - } - else - { - origVal = strtoll(field, 0, 10); - } + origVal = strtoll(field, 0, 10); if (errno == ERANGE) bSatVal = true; @@ -923,6 +907,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, origVal = static_cast(column.fMaxIntSat); bSatVal = true; } + else if ( origVal == 0 + && isTrueWord(const_cast(field), fieldLength) ) + { + origVal = 1; + } if (bSatVal) bufStats.satCount++; @@ -981,12 +970,12 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, } else { - if (iequals(field, "true")) + if (isTrueWord(const_cast(field), fieldLength)) { strcpy(field, "1"); fieldLength = 1; } - + if ( (column.dataType == CalpontSystemCatalog::DECIMAL) || (column.dataType == CalpontSystemCatalog::UDECIMAL)) { @@ -1018,6 +1007,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, bSatVal = true; } + if (bSatVal) bufStats.satCount++; @@ -1199,14 +1189,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, { errno = 0; - if (iequals(field, "true")) - { - ullVal = 1; - } - else - { - ullVal = strtoull(field, 0, 10); - } + ullVal = strtoull(field, 0, 10); if (errno == ERANGE) bSatVal = true; @@ -1220,6 +1203,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, ullVal = column.fMaxIntSat; bSatVal = true; } + else if ( ullVal == 0 + && isTrueWord(const_cast(field), fieldLength) ) + { + ullVal = 1; + } if (bSatVal) bufStats.satCount++; @@ -1276,14 +1264,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, { errno = 0; - if (iequals(field, "true")) - { - origVal = 1; - } - else - { - origVal = strtoll(field, 0, 10); - } + origVal = strtoll(field, 0, 10); if (errno == ERANGE) bSatVal = true; @@ -1301,6 +1282,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, origVal = static_cast(column.fMaxIntSat); bSatVal = true; } + else if ( origVal == 0 + && isTrueWord(const_cast(field), fieldLength) ) + { + origVal = 1; + } if (bSatVal) bufStats.satCount++; @@ -1361,12 +1347,12 @@ void BulkLoadBuffer::convert(char* field, int fieldLength, } else { - if (iequals(field, "true")) + if (isTrueWord(const_cast(field), fieldLength)) { strcpy(field, "1"); fieldLength = 1; } - + if ( (column.dataType == CalpontSystemCatalog::DECIMAL) || (column.dataType == CalpontSystemCatalog::UDECIMAL)) { diff --git a/writeengine/bulk/we_bulkloadbuffer.h b/writeengine/bulk/we_bulkloadbuffer.h index 85d60980c..649e9847e 100644 --- a/writeengine/bulk/we_bulkloadbuffer.h +++ b/writeengine/bulk/we_bulkloadbuffer.h @@ -383,5 +383,14 @@ public: } }; +inline bool isTrueWord(const char *field, int fieldLength) +{ + //return false; + return fieldLength == 4 && ( field[0] == 'T' || field[0] == 't' ) + && ( field[1] == 'R' || field[1] == 'r' ) + && ( field[2] == 'U' || field[2] == 'u' ) + && ( field[3] == 'E' || field[3] == 'e' ); +} + } #endif diff --git a/writeengine/client/writeengineclient.vpj b/writeengine/client/writeengineclient.vpj index 65093428e..4afe9c836 100644 --- a/writeengine/client/writeengineclient.vpj +++ b/writeengine/client/writeengineclient.vpj @@ -1,291 +1,291 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/writeengine/dictionary/dictionary.vpj b/writeengine/dictionary/dictionary.vpj index c30613ee2..9aa57303f 100644 --- a/writeengine/dictionary/dictionary.vpj +++ b/writeengine/dictionary/dictionary.vpj @@ -1,222 +1,222 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/writeengine/splitter/splitter.vpj b/writeengine/splitter/splitter.vpj index e7754a250..be853818e 100644 --- a/writeengine/splitter/splitter.vpj +++ b/writeengine/splitter/splitter.vpj @@ -1,256 +1,256 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="." + VCSProject="Subversion:"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/writeengine/wrapper/wrapper.vpj b/writeengine/wrapper/wrapper.vpj index b26d790a4..48fa6614c 100644 --- a/writeengine/wrapper/wrapper.vpj +++ b/writeengine/wrapper/wrapper.vpj @@ -1,229 +1,229 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +