From f77216b3def6afe68e8c5127c8bd12d743a30302 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 22 Sep 2012 07:30:40 +0000 Subject: [PATCH] Merge --- dbms/include/DB/Functions/FunctionsStringArray.h | 3 ++- dbms/src/Storages/StorageMergeTree.cpp | 16 ++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dbms/include/DB/Functions/FunctionsStringArray.h b/dbms/include/DB/Functions/FunctionsStringArray.h index f2606c04f0b..a20ef1e1ce3 100644 --- a/dbms/include/DB/Functions/FunctionsStringArray.h +++ b/dbms/include/DB/Functions/FunctionsStringArray.h @@ -16,7 +16,8 @@ namespace DB * split(sep, s) * join(sep, arr) * join(arr) - * alphaTokens(s) - выделить из строки подпоследовательности [a-zA-Z]+. + * alphaTokens(s) - выделить из строки подпоследовательности [a-zA-Z]+. + * extractAll(regexp, s) - выделить из строки подпоследовательности, соответствующие регекспу. * * Функции работы с URL расположены отдельно. */ diff --git a/dbms/src/Storages/StorageMergeTree.cpp b/dbms/src/Storages/StorageMergeTree.cpp index eef00f4a87d..a01243db37d 100644 --- a/dbms/src/Storages/StorageMergeTree.cpp +++ b/dbms/src/Storages/StorageMergeTree.cpp @@ -236,10 +236,8 @@ private: type_arr->serializeOffsets(column, compressed, boost::bind(&MergeTreeBlockOutputStream::writeCallback, this, boost::ref(prev_mark), boost::ref(plain), boost::ref(compressed), boost::ref(marks))); - - writeData(path, name, *type_arr->getNestedType(), dynamic_cast(column).getData(), level + 1); } - else + { WriteBufferFromFile plain(path + escaped_column_name + ".bin", DBMS_DEFAULT_BUFFER_SIZE, flags); WriteBufferFromFile marks(path + escaped_column_name + ".mrk", 4096, flags); @@ -402,10 +400,8 @@ private: type_arr->serializeOffsets(column, stream.compressed, boost::bind(&MergedBlockOutputStream::writeCallback, this, boost::ref(prev_mark), boost::ref(stream.plain), boost::ref(stream.compressed), boost::ref(stream.marks))); - - writeData(name, *type_arr->getNestedType(), dynamic_cast(column).getData(), level + 1); } - else + { ColumnStream & stream = *column_streams[name]; @@ -550,8 +546,8 @@ public: { /// Читаем PK, и на основе primary_prefix, primary_range определим mark_number и rows_limit. - size_t min_mark_number = 0; - size_t max_mark_number = 0; + ssize_t min_mark_number = -1; + ssize_t max_mark_number = -1; String index_path = path + "primary.idx"; ReadBufferFromFile index(index_path, std::min(static_cast(DBMS_DEFAULT_BUFFER_SIZE), Poco::File(index_path).getSize())); @@ -591,8 +587,8 @@ public: } } - mark_number = min_mark_number; - rows_limit = (max_mark_number - min_mark_number + 1) * storage.index_granularity; + mark_number = min_mark_number == -1 ? 0 : min_mark_number; + rows_limit = max_mark_number == -1 ? std::numeric_limits::max() : ((max_mark_number - min_mark_number + 1) * storage.index_granularity); std::cerr << mark_number << ", " << rows_limit << std::endl; }