From 2bdcb127eceb5db09577e67e6dc40bdbb4cfc52d Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 15 May 2014 14:35:02 +0400 Subject: [PATCH 1/5] dbms: fixed compilation bug [METR-11023] --- dbms/src/Interpreters/ExpressionAnalyzer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/src/Interpreters/ExpressionAnalyzer.cpp b/dbms/src/Interpreters/ExpressionAnalyzer.cpp index e78a5fd9a0e..39d959d69c4 100644 --- a/dbms/src/Interpreters/ExpressionAnalyzer.cpp +++ b/dbms/src/Interpreters/ExpressionAnalyzer.cpp @@ -661,7 +661,7 @@ void ExpressionAnalyzer::addExternalStorage(ASTFunction * node) ast_set->set = new Set(settings.limits); ast_set->set->setSource(external_data[external_table_name]); ast_set->set->setExternalOutput(external_tables[external_table_name]); - ast_set->set->setOnlyExternal(); + ast_set->set->setOnlyExternal(true); sets_with_subqueries[ast_set->getColumnName()] = ast_set->set; } else From 32e1a76960c9948e3a2f6e017ec0e5826e52ea7b Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 15 May 2014 14:39:52 +0400 Subject: [PATCH 2/5] dbms: fixed number parsing error in table function remote [METR-11112] --- .../DB/TableFunctions/TableFunctionRemote.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dbms/include/DB/TableFunctions/TableFunctionRemote.h b/dbms/include/DB/TableFunctions/TableFunctionRemote.h index 137b32c18a9..854b50862fc 100644 --- a/dbms/include/DB/TableFunctions/TableFunctionRemote.h +++ b/dbms/include/DB/TableFunctions/TableFunctionRemote.h @@ -217,8 +217,21 @@ private: if (right - left + 1 > MAX_ADDRESSES) throw Exception("Storage Distributed, first argument generates too many result addresses", ErrorCodes::BAD_ARGUMENTS); + bool add_leading_zeroes = false; + size_t len = last_dot - 1 - (i + 1); + /// Если у левой и правой границы поровну цифр, значит необходимо дополнять лидирующими нулями. + if (last_dot - 1 - (i + 1) == m - (last_dot + 1)) + add_leading_zeroes = true; for (size_t id = left; id <= right; ++id) - buffer.push_back(toString(id)); + { + String cur = toString(id); + if (add_leading_zeroes) + { + while (cur.size() < len) + cur = "0" + cur; + } + buffer.push_back(cur); + } } else if (have_splitter) /// Если внутри есть текущий разделитель, то сгенерировать множество получаемых строк buffer = parseDescription(description, i + 1, m, splitter); else /// Иначе просто скопировать, порождение произойдет при вызове с правильным разделителем From f5d07ed9dd7f4963366c70a7648cfe4d1c79d736 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 15 May 2014 14:45:44 +0400 Subject: [PATCH 3/5] dbms: fixed uninitialized variable in set.h [METR-11023] --- dbms/include/DB/Interpreters/Set.h | 1 + 1 file changed, 1 insertion(+) diff --git a/dbms/include/DB/Interpreters/Set.h b/dbms/include/DB/Interpreters/Set.h index 0e09731cd1c..fa0ac21259f 100644 --- a/dbms/include/DB/Interpreters/Set.h +++ b/dbms/include/DB/Interpreters/Set.h @@ -38,6 +38,7 @@ public: transfer_overflow_mode(limits.transfer_overflow_mode), bytes_in_external_table(0), rows_in_external_table(0), + only_external(false), log(&Logger::get("Set")), max_rows(limits.max_rows_in_set), max_bytes(limits.max_bytes_in_set), From 0dabdd9950534e057035ce99d1c15a91e53e4be6 Mon Sep 17 00:00:00 2001 From: Pavel Kartavyy Date: Thu, 15 May 2014 15:26:16 +0400 Subject: [PATCH 4/5] improved revision detection --- libs/libcommon/src/create_revision.sh.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libcommon/src/create_revision.sh.cmake b/libs/libcommon/src/create_revision.sh.cmake index 0c20047d556..f1ad2883d8a 100644 --- a/libs/libcommon/src/create_revision.sh.cmake +++ b/libs/libcommon/src/create_revision.sh.cmake @@ -9,7 +9,7 @@ if (git rev-parse --is-inside-work-tree &> /dev/null) then # GIT git fetch --tags; - ( git describe --tags || echo 1 ) | cut -d "-" -f 1 >> ${CMAKE_CURRENT_BINARY_DIR}/src/revision.h; + ( git tag || echo 1 ) | tail -1 >> ${CMAKE_CURRENT_BINARY_DIR}/src/revision.h; else #SVN echo && (LC_ALL=C svn info ${PROJECT_SOURCE_DIR}/ 2>/dev/null || echo Revision 1) | grep Revision | cut -d " " -f 2 >> ${CMAKE_CURRENT_BINARY_DIR}/src/revision.h; From aae61e105b1e1052752efbf11a4e8c2c449c116c Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 15 May 2014 15:57:52 +0400 Subject: [PATCH 5/5] client: not allowing unknown options in client [METR-11064] --- dbms/src/Client/Client.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dbms/src/Client/Client.cpp b/dbms/src/Client/Client.cpp index f724a2faabf..02ba7a4cc7e 100644 --- a/dbms/src/Client/Client.cpp +++ b/dbms/src/Client/Client.cpp @@ -958,12 +958,21 @@ public: size_t cnt = positions.size(); + if (cnt == 2 && newargc > 1) + { + Exception e("Unknown option " + to_pass_further[0] + ". Maybe missed --external flag in front of it.", ErrorCodes::BAD_ARGUMENTS); + std::string text = e.displayText(); + std::cerr << "Code: " << e.code() << ". " << text << std::endl; + exit(e.code()); + } + size_t stdin_count = 0; for (size_t i = 1; i + 1 < cnt; ++i) { + /// Парсим основные опции командной строки + boost::program_options::parsed_options parsed = boost::program_options::command_line_parser(positions[i + 1] - positions[i], &new_argv[positions[i]]).options(external_description).run(); boost::program_options::variables_map external_options; - boost::program_options::store(boost::program_options::parse_command_line( - positions[i + 1] - positions[i], &new_argv[positions[i]], external_description), external_options); + boost::program_options::store(parsed, external_options); try {