Skip to content

Commit a309b98

Browse files
authored
Merge branch 'main' into feat/zstd-level-config
2 parents 07a9926 + 4a5759e commit a309b98

8 files changed

Lines changed: 184 additions & 27 deletions

File tree

LICENSE

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,78 @@ Home page: https://roaringbitmap.org/
373373
License: https://www.apache.org/licenses/LICENSE-2.0
374374

375375
--------------------------------------------------------------------------------
376+
377+
This product includes code from boost.
378+
379+
* Boost source code in third_party/boost/ directory
380+
381+
Copyright: 2003-2023 The Boost Authors
382+
Home page: https://www.boost.org/
383+
License: https://www.boost.org/LICENSE_1_0.txt
384+
385+
Boost Software License - Version 1.0 - August 17th, 2003
386+
387+
Permission is hereby granted, free of charge, to any person or organization
388+
obtaining a copy of the software and accompanying documentation covered by
389+
this license (the "Software") to use, reproduce, display, distribute,
390+
execute, and transmit the Software, and to prepare derivative works of the
391+
Software, and to permit third-parties to whom the Software is furnished to
392+
do so, all subject to the following:
393+
394+
The copyright notices in the Software and this entire statement, including
395+
the above license grant, this restriction and the following disclaimer,
396+
must be included in all copies of the Software, in whole or in part, and
397+
all derivative works of the Software, unless such copies or derivative
398+
works are solely in the form of machine-executable object code generated by
399+
a source language processor.
400+
401+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
402+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
403+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
404+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
405+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
406+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
407+
DEALINGS IN THE SOFTWARE.
408+
409+
--------------------------------------------------------------------------------
410+
411+
This product includes code from LucenePlusPlus.
412+
413+
* LucenePlusPlus utility in src/paimon/global_index/lucene/ directory
414+
415+
Copyright: 2009-2014 Alan Wright.
416+
Home page: https://github.com/luceneplusplus/LucenePlusPlus
417+
License: https://www.apache.org/licenses/LICENSE-2.0
418+
419+
--------------------------------------------------------------------------------
420+
421+
This product includes code from cppjieba.
422+
423+
* cppjieba utility in src/paimon/global_index/lucene/ directory
424+
425+
Copyright: 2013
426+
Home page: https://github.com/yanyiwu/cppjieba
427+
License: https://opensource.org/licenses/MIT
428+
429+
The MIT License (MIT)
430+
431+
Copyright (c) 2013
432+
433+
Permission is hereby granted, free of charge, to any person obtaining a copy of
434+
this software and associated documentation files (the "Software"), to deal in
435+
the Software without restriction, including without limitation the rights to
436+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
437+
the Software, and to permit persons to whom the Software is furnished to do so,
438+
subject to the following conditions:
439+
440+
The above copyright notice and this permission notice shall be included in all
441+
copies or substantial portions of the Software.
442+
443+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
444+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
445+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
446+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
447+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
448+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
449+
450+
--------------------------------------------------------------------------------

NOTICE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,12 @@ Copyright (C) 2012-2023 Yann Collet
2828

2929
This product includes software from CRoaring project (Apache 2.0)
3030
Copyright 2016-2022 The CRoaring authors
31+
32+
This product includes software from boost project (BSL 1.0)
33+
Copyright 2003-2023 The Boost authors
34+
35+
This product includes software from LucenePlusPlus project (Apache 2.0)
36+
Copyright 2009-2014 Alan Wright.
37+
38+
This product includes software from cppjieba project (MIT)
39+
Copyright 2013

cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,30 @@ else()
124124
endif()
125125
endif()
126126

