Skip to content

Commit

Permalink
[GLUTEN-1632][CH]Daily Update Clickhouse Version (20240114) (#4393)
Browse files Browse the repository at this point in the history
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240114)

* fix build due to ClickHouse/ClickHouse#58772

* fix build due to ClickHouse/ClickHouse#58519

---------

Co-authored-by: kyligence-git <gluten@kyligence.io>
Co-authored-by: Chang Chen <baibaichen@gmail.com>
  • Loading branch information
3 people committed Jan 14, 2024
1 parent 5189633 commit 00db209
Show file tree
Hide file tree
Showing 30 changed files with 91 additions and 81 deletions.
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/20240112
CH_COMMIT=632a6831f2e
CH_BRANCH=rebase_ch/20240114
CH_COMMIT=234ed8632df
6 changes: 3 additions & 3 deletions cpp-ch/local-engine/Functions/SparkFunctionCastFloatToInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SparkFunctionCastFloatToInt : public DB::IFunction
static DB::FunctionPtr create(DB::ContextPtr) { return std::make_shared<SparkFunctionCastFloatToInt>(); }
SparkFunctionCastFloatToInt() = default;
~SparkFunctionCastFloatToInt() override = default;
DB::String getName() const override { return name; }
String getName() const override { return name; }
bool useDefaultImplementationForConstants() const override { return true; }
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return true; }

Expand Down Expand Up @@ -81,12 +81,12 @@ class SparkFunctionCastFloatToInt : public DB::IFunction
{
case DB::TypeIndex::Float32:
{
executeInternal<DB::Float32>(src_col, res_col->getData(), null_map_col->getData());
executeInternal<Float32>(src_col, res_col->getData(), null_map_col->getData());
break;
}
case DB::TypeIndex::Float64:
{
executeInternal<DB::Float64>(src_col, res_col->getData(), null_map_col->getData());
executeInternal<Float64>(src_col, res_col->getData(), null_map_col->getData());
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static char * ll2str(int64_t val, char * dst, int radix, bool upcase)
DB::ColumnPtr SparkFunctionConv::executeImpl(
const DB::ColumnsWithTypeAndName & arguments, const DB::DataTypePtr & result_type, size_t input_rows_count) const
{
using longlong = DB::Int64;
using longlong = Int64;
auto from_base = static_cast<int>(arguments[1].column->getInt(0));
auto to_base = static_cast<int>(arguments[2].column->getInt(0));

Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionConv.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SparkFunctionConv: public DB::IFunction
SparkFunctionConv() = default;
~SparkFunctionConv() override = default;

DB::String getName() const override { return name; }
String getName() const override { return name; }

size_t getNumberOfArguments() const override { return 3; }
bool isVariadic() const override { return true; }
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionFloor.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class SparkFunctionFloor : public DB::FunctionFloor
static DB::FunctionPtr create(DB::ContextPtr) { return std::make_shared<SparkFunctionFloor>(); }
SparkFunctionFloor() = default;
~SparkFunctionFloor() override = default;
DB::String getName() const override { return name; }
String getName() const override { return name; }

DB::DataTypePtr getReturnTypeImpl(const DB::DataTypes & arguments) const override
{
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionGetJsonObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class FlattenJSONStringOnRequiredFunction : public DB::IFunction
static DB::FunctionPtr create(const DB::ContextPtr & context) { return std::make_shared<FlattenJSONStringOnRequiredFunction>(context); }
explicit FlattenJSONStringOnRequiredFunction(DB::ContextPtr context_) : context(context_) { }
~FlattenJSONStringOnRequiredFunction() override = default;
DB::String getName() const override { return name; }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 2; }
bool isVariadic() const override { return false; }
bool isSuitableForShortCircuitArgumentsExecution(const DB::DataTypesWithConstInfo & /*arguments*/) const override { return false; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ DB::ColumnPtr SparkFunctionMonthsBetween::executeImpl(
static_cast<DateTime64>(x_value.safeGet<DateTime64>()),
static_cast<DateTime64>(y_value.safeGet<DateTime64>()),
timezone,
static_cast<bool>(round_value.safeGet<DB::UInt8>())));
static_cast<bool>(round_value.safeGet<UInt8>())));
}
}
return res;
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionMonthsBetween.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SparkFunctionMonthsBetween: public DB::IFunction
SparkFunctionMonthsBetween() = default;
~SparkFunctionMonthsBetween() override = default;

