mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #60494 from rschu1ze/byteSlice
Add convenience alias `byteSlice` for `substring`
This commit is contained in:
commit
ed215a293a
@ -167,6 +167,10 @@ Result:
|
|||||||
└──────────────────────────────────────────┴───────────────────────────────┘
|
└──────────────────────────────────────────┴───────────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## byteSlice(s, offset, length)
|
||||||
|
|
||||||
|
See function [substring](string-functions.md#substring).
|
||||||
|
|
||||||
## bitTest
|
## bitTest
|
||||||
|
|
||||||
Takes any integer and converts it into [binary form](https://en.wikipedia.org/wiki/Binary_number), returns the value of a bit at specified position. The countdown starts from 0 from the right to the left.
|
Takes any integer and converts it into [binary form](https://en.wikipedia.org/wiki/Binary_number), returns the value of a bit at specified position. The countdown starts from 0 from the right to the left.
|
||||||
|
@ -558,6 +558,7 @@ substring(s, offset[, length])
|
|||||||
Alias:
|
Alias:
|
||||||
- `substr`
|
- `substr`
|
||||||
- `mid`
|
- `mid`
|
||||||
|
- `byteSlice`
|
||||||
|
|
||||||
**Arguments**
|
**Arguments**
|
||||||
|
|
||||||
|
@ -189,6 +189,7 @@ REGISTER_FUNCTION(Substring)
|
|||||||
factory.registerFunction<FunctionSubstring<false>>({}, FunctionFactory::CaseInsensitive);
|
factory.registerFunction<FunctionSubstring<false>>({}, FunctionFactory::CaseInsensitive);
|
||||||
factory.registerAlias("substr", "substring", FunctionFactory::CaseInsensitive); // MySQL alias
|
factory.registerAlias("substr", "substring", FunctionFactory::CaseInsensitive); // MySQL alias
|
||||||
factory.registerAlias("mid", "substring", FunctionFactory::CaseInsensitive); /// MySQL alias
|
factory.registerAlias("mid", "substring", FunctionFactory::CaseInsensitive); /// MySQL alias
|
||||||
|
factory.registerAlias("byteSlice", "substring", FunctionFactory::CaseInsensitive); /// resembles PostgreSQL's get_byte function, similar to ClickHouse's bitSlice
|
||||||
|
|
||||||
factory.registerFunction<FunctionSubstring<true>>({}, FunctionFactory::CaseSensitive);
|
factory.registerFunction<FunctionSubstring<true>>({}, FunctionFactory::CaseSensitive);
|
||||||
}
|
}
|
||||||
|
@ -170,4 +170,6 @@ g
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
UBSAN bug
|
-- UBSAN bug
|
||||||
|
-- Alias
|
||||||
|
el
|
||||||
|
@ -132,7 +132,7 @@ SELECT substring(s, l, r) FROM t;
|
|||||||
|
|
||||||
DROP table if exists t;
|
DROP table if exists t;
|
||||||
|
|
||||||
SELECT 'UBSAN bug';
|
SELECT '-- UBSAN bug';
|
||||||
|
|
||||||
/** NOTE: The behaviour of substring and substringUTF8 is inconsistent when negative offset is greater than string size:
|
/** NOTE: The behaviour of substring and substringUTF8 is inconsistent when negative offset is greater than string size:
|
||||||
* substring:
|
* substring:
|
||||||
@ -144,3 +144,6 @@ SELECT 'UBSAN bug';
|
|||||||
* This may be subject for change.
|
* This may be subject for change.
|
||||||
*/
|
*/
|
||||||
SELECT substringUTF8('hello, пÑ<C2BF>ивеÑ<C2B5>', -9223372036854775808, number) FROM numbers(16) FORMAT Null;
|
SELECT substringUTF8('hello, пÑ<C2BF>ивеÑ<C2B5>', -9223372036854775808, number) FROM numbers(16) FORMAT Null;
|
||||||
|
|
||||||
|
SELECT '-- Alias';
|
||||||
|
SELECT byteSlice('hello', 2, 2);
|
||||||
|
@ -773,7 +773,6 @@ ReferenceKeyed
|
|||||||
Refreshable
|
Refreshable
|
||||||
RegexpTree
|
RegexpTree
|
||||||
RemoteRead
|
RemoteRead
|
||||||
SharedMergeTree
|
|
||||||
ReplacingMergeTree
|
ReplacingMergeTree
|
||||||
ReplicasMaxAbsoluteDelay
|
ReplicasMaxAbsoluteDelay
|
||||||
ReplicasMaxInsertsInQueue
|
ReplicasMaxInsertsInQueue
|
||||||
@ -842,6 +841,8 @@ Sematext
|
|||||||
SendExternalTables
|
SendExternalTables
|
||||||
SendScalars
|
SendScalars
|
||||||
ShareAlike
|
ShareAlike
|
||||||
|
SharedMergeTree
|
||||||
|
Shortkeys
|
||||||
Shortkeys
|
Shortkeys
|
||||||
SimHash
|
SimHash
|
||||||
Simhash
|
Simhash
|
||||||
@ -1239,6 +1240,7 @@ buildable
|
|||||||
builtins
|
builtins
|
||||||
byteHammingDistance
|
byteHammingDistance
|
||||||
byteSize
|
byteSize
|
||||||
|
byteSlice
|
||||||
byteSwap
|
byteSwap
|
||||||
bytebase
|
bytebase
|
||||||
bytesToCutForIPv
|
bytesToCutForIPv
|
||||||
@ -1617,7 +1619,6 @@ greaterorequals
|
|||||||
greenspace
|
greenspace
|
||||||
groupArray
|
groupArray
|
||||||
groupArrayInsertAt
|
groupArrayInsertAt
|
||||||
grouparrayintersect
|
|
||||||
groupArrayIntersect
|
groupArrayIntersect
|
||||||
groupArrayLast
|
groupArrayLast
|
||||||
groupArrayMovingAvg
|
groupArrayMovingAvg
|
||||||
@ -1634,6 +1635,7 @@ groupBitmapXor
|
|||||||
groupUniqArray
|
groupUniqArray
|
||||||
grouparray
|
grouparray
|
||||||
grouparrayinsertat
|
grouparrayinsertat
|
||||||
|
grouparrayintersect
|
||||||
grouparraylast
|
grouparraylast
|
||||||
grouparraymovingavg
|
grouparraymovingavg
|
||||||
grouparraymovingsum
|
grouparraymovingsum
|
||||||
@ -1699,6 +1701,7 @@ hyperscan
|
|||||||
hypot
|
hypot
|
||||||
hyvor
|
hyvor
|
||||||
iTerm
|
iTerm
|
||||||
|
iTerm
|
||||||
icosahedron
|
icosahedron
|
||||||
icudata
|
icudata
|
||||||
idempotency
|
idempotency
|
||||||
@ -1746,7 +1749,6 @@ isValidJSON
|
|||||||
isValidUTF
|
isValidUTF
|
||||||
isZeroOrNull
|
isZeroOrNull
|
||||||
iteratively
|
iteratively
|
||||||
iTerm
|
|
||||||
jaccard
|
jaccard
|
||||||
jaccardIndex
|
jaccardIndex
|
||||||
jaroSimilarity
|
jaroSimilarity
|
||||||
@ -2320,7 +2322,6 @@ shardNum
|
|||||||
sharded
|
sharded
|
||||||
sharding
|
sharding
|
||||||
shortcircuit
|
shortcircuit
|
||||||
Shortkeys
|
|
||||||
shortkeys
|
shortkeys
|
||||||
shoutout
|
shoutout
|
||||||
simdjson
|
simdjson
|
||||||
|
Loading…
Reference in New Issue
Block a user