127+
if(DEFINED ENV{PAIMON_LIMONP_URL})
128+
set(LIMONP_SOURCE_URL "$ENV{PAIMON_LIMONP_URL}")
129+
else()
130+
if(EXISTS "${THIRDPARTY_DIR}/${PAIMON_LIMONP_PKG_NAME}")
131+
set_urls(LIMONP_SOURCE_URL "${THIRDPARTY_DIR}/${PAIMON_LIMONP_PKG_NAME}")
132+
else()
133+
set_urls(LIMONP_SOURCE_URL
134+
"${THIRDPARTY_MIRROR_URL}https://github.com/yanyiwu/limonp/archive/refs/tags/${PAIMON_LIMONP_PKG_NAME}"
135+
)
136+
endif()
137+
endif()
138+
139+
if(DEFINED ENV{PAIMON_JIEBA_URL})
140+
set(JIEBA_SOURCE_URL "$ENV{PAIMON_JIEBA_URL}")
141+
else()
142+
if(EXISTS "${THIRDPARTY_DIR}/${PAIMON_JIEBA_PKG_NAME}")
143+
set_urls(JIEBA_SOURCE_URL "${THIRDPARTY_DIR}/${PAIMON_JIEBA_PKG_NAME}")
144+
else()
145+
set_urls(JIEBA_SOURCE_URL
146+
"${THIRDPARTY_MIRROR_URL}https://github.com/yanyiwu/cppjieba/archive/refs/tags/${PAIMON_JIEBA_PKG_NAME}"
147+
)
148+
endif()
149+
endif()
150+
127151
if(DEFINED ENV{PAIMON_GLOG_URL})
128152
set(GLOG_SOURCE_URL "$ENV{PAIMON_GLOG_URL}")
129153
else()
@@ -289,6 +313,10 @@ set(EP_COMMON_CMAKE_ARGS
289313

290314
macro(build_lucene)
291315
message(STATUS "Building lucene from source")
316+
317+
get_target_property(LUCENE_ZLIB_INCLUDE_DIR zlib INTERFACE_INCLUDE_DIRECTORIES)
318+
get_filename_component(LUCENE_ZLIB_ROOT "${LUCENE_ZLIB_INCLUDE_DIR}" DIRECTORY)
319+
292320
set(LUCENE_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/lucene_ep-install")
293321
set(LUCENE_CMAKE_ARGS
294322
${EP_COMMON_CMAKE_ARGS}
@@ -302,6 +330,9 @@ macro(build_lucene)
302330
"-DBOOST_ROOT=${BOOST_INSTALL}"
303331
"-DBoost_CHRONO_FOUND=TRUE"
304332
"-DBoost_THREAD_FOUND=TRUE"
333+
"-DZLIB_INCLUDE_DIRS=${ZLIB_INCLUDE_DIR}"
334+
"-DZLIB_LIBRARY_RELEASE=${ZLIB_LIBRARIES}"
335+
"-DZLIB_ROOT=${LUCENE_ZLIB_ROOT}"
305336
"-DCMAKE_INSTALL_PREFIX=${LUCENE_PREFIX}")
306337

307338
set(LUCENE_LIB "${LUCENE_PREFIX}/lib/liblucene++.a")
@@ -311,7 +342,8 @@ macro(build_lucene)
311342
URL_HASH "SHA256=${PAIMON_LUCENE_BUILD_SHA256_CHECKSUM}"
312343
CMAKE_ARGS ${LUCENE_CMAKE_ARGS}
313344
BUILD_BYPRODUCTS ${LUCENE_LIB}
314-
DEPENDS boost_date_time
345+
DEPENDS zlib
346+
boost_date_time
315347
boost_filesystem
316348
boost_regex
317349
boost_thread
@@ -331,7 +363,8 @@ macro(build_lucene)
331363
"${LUCENE_INCLUDE_DIR}")
332364

333365
target_link_libraries(lucene
334-
INTERFACE boost_date_time
366+
INTERFACE zlib
367+
boost_date_time
335368
boost_filesystem
336369
boost_regex
337370
boost_thread
@@ -345,6 +378,13 @@ macro(build_lucene)
345378
endmacro()
346379

347380
macro(build_jieba)
381+
message(STATUS "Building limonp from source")
382+
set(LIMONP_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/limonp_ep-prefix")
383+
externalproject_add(limonp_ep
384+
URL ${LIMONP_SOURCE_URL}
385+
URL_HASH "SHA256=${PAIMON_LIMONP_BUILD_SHA256_CHECKSUM}"
386+
INSTALL_COMMAND "")
387+
348388
message(STATUS "Building jieba from source")
349389
set(JIEBA_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/jieba_ep-prefix")
350390
set(JIEBA_INSTALL "${CMAKE_CURRENT_BINARY_DIR}/jieba_ep-install")
@@ -360,24 +400,22 @@ macro(build_jieba)
360400
set(PATCH_FILE "${CMAKE_CURRENT_LIST_DIR}/jieba.diff")
361401
externalproject_add(jieba_ep
362402
${EP_COMMON_OPTIONS}
363-
GIT_REPOSITORY https://github.com/yanyiwu/cppjieba.git
364-
GIT_TAG ${PAIMON_JIEBA_BUILD_VERSION}
365-
GIT_SHALLOW FALSE
366-
GIT_PROGRESS TRUE
367-
GIT_SUBMODULES_RECURSE TRUE
403+
URL ${JIEBA_SOURCE_URL}
404+
URL_HASH "SHA256=${PAIMON_JIEBA_BUILD_SHA256_CHECKSUM}"
368405
CMAKE_ARGS ${JIEBA_CMAKE_ARGS}
369406
LOG_PATCH ON
370407
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> bash -c
371408
"[ -f .patched ] && echo '<SOURCE_DIR> patch already applied, ignore...' || patch -s -N -p1 -i '${PATCH_FILE}' && touch .patched"
372409
INSTALL_COMMAND bash -c
373-
"cp -r ${JIEBA_PREFIX}/src/jieba_ep/include/* ${JIEBA_INSTALL}/include/ && cp -r ${JIEBA_PREFIX}/src/jieba_ep/dict/* ${JIEBA_INSTALL}/dict/ && cp -r ${JIEBA_PREFIX}/src/jieba_ep/deps/limonp/include/* ${JIEBA_INSTALL}/include/"
410+
"cp -r ${JIEBA_PREFIX}/src/jieba_ep/include/* ${JIEBA_INSTALL}/include/ && cp -r ${JIEBA_PREFIX}/src/jieba_ep/dict/* ${JIEBA_INSTALL}/dict/ && cp -r ${LIMONP_PREFIX}/src/limonp_ep/include/* ${JIEBA_INSTALL}/include/"
374411
)
375412

376413
# The include directory must exist before it is referenced by a target.
377414
include_directories(SYSTEM ${JIEBA_INCLUDE_DIR} ${JIEBA_DICT_DIR})
378415
add_library(jieba INTERFACE IMPORTED)
379416
target_include_directories(jieba SYSTEM
380417
INTERFACE "${JIEBA_INCLUDE_DIR} ${JIEBA_DICT_DIR}")
418+
add_dependencies(jieba_ep limonp_ep)
381419
add_dependencies(jieba jieba_ep)
382420
endmacro()
383421

@@ -468,11 +506,8 @@ macro(build_boost)
468506
${BOOST_LIBRARY_DIR}/libboost_iostreams.a)
469507

470508
externalproject_add(boost_ep
471-
GIT_REPOSITORY https://github.com/boostorg/boost.git
472-
GIT_TAG boost-${PAIMON_BOOST_BUILD_VERSION}
473-
GIT_SHALLOW FALSE
474-
GIT_PROGRESS TRUE
475-
GIT_SUBMODULES_RECURSE TRUE
509+
URL "${THIRDPARTY_DIR}/boost/${PAIMON_BOOST_PKG_NAME}"
510+
URL_HASH "SHA256=${PAIMON_BOOST_BUILD_SHA256_CHECKSUM}"
476511
CONFIGURE_COMMAND ${BOOST_PREFIX}/src/boost_ep/bootstrap.sh
477512
--with-libraries=date_time,filesystem,iostreams,regex,system,thread,chrono,atomic
478513
BUILD_IN_SOURCE TRUE

docs/source/user_guide/data_types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ and `Arrow DataTypes <https://arrow.apache.org/docs/format/Columnar.html#data-ty
6363
* - ``BINARY``
6464

6565
``BINARY(n)``
66-
- Binary
66+
- Not Supported
6767
- Data type of a fixed-length binary string (=a sequence of bytes).
6868

6969
The type can be declared using ``BINARY(n)`` where n is the number of

src/paimon/core/core_options.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class ConfigParser {
150150
Status ParseSortOrder(SortOrder* sort_order) const {
151151
auto iter = config_map_.find(Options::SEQUENCE_FIELD_SORT_ORDER);
152152
if (iter != config_map_.end()) {
153-
const auto& str = iter->second;
153+
std::string str = StringUtils::ToLowerCase(iter->second);
154154
if (str == "ascending") {
155155
*sort_order = SortOrder::ASCENDING;
156156
} else if (str == "descending") {
@@ -166,7 +166,7 @@ class ConfigParser {
166166
Status ParseSortEngine(SortEngine* sort_engine) const {
167167
auto iter = config_map_.find(Options::SORT_ENGINE);
168168
if (iter != config_map_.end()) {
169-
const auto& str = iter->second;
169+
std::string str = StringUtils::ToLowerCase(iter->second);
170170
if (str == "min-heap") {
171171
*sort_engine = SortEngine::MIN_HEAP;
172172
} else if (str == "loser-tree") {
@@ -182,7 +182,7 @@ class ConfigParser {
182182
Status ParseMergeEngine(MergeEngine* merge_engine) const {
183183
auto iter = config_map_.find(Options::MERGE_ENGINE);
184184
if (iter != config_map_.end()) {
185-
const auto& str = iter->second;
185+
std::string str = StringUtils::ToLowerCase(iter->second);
186186
if (str == "deduplicate") {
187187
*merge_engine = MergeEngine::DEDUPLICATE;
188188
} else if (str == "partial-update") {
@@ -202,7 +202,7 @@ class ConfigParser {
202202
Status ParseChangelogProducer(ChangelogProducer* changelog_producer) const {
203203
auto iter = config_map_.find(Options::CHANGELOG_PRODUCER);
204204
if (iter != config_map_.end()) {
205-
const auto& str = iter->second;
205+
std::string str = StringUtils::ToLowerCase(iter->second);
206206
if (str == "none") {
207207
*changelog_producer = ChangelogProducer::NONE;
208208
} else if (str == "input") {
@@ -222,7 +222,7 @@ class ConfigParser {
222222
Status ParseExternalPathStrategy(ExternalPathStrategy* external_path_strategy) const {
223223
auto iter = config_map_.find(Options::DATA_FILE_EXTERNAL_PATHS_STRATEGY);
224224
if (iter != config_map_.end()) {
225-
const auto& str = iter->second;
225+
std::string str = StringUtils::ToLowerCase(iter->second);
226226
if (str == "none") {
227227
*external_path_strategy = ExternalPathStrategy::NONE;
228228
} else if (str == "specific-fs") {
@@ -236,6 +236,16 @@ class ConfigParser {
236236
return Status::OK();
237237
}
238238

239+
// Parse StartupMode
240+
Status ParseStartupMode(StartupMode* startup_mode) const {
241+
auto iter = config_map_.find(Options::SCAN_MODE);
242+
if (iter != config_map_.end()) {
243+
std::string str = StringUtils::ToLowerCase(iter->second);
244+
PAIMON_ASSIGN_OR_RAISE(*startup_mode, StartupMode::FromString(str));
245+
}
246+
return Status::OK();
247+
}
248+
239249
private:
240250
const std::map<std::string, std::string> config_map_;
241251
};
@@ -361,12 +371,7 @@ Result<CoreOptions> CoreOptions::FromMap(
361371
&impl->file_system));
362372

363373
// Parse startup mode
364-
std::string startup_mode_str;
365-
if (options_map.find(Options::SCAN_MODE) != options_map.end()) {
366-
PAIMON_RETURN_NOT_OK(parser.ParseString(Options::SCAN_MODE, &startup_mode_str));
367-
PAIMON_ASSIGN_OR_RAISE(auto startup_mode, StartupMode::FromString(startup_mode_str));
368-
impl->startup_mode = startup_mode;
369-
}
374+
PAIMON_RETURN_NOT_OK(parser.ParseStartupMode(&impl->startup_mode));
370375

371376
// Special handling for ExpireConfig
372377
int32_t snapshot_num_retain_min = 10;

src/paimon/core/core_options_test.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,4 +336,23 @@ TEST(CoreOptionsTest, TestFileSystem) {
336336
typed_fs->GetRealFileSystem("oss:///tmp/").value_or(nullptr)));
337337
}
338338
}
339+
340+
TEST(CoreOptionsTest, TestNormalizeValueInCoreOption) {
341+
std::map<std::string, std::string> options = {
342+
{Options::SEQUENCE_FIELD_SORT_ORDER, "ASCENDING"},
343+
{Options::SORT_ENGINE, "MIN-heap"},
344+
{Options::MERGE_ENGINE, "first-ROW"},
345+
{Options::CHANGELOG_PRODUCER, "LOOKUP"},
346+
{Options::DATA_FILE_EXTERNAL_PATHS_STRATEGY, "ROUND-ROBIN"},
347+
{Options::SCAN_MODE, "DEFAULT"},
348+
};
349+
ASSERT_OK_AND_ASSIGN(CoreOptions core_options, CoreOptions::FromMap(options));
350+
351+
ASSERT_EQ(StartupMode::LatestFull(), core_options.GetStartupMode());
352+
ASSERT_EQ(ExternalPathStrategy::ROUND_ROBIN, core_options.GetExternalPathStrategy());
353+
ASSERT_EQ(ChangelogProducer::LOOKUP, core_options.GetChangelogProducer());
354+
ASSERT_EQ(MergeEngine::FIRST_ROW, core_options.GetMergeEngine());
355+
ASSERT_EQ(SortEngine::MIN_HEAP, core_options.GetSortEngine());
356+
ASSERT_TRUE(core_options.SequenceFieldSortOrderIsAscending());
357+
}
339358
} // namespace paimon::test
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:28e9200637800fbfd1292b2c6876189dba7e8e1c5282c71fac6515e96f7af2b0
3+
size 88165095

third_party/versions.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,21 @@ PAIMON_JINDOSDK_C_BUILD_VERSION=6.10.2
7171
PAIMON_JINDOSDK_C_BUILD_SHA256_CHECKSUM=23e61c9815fab1cd88c369445bdbe1eab02cc09bafed3bb5118ecaf5b2fbc518
7272
PAIMON_JINDOSDK_C_PKG_NAME=jindosdk-${PAIMON_JINDOSDK_C_BUILD_VERSION}.tar.gz
7373

74-
PAIMON_BOOST_BUILD_VERSION=1.66.0
75-
7674
PAIMON_LUCENE_BUILD_VERSION=3.0.9
7775
PAIMON_LUCENE_BUILD_SHA256_CHECKSUM=4e69e29d5d79a976498ef71eab70c9c88c7014708be4450a9fda7780fe93584e
7876
PAIMON_LUCENE_PKG_NAME=rel_${PAIMON_LUCENE_BUILD_VERSION}.tar.gz
7977

78+
PAIMON_LIMONP_BUILD_VERSION=1.0.1
79+
PAIMON_LIMONP_BUILD_SHA256_CHECKSUM=c7b18794f020dbaa1006229b49a39217a463da0cb3586aee83eb7471f4ae71df
80+
PAIMON_LIMONP_PKG_NAME=v${PAIMON_LIMONP_BUILD_VERSION}.tar.gz
81+
8082
PAIMON_JIEBA_BUILD_VERSION=v5.6.0
83+
PAIMON_JIEBA_BUILD_SHA256_CHECKSUM=e6e517b778e0f4a99cbed1ee3eaa041616b74bc685e03a6ca08887ad9cedfe49
84+
PAIMON_JIEBA_PKG_NAME=${PAIMON_JIEBA_BUILD_VERSION}.tar.gz
85+
86+
PAIMON_BOOST_BUILD_VERSION=1_66_0
87+
PAIMON_BOOST_BUILD_SHA256_CHECKSUM=28e9200637800fbfd1292b2c6876189dba7e8e1c5282c71fac6515e96f7af2b0
88+
PAIMON_BOOST_PKG_NAME=boost_${PAIMON_BOOST_BUILD_VERSION}.tar.gz
8189

8290
# The first field is the name of the environment variable expected by cmake.
8391
# This _must_ match what is defined. The second field is the name of the
@@ -99,4 +107,7 @@ DEPENDENCIES=(
99107
"PAIMON_RAPIDJSON_URL ${PAIMON_RAPIDJSON_PKG_NAME} ${THIRDPARTY_MIRROR_URL}https://github.com/miloyip/rapidjson/archive/${PAIMON_RAPIDJSON_BUILD_VERSION}.tar.gz"
100108
"PAIMON_JINDOSDK_C_URL ${PAIMON_JINDOSDK_C_PKG_NAME} https://jindodata-binary.oss-cn-shanghai.aliyuncs.com/release/${PAIMON_JINDOSDK_C_BUILD_VERSION}/jindosdk-${PAIMON_JINDOSDK_C_BUILD_VERSION}-linux.tar.gz"
101109
"PAIMON_LUCENE_URL ${PAIMON_LUCENE_PKG_NAME} ${THIRDPARTY_MIRROR_URL}https://github.com/luceneplusplus/LucenePlusPlus/archive/refs/tags/${PAIMON_LUCENE_PKG_NAME}"
110+
"PAIMON_LIMONP_URL ${PAIMON_LIMONP_PKG_NAME} ${THIRDPARTY_MIRROR_URL}https://github.com/yanyiwu/limonp/archive/refs/tags/${PAIMON_LIMONP_PKG_NAME}"
111+
"PAIMON_JIEBA_URL ${PAIMON_JIEBA_PKG_NAME} ${THIRDPARTY_MIRROR_URL}https://github.com/yanyiwu/cppjieba/archive/refs/tags/${PAIMON_JIEBA_PKG_NAME}"
112+
"PAIMON_BOOST_URL ${PAIMON_BOOST_PKG_NAME} ${THIRDPARTY_DIR}/boost/${PAIMON_BOOST_PKG_NAME}"
102113
)

0 commit comments

Comments
 (0)