DB::String getName() const override { return name; }
String getName() const override { return name; }

size_t getNumberOfArguments() const override { return 0; }
bool isVariadic() const override { return true; }
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionNextDay.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SparkFunctionNextDay : public DB::IFunction
SparkFunctionNextDay() = default;
~SparkFunctionNextDay() override = default;

DB::String getName() const override { return name; }
String getName() const override { return name; }

size_t getNumberOfArguments() const override { return 2; }
bool isVariadic() const override { return true; }
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionStrToMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SparkFunctionStrToMap : public DB::IFunction
static constexpr auto name = "spark_str_to_map";
static DB::FunctionPtr create(const DB::ContextPtr) { return std::make_shared<SparkFunctionStrToMap>(); }

DB::String getName() const override { return name; }
String getName() const override { return name; }

bool isVariadic() const override { return true; }
size_t getNumberOfArguments() const override { return 3; }
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Functions/SparkFunctionToDate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SparkFunctionConvertToDate : public DB::FunctionToDate32OrNull
static DB::FunctionPtr create(DB::ContextPtr) { return std::make_shared<SparkFunctionConvertToDate>(); }
SparkFunctionConvertToDate() = default;
~SparkFunctionConvertToDate() override = default;
DB::String getName() const override { return name; }
String getName() const override { return name; }

bool checkDateFormat(DB::ReadBuffer & buf) const
{
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Operator/BlocksBufferPoolTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BlocksBufferPoolTransform : public DB::IProcessor
Status prepare() override;
void work() override;

DB::String getName() const override { return "BlocksBufferPoolTransform"; }
String getName() const override { return "BlocksBufferPoolTransform"; }
private:
std::list<DB::Chunk> pending_chunks;
size_t buffer_size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class DefaultHashAggrgateResultTransform : public DB::IProcessor
return Status::NeedData;
}

DB::String getName() const override { return "DefaultHashAggrgateResultTransform"; }
String getName() const override { return "DefaultHashAggrgateResultTransform"; }
private:
DB::Block header;
bool has_input = false;
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Operator/ExpandTransorm.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ExpandTransform : public DB::IProcessor
Status prepare() override;
void work() override;

DB::String getName() const override { return "ExpandTransform"; }
String getName() const override { return "ExpandTransform"; }

private:
ExpandField project_set_exprs;
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Parser/AggregateFunctionParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AggregateFunctionParser
/// basic common function informations
using Arguments = google::protobuf::RepeatedPtrField<substrait::FunctionArgument>;
using SortFields = google::protobuf::RepeatedPtrField<substrait::SortField>;
DB::Int32 function_ref;
Int32 function_ref;
Arguments arguments;
substrait::Type output_type;

Expand Down
4 changes: 2 additions & 2 deletions cpp-ch/local-engine/Parser/RelParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace ErrorCodes
namespace local_engine
{
AggregateFunctionPtr RelParser::getAggregateFunction(
const DB::String & name, DB::DataTypes arg_types, DB::AggregateFunctionProperties & properties, const DB::Array & parameters)
const String & name, DB::DataTypes arg_types, DB::AggregateFunctionProperties & properties, const DB::Array & parameters)
{
auto & factory = AggregateFunctionFactory::instance();
auto action = NullsAction::EMPTY;
Expand Down Expand Up @@ -122,7 +122,7 @@ void RelParserFactory::registerBuilder(UInt32 k, RelParserBuilder builder)
builders[k] = builder;
}

RelParserFactory::RelParserBuilder RelParserFactory::getBuilder(DB::UInt32 k)
RelParserFactory::RelParserBuilder RelParserFactory::getBuilder(UInt32 k)
{
auto it = builders.find(k);
if (it == builders.end())
Expand Down
4 changes: 2 additions & 2 deletions cpp-ch/local-engine/Parser/RelParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RelParser
const std::vector<IQueryPlanStep *> & getSteps() const { return steps; }

static AggregateFunctionPtr getAggregateFunction(
const DB::String & name, DB::DataTypes arg_types, DB::AggregateFunctionProperties & properties, const DB::Array & parameters = {});
const String & name, DB::DataTypes arg_types, DB::AggregateFunctionProperties & properties, const DB::Array & parameters = {});

