Skip to content

Commit

Permalink
Removed constant NON_TAGGED_COLLATION.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagokepe committed May 24, 2024
1 parent 2711279 commit 66a5ffc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions extension/icu/icu_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ struct IcuBindData : public FunctionData {
}

static const string FUNCTION_PREFIX;
static const string NON_TAGGED_COLLATION;

static string EncodeFunctionName(const string &collation) {
return FUNCTION_PREFIX + collation;
Expand All @@ -117,7 +116,6 @@ struct IcuBindData : public FunctionData {
};

const string IcuBindData::FUNCTION_PREFIX = "icu_collate_";
const string IcuBindData::NON_TAGGED_COLLATION = "NON-TAGGED";

static int32_t ICUGetSortKey(icu::Collator &collator, string_t input, duckdb::unique_ptr<char[]> &buffer,
int32_t &buffer_size) {
Expand Down Expand Up @@ -203,13 +201,11 @@ static duckdb::unique_ptr<FunctionData> ICUSortKeyBind(ClientContext &context, S
}

static ScalarFunction GetICUCollateFunction(const string &collation,
const string &tag = IcuBindData::NON_TAGGED_COLLATION) {
const string &tag) {
string fname = IcuBindData::EncodeFunctionName(collation);
ScalarFunction result(fname, {LogicalType::VARCHAR}, LogicalType::VARCHAR, ICUCollateFunction, ICUCollateBind);
//! collation tag is added into the Function extra info
if (tag != IcuBindData::NON_TAGGED_COLLATION) {
result.extra_info = std::move(tag);
}
result.extra_info = std::move(tag);
result.serialize = IcuBindData::Serialize;
result.deserialize = IcuBindData::Deserialize;
return result;
Expand Down Expand Up @@ -300,7 +296,7 @@ static void LoadInternal(DuckDB &ddb) {
}
collation = StringUtil::Lower(collation);

CreateCollationInfo info(collation, GetICUCollateFunction(collation), false, false);
CreateCollationInfo info(collation, GetICUCollateFunction(collation, ""), false, false);
ExtensionUtil::RegisterCollation(db, info);
}

Expand Down

0 comments on commit 66a5ffc

Please sign in to comment.