Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-1632][CH]Daily Update Clickhouse Version (20240225) #4769

Merged
merged 7 commits into from
Feb 25, 2024
2 changes: 1 addition & 1 deletion cpp-ch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ add_custom_command(
-DENABLE_CLICKHOUSE_ALL=OFF
-DCOMPILER_FLAGS='-fvisibility=hidden -fvisibility-inlines-hidden'
-S ${CH_SOURCE_DIR} -G Ninja -B ${CH_BINARY_DIR} &&
cmake --build ${CH_BINARY_DIR} --target ch\"
cmake --build ${CH_BINARY_DIR} --target libch\"
OUTPUT _build_ch)
endif()

Expand Down
4 changes: 2 additions & 2 deletions cpp-ch/clickhouse.version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CH_ORG=Kyligence
CH_BRANCH=rebase_ch/20240208
CH_COMMIT=eccb1fb6b4b
CH_BRANCH=rebase_ch/20240225
CH_COMMIT=0c480a024a5
17 changes: 15 additions & 2 deletions cpp-ch/local-engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ include(UseJava)
include(FindJNI)

#set(JNI_NATIVE_SOURCES local_engine_jni.cpp)
set(LOCALENGINE_SHARED_LIB ch)
set (ENABLE_CURL_BUILD OFF)
set(LOCALENGINE_SHARED_LIB _gluten_ch)

add_subdirectory(proto)

Expand Down Expand Up @@ -149,6 +148,20 @@ else()
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libch-hide-jemalloc.map)
endif()

if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
set(LOCALENGINE_SHARED_LIB_NAME "libchd.so")
else ()
set(LOCALENGINE_SHARED_LIB_NAME "libch.so")
endif ()

add_custom_command(
OUTPUT ${LOCALENGINE_SHARED_LIB_NAME}
COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:${LOCALENGINE_SHARED_LIB}> ${LOCALENGINE_SHARED_LIB_NAME}
COMMENT "Renaming $<TARGET_FILE:${LOCALENGINE_SHARED_LIB}> to ${LOCALENGINE_SHARED_LIB_NAME}"
DEPENDS ${LOCALENGINE_SHARED_LIB})

add_custom_target(libch ALL DEPENDS ${LOCALENGINE_SHARED_LIB_NAME})

add_subdirectory(tests)

if (ENABLE_EXAMPLES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <Common/CHUtil.h>
#include <Core/Field.h>
#include <DataTypes/IDataType.h>
#include <DataTypes/DataTypeArray.h>

namespace DB
{
Expand Down Expand Up @@ -45,9 +46,22 @@ class BaseFunctionParserArrayMaxAndMin : public FunctionParser
if (parsed_args.size() != 1)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Function {} requires exactly one arguments", getName());

const auto * max_const_node = addColumnToActionsDAG(actions_dag, std::make_shared<DataTypeString>(), getCHFunctionName(substrait_func));
const auto * array_reduce_node = toFunctionNode(actions_dag, "arrayReduce", {max_const_node, parsed_args[0]});
return convertNodeTypeIfNeeded(substrait_func, array_reduce_node, actions_dag);
const auto * arr_arg = parsed_args[0];
const auto * func_const_node = addColumnToActionsDAG(actions_dag, std::make_shared<DataTypeString>(), getCHFunctionName(substrait_func));

auto is_arr_nullable = arr_arg->result_type->isNullable();
if (!is_arr_nullable)
{
const auto * array_reduce_node = toFunctionNode(actions_dag, "arrayReduce", {func_const_node, arr_arg});
return convertNodeTypeIfNeeded(substrait_func, array_reduce_node, actions_dag);
}

const auto * arr_is_null_node = toFunctionNode(actions_dag, "isNull", {arr_arg});
const auto * arr_not_null_node = toFunctionNode(actions_dag, "assumeNotNull", {arr_arg});
const auto * array_reduce_node = toFunctionNode(actions_dag, "arrayReduce", {func_const_node, arr_not_null_node});
const auto * null_const_node = addColumnToActionsDAG(actions_dag, makeNullable(array_reduce_node->result_type), Field{});
const auto * if_node = toFunctionNode(actions_dag, "if", {arr_is_null_node, null_const_node, array_reduce_node});
return convertNodeTypeIfNeeded(substrait_func, if_node, actions_dag);
}
};

Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Storages/CustomStorageMergeTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CustomStorageMergeTree::CustomStorageMergeTree(
merging_params_,
std::move(storage_settings_),
false, /// require_part_metadata
attach)
attach ? LoadingStrictnessLevel::ATTACH : LoadingStrictnessLevel::FORCE_RESTORE)
, writer(*this)
, reader(*this)
{
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Storages/CustomStorageMergeTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CustomStorageMergeTree final : public MergeTreeData
void replacePartitionFrom(const StoragePtr & source_table, const ASTPtr & partition, bool replace, ContextPtr context) override;
void movePartitionToTable(const StoragePtr & dest_table, const ASTPtr & partition, ContextPtr context) override;
bool partIsAssignedToBackgroundOperation(const DataPartPtr & part) const override;
std::map<int64_t, MutationCommands> getAlterMutationCommandsForPart(const DataPartPtr & /*part*/) const override { return {}; }
MutationCommands getAlterMutationCommandsForPart(const DataPartPtr & /*part*/) const override { return {}; }
void attachRestoredParts(MutableDataPartsVector && /*parts*/) override { throw std::runtime_error("not implement"); }
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,7 @@ class LocalFileReadBufferBuilder : public ReadBufferBuilder

if (set_read_util_position)
{
auto * work_around = read_buffer.get();
read_buffer = std::make_unique<DB::BoundedReadBuffer>(std::move(read_buffer));
// workaround for https://github.com/ClickHouse/ClickHouse/pull/58886
// ReadBufferFromFileDecorator construtor will call swap, without wrap, BoundedReadBuffer can't work.
read_buffer->swap(*work_around);

auto start_end_pos = adjustFileReadPosition(*read_buffer, file_info.start(), file_info.start() + file_info.length());
LOG_DEBUG(
&Poco::Logger::get("ReadBufferBuilder"),
Expand Down
Loading