protected:
inline SerializedPlanParser * getPlanParser() { return plan_parser; }
Expand Down Expand Up @@ -99,7 +99,7 @@ class RelParserFactory
using RelParserBuilder = std::function<std::shared_ptr<RelParser>(SerializedPlanParser *)>;
static RelParserFactory & instance();
void registerBuilder(UInt32 k, RelParserBuilder builder);
RelParserBuilder getBuilder(DB::UInt32 k);
RelParserBuilder getBuilder(UInt32 k);

private:
std::map<UInt32, RelParserBuilder> builders;
Expand Down
4 changes: 2 additions & 2 deletions cpp-ch/local-engine/Parser/WindowRelParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ WindowRelParser::parseWindowDescription(const WindowInfo & win_info)
}

/// In CH, it put all functions into one window description if they have the same partition expressions and sort fields.
std::unordered_map<DB::String, WindowDescription> WindowRelParser::parseWindowDescriptions()
std::unordered_map<String, WindowDescription> WindowRelParser::parseWindowDescriptions()
{
std::unordered_map<DB::String, WindowDescription> window_descriptions;
std::unordered_map<String, WindowDescription> window_descriptions;
for (size_t i = 0; i < win_infos.size(); ++i)
{
auto & win_info = win_infos[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ LagParser::parseFunctionArguments(const CommonFunctionInfo & func_info, const St

// lag's offset is negative
auto literal_result = parseLiteral(arg1.literal());
assert(literal_result.second.safeGet<DB::Int32>() < 0);
auto real_field = 0 - literal_result.second.safeGet<DB::Int32>();
assert(literal_result.second.safeGet<Int32>() < 0);
auto real_field = 0 - literal_result.second.safeGet<Int32>();
node = &actions_dag->addColumn(ColumnWithTypeAndName(
literal_result.first->createColumnConst(1, real_field), literal_result.first, getUniqueName(toString(real_field))));
node = ActionsDAGUtil::convertNodeType(actions_dag, node, DB::DataTypeInt64().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FunctionParserLogBase : public FunctionParser
explicit FunctionParserLogBase(SerializedPlanParser * plan_parser_) : FunctionParser(plan_parser_) {}
~FunctionParserLogBase() override = default;

virtual DB::String getCHFunctionName() const { return "log"; }
virtual String getCHFunctionName() const { return "log"; }
virtual const DB::ActionsDAG::Node * getParameterLowerBound(ActionsDAGPtr &, const DataTypePtr &) const { return nullptr; }

const ActionsDAG::Node * parse(
Expand Down
18 changes: 9 additions & 9 deletions cpp-ch/local-engine/Shuffle/SelectorBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void RangeSelectorBuilder::initSortInformation(Poco::JSON::Array::Ptr orderings)
for (uint32_t i = 0; i < orderings->size(); ++i)
{
auto ordering = orderings->get(i).extract<Poco::JSON::Object::Ptr>();
auto col_pos = ordering->get("column_ref").convert<DB::Int32>();
auto col_pos = ordering->get("column_ref").convert<Int32>();
auto col_name = ordering->get("column_name").convert<String>();

auto sort_direction = ordering->get("direction").convert<int>();
Expand Down Expand Up @@ -252,39 +252,39 @@ void RangeSelectorBuilder::initRangeBlock(Poco::JSON::Array::Ptr range_bounds)
const auto & field_value = field_info->get("value");
if (type_name == "UInt8")
{
col->insert(static_cast<DB::UInt8>(field_value.convert<DB::Int16>()));
col->insert(static_cast<UInt8>(field_value.convert<Int16>()));
}
else if (type_name == "Int8")
{
col->insert(field_value.convert<DB::Int8>());
col->insert(field_value.convert<Int8>());
}
else if (type_name == "Int16")
{
col->insert(field_value.convert<DB::Int16>());
col->insert(field_value.convert<Int16>());
}
else if (type_name == "Int32")
{
col->insert(field_value.convert<DB::Int32>());
col->insert(field_value.convert<Int32>());
}
else if (type_name == "Int64")
{
col->insert(field_value.convert<DB::Int64>());
col->insert(field_value.convert<Int64>());
}
else if (type_name == "Float32")
{
safeInsertFloatValue<DB::Float32>(field_value, col);
safeInsertFloatValue<Float32>(field_value, col);
}
else if (type_name == "Float64")
{
safeInsertFloatValue<DB::Float64>(field_value, col);
safeInsertFloatValue<Float64>(field_value, col);
}
else if (type_name == "String")
{
col->insert(field_value.convert<std::string>());
}
else if (type_name == "Date32")
{
int val = field_value.convert<DB::Int32>();
int val = field_value.convert<Int32>();
col->insert(val);
}
else if (const auto * decimal32 = dynamic_cast<const DB::DataTypeDecimal<DB::Decimal32> *>(type_info.inner_type.get()))
Expand Down
40 changes: 20 additions & 20 deletions cpp-ch/local-engine/Storages/Serializations/ExcelSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,45 +49,45 @@ void ExcelSerialization::deserializeTextCSV(IColumn & column, ReadBuffer & istr,
deserializeDatetimeTextCSV<DB::SerializationDateTime64::ColumnType>(
column, istr, settings, datetime64->getTimeZone(), DateLUT::instance("UTC"));
}
else if (typeid_cast<const SerializationNumber<DB::UInt8> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<UInt8> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::UInt8>(column, istr, settings);
deserializeNumberTextCSV<UInt8>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::UInt16> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<UInt16> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::UInt16>(column, istr, settings);
deserializeNumberTextCSV<UInt16>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::UInt32> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<UInt32> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::UInt32>(column, istr, settings);
deserializeNumberTextCSV<UInt32>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::UInt64> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<UInt64> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::UInt64>(column, istr, settings);
deserializeNumberTextCSV<UInt64>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::Int8> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<Int8> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::Int8>(column, istr, settings);
deserializeNumberTextCSV<Int8>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::Int16> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<Int16> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::Int16>(column, istr, settings);
deserializeNumberTextCSV<Int16>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::Int32> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<Int32> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::Int32>(column, istr, settings);
deserializeNumberTextCSV<Int32>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::Int64> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<Int64> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::Int64>(column, istr, settings);
deserializeNumberTextCSV<Int64>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::Float32> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<Float32> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::Float32>(column, istr, settings);
deserializeNumberTextCSV<Float32>(column, istr, settings);
}
else if (typeid_cast<const SerializationNumber<DB::Float64> *>(nested_ptr.get()))
else if (typeid_cast<const SerializationNumber<Float64> *>(nested_ptr.get()))
{
deserializeNumberTextCSV<DB::Float64>(column, istr, settings);
deserializeNumberTextCSV<Float64>(column, istr, settings);
}
else if (typeid_cast<const SerializationString *>(nested_ptr.get()))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ExcelTextFormatFile : public FormatFile
FormatFile::InputFormatPtr createInputFormat(const DB::Block & header) override;

bool supportSplit() const override { return true; }
DB::String getFileFormat() const override { return "ExcelText"; }
String getFileFormat() const override { return "ExcelText"; }

private:
DB::FormatSettings createFormatSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ class JSONFormatFile : public FormatFile

FormatFile::InputFormatPtr createInputFormat(const DB::Block & header) override;

DB::String getFileFormat() const override { return "JSONEachRow"; }
String getFileFormat() const override { return "JSONEachRow"; }
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ORCFormatFile : public FormatFile

bool supportSplit() const override { return true; }

DB::String getFileFormat() const override { return "ORC"; }
String getFileFormat() const override { return "ORC"; }

private:
mutable std::mutex mutex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ParquetFormatFile : public FormatFile

bool supportSplit() const override { return true; }

DB::String getFileFormat() const override { return "Parquet"; }
String getFileFormat() const override { return "Parquet"; }

private:
bool use_local_format;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ DB::Field FileReaderWrapper::buildFieldFromString(const String & str_value, DB::
{"Int16", BUILD_INT_FIELD(Int16)},
{"Int32", BUILD_INT_FIELD(Int32)},
{"Int64", BUILD_INT_FIELD(Int64)},
{"Float32", BUILD_FP_FIELD(DB::Float32)},
{"Float64", BUILD_FP_FIELD(DB::Float64)},
{"Float32", BUILD_FP_FIELD(Float32)},
{"Float64", BUILD_FP_FIELD(Float64)},
{"String", [](DB::ReadBuffer &, const String & val) { return DB::Field(val); }},
{"Date",
[](DB::ReadBuffer & in, const String &)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TextFormatFile : public FormatFile
FormatFile::InputFormatPtr createInputFormat(const DB::Block & header) override;

bool supportSplit() const override { return true; }
DB::String getFileFormat() const override { return "HiveText"; }
String getFileFormat() const override { return "HiveText"; }
};

}

0 comments on commit 00db209

Please sign in to comment.