mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Improve wording in docs
This commit is contained in:
parent
1e5f7ff80d
commit
adebc372d7
@ -1781,7 +1781,7 @@ Result:
|
||||
|
||||
Encodes numbers as a [Sqid](https://sqids.org/) which is a YouTube-like ID string.
|
||||
The output alphabet is `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`.
|
||||
Do not use this function for hashing - the generated IDs can be decoded back into numbers.
|
||||
Do not use this function for hashing - the generated IDs can be decoded back into the original numbers.
|
||||
|
||||
**Syntax**
|
||||
|
||||
@ -1813,7 +1813,8 @@ SELECT sqidEncode(1, 2, 3, 4, 5);
|
||||
|
||||
## sqidDecode
|
||||
|
||||
Decodes a [Sqid](https://sqids.org/) into numbers.
|
||||
Decodes a [Sqid](https://sqids.org/) back into its original numbers.
|
||||
Returns an empty array in case the input string is not a valid sqid.
|
||||
|
||||
**Syntax**
|
||||
|
||||
|
@ -110,14 +110,14 @@ public:
|
||||
|
||||
auto col_res_offsets = ColumnArray::ColumnOffsets::create();
|
||||
auto & res_offsets_data = col_res_offsets->getData();
|
||||
res_offsets_data.reserve(input_rows_count);
|
||||
|
||||
std::vector<UInt64> integers;
|
||||
for (size_t i = 0; i < input_rows_count; ++i)
|
||||
{
|
||||
const ColumnWithTypeAndName & arg = arguments[0];
|
||||
ColumnPtr current_column = arg.column;
|
||||
std::string_view sqid = current_column->getDataAt(i).toView();
|
||||
integers = sqids.decode(sqid);
|
||||
std::vector<UInt64> integers = sqids.decode(sqid);
|
||||
res_nested_data.insert(integers.begin(), integers.end());
|
||||
res_offsets_data.push_back(integers.size());
|
||||
}
|
||||
@ -151,10 +151,10 @@ Transforms numbers into a [Sqid](https://sqids.org/) which is a Youtube-like ID
|
||||
|
||||
factory.registerFunction<FunctionSqidDecode>(FunctionDocumentation{
|
||||
.description=R"(
|
||||
Transforms a [Sqid](https://sqids.org/) back into a tuple of numbers.)",
|
||||
Transforms a [Sqid](https://sqids.org/) back into an array of numbers.)",
|
||||
.syntax="sqidDecode(number1, ...)",
|
||||
.arguments={{"sqid", "A sqid"}},
|
||||
.returned_value="A tuple of [UInt64](/docs/en/sql-reference/data-types/int-uint.md).",
|
||||
.returned_value="An array of [UInt64](/docs/en/sql-reference/data-types/int-uint.md).",
|
||||
.examples={
|
||||
{"simple",
|
||||
"SELECT sqidDecode('gXHfJ1C6dN');",
|
||||
|
@ -11,5 +11,7 @@ XMbT [1,2]
|
||||
86Rf07 [1,2,3]
|
||||
Td1EnWQo [1,2,3,4]
|
||||
XMbT
|
||||
-- invalid sqid
|
||||
[]
|
||||
-- alias
|
||||
XMbT
|
||||
|
@ -22,5 +22,8 @@ SELECT sqidEncode(materialize(1), materialize(2), materialize(3)) AS sqid, sqidD
|
||||
SELECT sqidEncode(materialize(1::UInt8), materialize(2::UInt16), materialize(3::UInt32), materialize(4::UInt64)) AS sqid, sqidDecode(sqid);
|
||||
SELECT sqidEncode(toNullable(materialize(1)), toLowCardinality(materialize(2)));
|
||||
|
||||
SELECT '-- invalid sqid';
|
||||
SELECT sqidDecode('invalid sqid');
|
||||
|
||||
SELECT '-- alias';
|
||||
SELECT sqid(1, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user