mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into filelog-engine
This commit is contained in:
commit
dc318000e4
@ -152,6 +152,7 @@ if (CMAKE_GENERATOR STREQUAL "Ninja" AND NOT DISABLE_COLORED_BUILD)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
|
||||
endif ()
|
||||
|
||||
include (cmake/check_flags.cmake)
|
||||
include (cmake/add_warning.cmake)
|
||||
|
||||
if (NOT MSVC)
|
||||
@ -166,7 +167,8 @@ if (COMPILER_CLANG)
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -gdwarf-aranges")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0.0)
|
||||
if (HAS_USE_CTOR_HOMING)
|
||||
# For more info see https://blog.llvm.org/posts/2021-04-05-constructor-homing-for-debug-info/
|
||||
if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fuse-ctor-homing")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xclang -fuse-ctor-homing")
|
||||
@ -631,9 +633,6 @@ include_directories(${ConfigIncludePath})
|
||||
# Add as many warnings as possible for our own code.
|
||||
include (cmake/warnings.cmake)
|
||||
|
||||
# Check if needed compiler flags are supported
|
||||
include (cmake/check_flags.cmake)
|
||||
|
||||
add_subdirectory (base)
|
||||
add_subdirectory (src)
|
||||
add_subdirectory (programs)
|
||||
|
@ -4,3 +4,4 @@ include (CheckCCompilerFlag)
|
||||
check_cxx_compiler_flag("-Wsuggest-destructor-override" HAS_SUGGEST_DESTRUCTOR_OVERRIDE)
|
||||
check_cxx_compiler_flag("-Wshadow" HAS_SHADOW)
|
||||
check_cxx_compiler_flag("-Wsuggest-override" HAS_SUGGEST_OVERRIDE)
|
||||
check_cxx_compiler_flag("-Xclang -fuse-ctor-homing" HAS_USE_CTOR_HOMING)
|
||||
|
@ -3,58 +3,58 @@ toc_priority: 66
|
||||
toc_title: ClickHouse Keeper
|
||||
---
|
||||
|
||||
# [pre-production] clickhouse-keeper
|
||||
# [pre-production] ClickHouse Keeper
|
||||
|
||||
ClickHouse server use [ZooKeeper](https://zookeeper.apache.org/) coordination system for data [replication](../engines/table-engines/mergetree-family/replication.md) and [distributed DDL](../sql-reference/distributed-ddl.md) queries execution. ClickHouse Keeper is an alternative coordination system compatible with ZooKeeper.
|
||||
ClickHouse server uses [ZooKeeper](https://zookeeper.apache.org/) coordination system for data [replication](../engines/table-engines/mergetree-family/replication.md) and [distributed DDL](../sql-reference/distributed-ddl.md) queries execution. ClickHouse Keeper is an alternative coordination system compatible with ZooKeeper.
|
||||
|
||||
!!! warning "Warning"
|
||||
This feature currently in pre-production stage. We test it in our CI and on small internal installations.
|
||||
This feature is currently in the pre-production stage. We test it in our CI and on small internal installations.
|
||||
|
||||
## Implementation details
|
||||
|
||||
ZooKeeper is one of the first well-known open-source coordination systems. It's implemented in Java, has quite a simple and powerful data model. ZooKeeper's coordination algorithm called ZAB (ZooKeeper Atomic Broadcast) doesn't provide linearizability guarantees for reads, because each ZooKeeper node serves reads locally. Unlike ZooKeeper `clickhouse-keeper` written in C++ and use [RAFT algorithm](https://raft.github.io/) [implementation](https://github.com/eBay/NuRaft). This algorithm allows to have linearizability for reads and writes, has several open-source implementations in different languages.
|
||||
ZooKeeper is one of the first well-known open-source coordination systems. It's implemented in Java, has quite a simple and powerful data model. ZooKeeper's coordination algorithm called ZAB (ZooKeeper Atomic Broadcast) doesn't provide linearizability guarantees for reads, because each ZooKeeper node serves reads locally. Unlike ZooKeeper ClickHouse Keeper is written in C++ and uses [RAFT algorithm](https://raft.github.io/) [implementation](https://github.com/eBay/NuRaft). This algorithm allows to have linearizability for reads and writes, has several open-source implementations in different languages.
|
||||
|
||||
By default, `clickhouse-keeper` provides the same guarantees as ZooKeeper (linearizable writes, non-linearizable reads). It has a compatible client-server protocol, so any standard ZooKeeper client can be used to interact with `clickhouse-keeper`. Snapshots and logs have an incompatible format with ZooKeeper, but `clickhouse-keeper-converter` tool allows to convert ZooKeeper data to `clickhouse-keeper` snapshot. Interserver protocol in `clickhouse-keeper` also incompatible with ZooKeeper so mixed ZooKeeper/clickhouse-keeper cluster is impossible.
|
||||
By default, ClickHouse Keeper provides the same guarantees as ZooKeeper (linearizable writes, non-linearizable reads). It has a compatible client-server protocol, so any standard ZooKeeper client can be used to interact with ClickHouse Keeper. Snapshots and logs have an incompatible format with ZooKeeper, but `clickhouse-keeper-converter` tool allows to convert ZooKeeper data to ClickHouse Keeper snapshot. Interserver protocol in ClickHouse Keeper is also incompatible with ZooKeeper so mixed ZooKeeper / ClickHouse Keeper cluster is impossible.
|
||||
|
||||
## Configuration
|
||||
|
||||
`clickhouse-keeper` can be used as a standalone replacement for ZooKeeper or as an internal part of the `clickhouse-server`, but in both cases configuration is almost the same `.xml` file. The main `clickhouse-keeper` configuration tag is `<keeper_server>`. Keeper configuration has the following parameters:
|
||||
ClickHouse Keeper can be used as a standalone replacement for ZooKeeper or as an internal part of the ClickHouse server, but in both cases configuration is almost the same `.xml` file. The main ClickHouse Keeper configuration tag is `<keeper_server>`. Keeper configuration has the following parameters:
|
||||
|
||||
- `tcp_port` — the port for a client to connect (default for ZooKeeper is `2181`)
|
||||
- `tcp_port_secure` — the secure port for a client to connect
|
||||
- `server_id` — unique server id, each participant of the clickhouse-keeper cluster must have a unique number (1, 2, 3, and so on)
|
||||
- `log_storage_path` — path to coordination logs, better to store logs on the non-busy device (same for ZooKeeper)
|
||||
- `snapshot_storage_path` — path to coordination snapshots
|
||||
- `tcp_port` — Port for a client to connect (default for ZooKeeper is `2181`).
|
||||
- `tcp_port_secure` — Secure port for a client to connect.
|
||||
- `server_id` — Unique server id, each participant of the ClickHouse Keeper cluster must have a unique number (1, 2, 3, and so on).
|
||||
- `log_storage_path` — Path to coordination logs, better to store logs on the non-busy device (same for ZooKeeper).
|
||||
- `snapshot_storage_path` — Path to coordination snapshots.
|
||||
|
||||
Other common parameters are inherited from clickhouse-server config (`listen_host`, `logger` and so on).
|
||||
Other common parameters are inherited from the ClickHouse server config (`listen_host`, `logger`, and so on).
|
||||
|
||||
Internal coordination settings are located in `<keeper_server>.<coordination_settings>` section:
|
||||
|
||||
- `operation_timeout_ms` — timeout for a single client operation (default: 10000)
|
||||
- `session_timeout_ms` — timeout for client session (default: 30000)
|
||||
- `dead_session_check_period_ms` — how often clickhouse-keeper check dead sessions and remove them (default: 500)
|
||||
- `heart_beat_interval_ms` — how often a clickhouse-keeper leader will send heartbeats to followers (default: 500)
|
||||
- `election_timeout_lower_bound_ms` — if follower didn't receive heartbeats from the leader in this interval, then it can initiate leader election (default: 1000)
|
||||
- `election_timeout_upper_bound_ms` — if follower didn't receive heartbeats from the leader in this interval, then it must initiate leader election (default: 2000)
|
||||
- `rotate_log_storage_interval` — how many log records to store in a single file (default: 100000)
|
||||
- `reserved_log_items` — how many coordination log records to store before compaction (default: 100000)
|
||||
- `snapshot_distance` — how often clickhouse-keeper will create new snapshots (in the number of records in logs) (default: 100000)
|
||||
- `snapshots_to_keep` — how many snapshots to keep (default: 3)
|
||||
- `stale_log_gap` — the threshold when leader consider follower as stale and send snapshot to it instead of logs (default: 10000)
|
||||
- `fresh_log_gap` - when node became fresh (default: 200)
|
||||
- `max_requests_batch_size` - max size of batch in requests count before it will be sent to RAFT (default: 100)
|
||||
- `force_sync` — call `fsync` on each write to coordination log (default: true)
|
||||
- `quorum_reads` - execute read requests as writes through whole RAFT consesus with similar speed (default: false)
|
||||
- `raft_logs_level` — text logging level about coordination (trace, debug, and so on) (default: system default)
|
||||
- `auto_forwarding` - allow to forward write requests from followers to leader (default: true)
|
||||
- `shutdown_timeout` — wait to finish internal connections and shutdown (ms) (default: 5000)
|
||||
- `startup_timeout` — if the server doesn't connect to other quorum participants in the specified timeout it will terminate (ms) (default: 30000)
|
||||
- `operation_timeout_ms` — Timeout for a single client operation (ms) (default: 10000).
|
||||
- `session_timeout_ms` — Timeout for client session (ms) (default: 30000).
|
||||
- `dead_session_check_period_ms` — How often ClickHouse Keeper check dead sessions and remove them (ms) (default: 500).
|
||||
- `heart_beat_interval_ms` — How often a ClickHouse Keeper leader will send heartbeats to followers (ms) (default: 500).
|
||||
- `election_timeout_lower_bound_ms` — If the follower didn't receive heartbeats from the leader in this interval, then it can initiate leader election (default: 1000).
|
||||
- `election_timeout_upper_bound_ms` — If the follower didn't receive heartbeats from the leader in this interval, then it must initiate leader election (default: 2000).
|
||||
- `rotate_log_storage_interval` — How many log records to store in a single file (default: 100000).
|
||||
- `reserved_log_items` — How many coordination log records to store before compaction (default: 100000).
|
||||
- `snapshot_distance` — How often ClickHouse Keeper will create new snapshots (in the number of records in logs) (default: 100000).
|
||||
- `snapshots_to_keep` — How many snapshots to keep (default: 3).
|
||||
- `stale_log_gap` — Threshold when leader considers follower as stale and sends the snapshot to it instead of logs (default: 10000).
|
||||
- `fresh_log_gap` — When node became fresh (default: 200).
|
||||
- `max_requests_batch_size` - Max size of batch in requests count before it will be sent to RAFT (default: 100).
|
||||
- `force_sync` — Call `fsync` on each write to coordination log (default: true).
|
||||
- `quorum_reads` — Execute read requests as writes through whole RAFT consensus with similar speed (default: false).
|
||||
- `raft_logs_level` — Text logging level about coordination (trace, debug, and so on) (default: system default).
|
||||
- `auto_forwarding` — Allow to forward write requests from followers to the leader (default: true).
|
||||
- `shutdown_timeout` — Wait to finish internal connections and shutdown (ms) (default: 5000).
|
||||
- `startup_timeout` — If the server doesn't connect to other quorum participants in the specified timeout it will terminate (ms) (default: 30000).
|
||||
|
||||
Quorum configuration is located in `<keeper_server>.<raft_configuration>` section and contain servers description. The only parameter for the whole quorum is `secure`, which enables encrypted connection for communication between quorum participants. The main parameters for each `<server>` are:
|
||||
|
||||
- `id` — server_id in quorum
|
||||
- `hostname` — hostname where this server placed
|
||||
- `port` — port where this server listen for connections
|
||||
- `id` — Server identifier in a quorum.
|
||||
- `hostname` — Hostname where this server is placed.
|
||||
- `port` — Port where this server listens for connections.
|
||||
|
||||
|
||||
Examples of configuration for quorum with three nodes can be found in [integration tests](https://github.com/ClickHouse/ClickHouse/tree/master/tests/integration) with `test_keeper_` prefix. Example configuration for server #1:
|
||||
@ -94,7 +94,7 @@ Examples of configuration for quorum with three nodes can be found in [integrati
|
||||
|
||||
## How to run
|
||||
|
||||
`clickhouse-keeper` is bundled into `clickhouse-server` package, just add configuration of `<keeper_server>` and start clickhouse-server as always. If you want to run standalone `clickhouse-keeper` you can start it in a similar way with:
|
||||
ClickHouse Keeper is bundled into the ClickHouse server package, just add configuration of `<keeper_server>` and start ClickHouse server as always. If you want to run standalone ClickHouse Keeper you can start it in a similar way with:
|
||||
|
||||
```bash
|
||||
clickhouse-keeper --config /etc/your_path_to_config/config.xml --daemon
|
||||
@ -102,17 +102,18 @@ clickhouse-keeper --config /etc/your_path_to_config/config.xml --daemon
|
||||
|
||||
## [experimental] Migration from ZooKeeper
|
||||
|
||||
Seamlessly migration from ZooKeeper to `clickhouse-keeper` is impossible you have to stop your ZooKeeper cluster, convert data and start `clickhouse-keeper`. `clickhouse-keeper-converter` tool allows to convert ZooKeeper logs and snapshots to `clickhouse-keeper` snapshot. It works only with ZooKeeper > 3.4. Steps for migration:
|
||||
Seamlessly migration from ZooKeeper to ClickHouse Keeper is impossible you have to stop your ZooKeeper cluster, convert data and start ClickHouse Keeper. `clickhouse-keeper-converter` tool allows converting ZooKeeper logs and snapshots to ClickHouse Keeper snapshot. It works only with ZooKeeper > 3.4. Steps for migration:
|
||||
|
||||
1. Stop all ZooKeeper nodes.
|
||||
|
||||
2. [optional, but recommended] Found ZooKeeper leader node, start and stop it again. It will force ZooKeeper to create consistent snapshot.
|
||||
2. Optional, but recommended: find ZooKeeper leader node, start and stop it again. It will force ZooKeeper to create a consistent snapshot.
|
||||
|
||||
3. Run `clickhouse-keeper-converter` on leader, example
|
||||
3. Run `clickhouse-keeper-converter` on a leader, for example:
|
||||
|
||||
```bash
|
||||
clickhouse-keeper-converter --zookeeper-logs-dir /var/lib/zookeeper/version-2 --zookeeper-snapshots-dir /var/lib/zookeeper/version-2 --output-dir /path/to/clickhouse/keeper/snapshots
|
||||
```
|
||||
|
||||
4. Copy snapshot to `clickhouse-server` nodes with configured `keeper` or start `clickhouse-keeper` instead of ZooKeeper. Snapshot must persist on all nodes, otherwise empty nodes can be faster and one of them can becamse leader.
|
||||
4. Copy snapshot to ClickHouse server nodes with a configured `keeper` or start ClickHouse Keeper instead of ZooKeeper. The snapshot must persist on all nodes, otherwise, empty nodes can be faster and one of them can become a leader.
|
||||
|
||||
[Original article](https://clickhouse.tech/docs/en/operations/clickhouse-keeper/) <!--hide-->
|
||||
|
@ -3566,3 +3566,91 @@ Possible values:
|
||||
- Positive integer.
|
||||
|
||||
Default value: `1000`.
|
||||
|
||||
## max_hyperscan_regexp_length {#max-hyperscan-regexp-length}
|
||||
|
||||
Defines the maximum length for each regular expression in the [hyperscan multi-match functions](../../sql-reference/functions/string-search-functions.md#multimatchanyhaystack-pattern1-pattern2-patternn).
|
||||
|
||||
Possible values:
|
||||
|
||||
- Positive integer.
|
||||
- 0 - The length is not limited.
|
||||
|
||||
Default value: `0`.
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['ab','bcd','c','d']) SETTINGS max_hyperscan_regexp_length = 3;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```text
|
||||
┌─multiMatchAny('abcd', ['ab', 'bcd', 'c', 'd'])─┐
|
||||
│ 1 │
|
||||
└────────────────────────────────────────────────┘
|
||||
|
||||
```
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['ab','bcd','c','d']) SETTINGS max_hyperscan_regexp_length = 2;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```text
|
||||
Exception: Regexp length too large.
|
||||
```
|
||||
|
||||
**See Also**
|
||||
|
||||
- [max_hyperscan_regexp_total_length](#max-hyperscan-regexp-total-length)
|
||||
|
||||
|
||||
## max_hyperscan_regexp_total_length {#max-hyperscan-regexp-total-length}
|
||||
|
||||
Sets the maximum length total of all regular expressions in each [hyperscan multi-match function](../../sql-reference/functions/string-search-functions.md#multimatchanyhaystack-pattern1-pattern2-patternn).
|
||||
|
||||
Possible values:
|
||||
|
||||
- Positive integer.
|
||||
- 0 - The length is not limited.
|
||||
|
||||
Default value: `0`.
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['a','b','c','d']) SETTINGS max_hyperscan_regexp_total_length = 5;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```text
|
||||
┌─multiMatchAny('abcd', ['a', 'b', 'c', 'd'])─┐
|
||||
│ 1 │
|
||||
└─────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['ab','bc','c','d']) SETTINGS max_hyperscan_regexp_total_length = 5;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```text
|
||||
Exception: Total regexp lengths too large.
|
||||
```
|
||||
|
||||
**See Also**
|
||||
|
||||
- [max_hyperscan_regexp_length](#max-hyperscan-regexp-length)
|
||||
|
@ -25,14 +25,13 @@ Aliases:
|
||||
- `Int32` — `INT`, `INT4`, `INTEGER`.
|
||||
- `Int64` — `BIGINT`.
|
||||
|
||||
## Uint Ranges {#uint-ranges}
|
||||
## UInt Ranges {#uint-ranges}
|
||||
|
||||
- `UInt8` — \[0 : 255\]
|
||||
- `UInt16` — \[0 : 65535\]
|
||||
- `UInt32` — \[0 : 4294967295\]
|
||||
- `UInt64` — \[0 : 18446744073709551615\]
|
||||
- `UInt128` — \[0 : 340282366920938463463374607431768211455\]
|
||||
- `UInt256` — \[0 : 115792089237316195423570985008687907853269984665640564039457584007913129639935\]
|
||||
|
||||
`UInt128` is not supported yet.
|
||||
|
||||
[Original article](https://clickhouse.tech/docs/en/data_types/int_uint/) <!--hide-->
|
||||
|
@ -29,7 +29,7 @@ Returns the round number with largest absolute value that has an absolute value
|
||||
|
||||
Rounds a value to a specified number of decimal places.
|
||||
|
||||
The function returns the nearest number of the specified order. In case when given number has equal distance to surrounding numbers, the function uses banker’s rounding for float number types and rounds away from zero for the other number types.
|
||||
The function returns the nearest number of the specified order. In case when given number has equal distance to surrounding numbers, the function uses banker’s rounding for float number types and rounds away from zero for the other number types (Decimal).
|
||||
|
||||
``` sql
|
||||
round(expression [, decimal_places])
|
||||
@ -49,7 +49,7 @@ The rounded number of the same type as the input number.
|
||||
|
||||
### Examples {#examples}
|
||||
|
||||
**Example of use**
|
||||
**Example of use with Float**
|
||||
|
||||
``` sql
|
||||
SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3
|
||||
@ -63,6 +63,20 @@ SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3
|
||||
└─────┴──────────────────────────┘
|
||||
```
|
||||
|
||||
**Example of use with Decimal**
|
||||
|
||||
``` sql
|
||||
SELECT cast(number / 2 AS Decimal(10,4)) AS x, round(x) FROM system.numbers LIMIT 3
|
||||
```
|
||||
|
||||
``` text
|
||||
┌──────x─┬─round(CAST(divide(number, 2), 'Decimal(10, 4)'))─┐
|
||||
│ 0.0000 │ 0.0000 │
|
||||
│ 0.5000 │ 1.0000 │
|
||||
│ 1.0000 │ 1.0000 │
|
||||
└────────┴──────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Examples of rounding**
|
||||
|
||||
Rounding to the nearest number.
|
||||
|
119
docs/ru/operations/clickhouse-keeper.md
Normal file
119
docs/ru/operations/clickhouse-keeper.md
Normal file
@ -0,0 +1,119 @@
|
||||
---
|
||||
toc_priority: 66
|
||||
toc_title: ClickHouse Keeper
|
||||
---
|
||||
|
||||
# [пре-продакшн] ClickHouse Keeper
|
||||
|
||||
Сервер ClickHouse использует сервис координации [ZooKeeper](https://zookeeper.apache.org/) для [репликации](../engines/table-engines/mergetree-family/replication.md) данных и выполнения [распределенных DDL запросов](../sql-reference/distributed-ddl.md). ClickHouse Keeper — это альтернативный сервис координации, совместимый с ZooKeeper.
|
||||
|
||||
!!! warning "Предупреждение"
|
||||
ClickHouse Keeper находится в стадии пре-продакшн и тестируется в CI ClickHouse и на нескольких внутренних инсталляциях.
|
||||
|
||||
## Детали реализации
|
||||
|
||||
ZooKeeper — один из первых широко известных сервисов координации с открытым исходным кодом. Он реализован на языке программирования Java, имеет достаточно простую и мощную модель данных. Алгоритм координации Zookeeper называется ZAB (ZooKeeper Atomic Broadcast). Он не гарантирует линеаризуемость операций чтения, поскольку каждый узел ZooKeeper обслуживает чтения локально. В отличие от ZooKeeper, ClickHouse Keeper реализован на C++ и использует алгоритм [RAFT](https://raft.github.io/), [реализация](https://github.com/eBay/NuRaft). Этот алгоритм позволяет достичь линеаризуемости чтения и записи, имеет несколько реализаций с открытым исходным кодом на разных языках.
|
||||
|
||||
По умолчанию ClickHouse Keeper предоставляет те же гарантии, что и ZooKeeper (линеаризуемость записей, последовательная согласованность чтений). У него есть совместимый клиент-серверный протокол, поэтому любой стандартный клиент ZooKeeper может использоваться для взаимодействия с ClickHouse Keeper. Снэпшоты и журналы имеют несовместимый с ZooKeeper формат, однако можно конвертировать данные Zookeeper в снэпшот ClickHouse Keeper с помощью `clickhouse-keeper-converter`. Межсерверный протокол ClickHouse Keeper также несовместим с ZooKeeper, поэтому создание смешанного кластера ZooKeeper / ClickHouse Keeper невозможно.
|
||||
|
||||
## Конфигурация
|
||||
|
||||
ClickHouse Keeper может использоваться как равноценная замена ZooKeeper или как внутренняя часть сервера ClickHouse, но в обоих случаях конфигурация представлена файлом `.xml`. Главный тег конфигурации ClickHouse Keeper — это `<keeper_server>`. Параметры конфигурации:
|
||||
|
||||
- `tcp_port` — порт для подключения клиента (по умолчанию для ZooKeeper: `2181`).
|
||||
- `tcp_port_secure` — зашифрованный порт для подключения клиента.
|
||||
- `server_id` — уникальный идентификатор сервера, каждый участник кластера должен иметь уникальный номер (1, 2, 3 и т. д.).
|
||||
- `log_storage_path` — путь к журналам координации, лучше хранить их на незанятом устройстве (актуально и для ZooKeeper).
|
||||
- `snapshot_storage_path` — путь к снэпшотам координации.
|
||||
|
||||
Другие общие параметры наследуются из конфигурации сервера ClickHouse (`listen_host`, `logger`, и т. д.).
|
||||
|
||||
Настройки внутренней координации находятся в `<keeper_server>.<coordination_settings>`:
|
||||
|
||||
- `operation_timeout_ms` — максимальное время ожидания для одной клиентской операции в миллисекундах (по умолчанию: 10000).
|
||||
- `session_timeout_ms` — максимальное время ожидания для клиентской сессии в миллисекундах (по умолчанию: 30000).
|
||||
- `dead_session_check_period_ms` — частота, с которой ClickHouse Keeper проверяет мертвые сессии и удаляет их, в миллисекундах (по умолчанию: 500).
|
||||
- `heart_beat_interval_ms` — частота, с которой узел-лидер ClickHouse Keeper отправляет хартбиты узлам-последователям, в миллисекундах (по умолчанию: 500).
|
||||
- `election_timeout_lower_bound_ms` — время, после которого последователь может инициировать выборы лидера, если не получил от него сердцебиения (по умолчанию: 1000).
|
||||
- `election_timeout_upper_bound_ms` — время, после которого последователь должен инициировать выборы лидера, если не получил от него сердцебиения (по умолчанию: 2000).
|
||||
- `rotate_log_storage_interval` — количество записей в журнале координации для хранения в одном файле (по умолчанию: 100000).
|
||||
- `reserved_log_items` — минимальное количество записей в журнале координации которые нужно сохранять после снятия снепшота (по умолчанию: 100000).
|
||||
- `snapshot_distance` — частота, с которой ClickHouse Keeper делает новые снэпшоты (по количеству записей в журналах), в миллисекундах (по умолчанию: 100000).
|
||||
- `snapshots_to_keep` — количество снэпшотов для сохранения (по умолчанию: 3).
|
||||
- `stale_log_gap` — время, после которого лидер считает последователя устаревшим и отправляет ему снэпшот вместо журналов (по умолчанию: 10000).
|
||||
- `fresh_log_gap` — максимальное отставание от лидера в количестве записей журнала после которого последователь считает себя не отстающим (по умолчанию: 200).
|
||||
- `max_requests_batch_size` — количество запросов на запись, которые будут сгруппированы в один перед отправкой через RAFT (по умолчанию: 100).
|
||||
- `force_sync` — вызывать `fsync` при каждой записи в журнал координации (по умолчанию: true).
|
||||
- `quorum_reads` — выполнять запросы чтения аналогично запросам записи через весь консенсус RAFT с негативным эффектом на производительность и размер журналов (по умолчанию: false).
|
||||
- `raft_logs_level` — уровень логгирования сообщений в текстовый лог (trace, debug и т. д.) (по умолчанию: information).
|
||||
- `auto_forwarding` — разрешить пересылку запросов на запись от последователей лидеру (по умолчанию: true).
|
||||
- `shutdown_timeout` — время ожидания завершения внутренних подключений и выключения, в миллисекундах (по умолчанию: 5000).
|
||||
- `startup_timeout` — время отключения сервера, если он не подключается к другим участникам кворума, в миллисекундах (по умолчанию: 30000).
|
||||
|
||||
Конфигурация кворума находится в `<keeper_server>.<raft_configuration>` и содержит описание серверов. Единственный параметр для всего кворума — `secure`, который включает зашифрованное соединение для связи между участниками кворума. Параметры для каждого `<server>`:
|
||||
|
||||
- `id` — идентификатор сервера в кворуме.
|
||||
- `hostname` — имя хоста, на котором размещен сервер.
|
||||
- `port` — порт, на котором серверу доступны соединения для внутренней коммуникации.
|
||||
|
||||
|
||||
Примеры конфигурации кворума с тремя узлами можно найти в [интеграционных тестах](https://github.com/ClickHouse/ClickHouse/tree/master/tests/integration) с префиксом `test_keeper_`. Пример конфигурации для сервера №1:
|
||||
|
||||
```xml
|
||||
<keeper_server>
|
||||
<tcp_port>2181</tcp_port>
|
||||
<server_id>1</server_id>
|
||||
<log_storage_path>/var/lib/clickhouse/coordination/log</log_storage_path>
|
||||
<snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>
|
||||
|
||||
<coordination_settings>
|
||||
<operation_timeout_ms>10000</operation_timeout_ms>
|
||||
<session_timeout_ms>30000</session_timeout_ms>
|
||||
<raft_logs_level>trace</raft_logs_level>
|
||||
</coordination_settings>
|
||||
|
||||
<raft_configuration>
|
||||
<server>
|
||||
<id>1</id>
|
||||
<hostname>zoo1</hostname>
|
||||
<port>9444</port>
|
||||
</server>
|
||||
<server>
|
||||
<id>2</id>
|
||||
<hostname>zoo2</hostname>
|
||||
<port>9444</port>
|
||||
</server>
|
||||
<server>
|
||||
<id>3</id>
|
||||
<hostname>zoo3</hostname>
|
||||
<port>9444</port>
|
||||
</server>
|
||||
</raft_configuration>
|
||||
</keeper_server>
|
||||
```
|
||||
|
||||
## Как запустить
|
||||
|
||||
ClickHouse Keeper входит в пакет` clickhouse-server`, просто добавьте кофигурацию `<keeper_server>` и запустите сервер ClickHouse как обычно. Если вы хотите запустить ClickHouse Keeper автономно, сделайте это аналогичным способом:
|
||||
|
||||
```bash
|
||||
clickhouse-keeper --config /etc/your_path_to_config/config.xml --daemon
|
||||
```
|
||||
|
||||
## [экспериментально] Переход с ZooKeeper
|
||||
|
||||
Плавный переход с ZooKeeper на ClickHouse Keeper невозможен, необходимо остановить кластер ZooKeeper, преобразовать данные и запустить ClickHouse Keeper. Утилита `clickhouse-keeper-converter` конвертирует журналы и снэпшоты ZooKeeper в снэпшот ClickHouse Keeper. Работа утилиты проверена только для версий ZooKeeper выше 3.4. Для миграции необходимо выполнить следующие шаги:
|
||||
|
||||
1. Остановите все узлы ZooKeeper.
|
||||
|
||||
2. Необязательно, но рекомендуется: найдите узел-лидер ZooKeeper, запустите и снова остановите его. Это заставит ZooKeeper создать консистентный снэпшот.
|
||||
|
||||
3. Запустите `clickhouse-keeper-converter` на лидере, например:
|
||||
|
||||
```bash
|
||||
clickhouse-keeper-converter --zookeeper-logs-dir /var/lib/zookeeper/version-2 --zookeeper-snapshots-dir /var/lib/zookeeper/version-2 --output-dir /path/to/clickhouse/keeper/snapshots
|
||||
```
|
||||
|
||||
4. Скопируйте снэпшот на узлы сервера ClickHouse с настроенным `keeper` или запустите ClickHouse Keeper вместо ZooKeeper. Снэпшот должен сохраняться на всех узлах: в противном случае пустые узлы могут захватить лидерство и сконвертированные данные могут быть отброшены на старте.
|
||||
|
||||
[Original article](https://clickhouse.tech/docs/en/operations/clickhouse-keeper/) <!--hide-->
|
@ -3375,3 +3375,91 @@ SETTINGS index_granularity = 8192 │
|
||||
- Положительное целое число.
|
||||
|
||||
Значение по умолчанию: `1000`.
|
||||
|
||||
## max_hyperscan_regexp_length {#max-hyperscan-regexp-length}
|
||||
|
||||
Задает максимальную длину каждого регулярного выражения в [hyperscan-функциях](../../sql-reference/functions/string-search-functions.md#multimatchanyhaystack-pattern1-pattern2-patternn) поиска множественных совпадений в строке.
|
||||
|
||||
Возможные значения:
|
||||
|
||||
- Положительное целое число.
|
||||
- 0 - длина не ограничена.
|
||||
|
||||
Значение по умолчанию: `0`.
|
||||
|
||||
**Пример**
|
||||
|
||||
Запрос:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['ab','bcd','c','d']) SETTINGS max_hyperscan_regexp_length = 3;
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
```text
|
||||
┌─multiMatchAny('abcd', ['ab', 'bcd', 'c', 'd'])─┐
|
||||
│ 1 │
|
||||
└────────────────────────────────────────────────┘
|
||||
|
||||
```
|
||||
|
||||
Запрос:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['ab','bcd','c','d']) SETTINGS max_hyperscan_regexp_length = 2;
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
```text
|
||||
Exception: Regexp length too large.
|
||||
```
|
||||
|
||||
**См. также**
|
||||
|
||||
- [max_hyperscan_regexp_total_length](#max-hyperscan-regexp-total-length)
|
||||
|
||||
|
||||
## max_hyperscan_regexp_total_length {#max-hyperscan-regexp-total-length}
|
||||
|
||||
Задает максимальную общую длину всех регулярных выражений в каждой [hyperscan-функции](../../sql-reference/functions/string-search-functions.md#multimatchanyhaystack-pattern1-pattern2-patternn) поиска множественных совпадений в строке.
|
||||
|
||||
Возможные значения:
|
||||
|
||||
- Положительное целое число.
|
||||
- 0 - длина не ограничена.
|
||||
|
||||
Значение по умолчанию: `0`.
|
||||
|
||||
**Пример**
|
||||
|
||||
Запрос:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['a','b','c','d']) SETTINGS max_hyperscan_regexp_total_length = 5;
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
```text
|
||||
┌─multiMatchAny('abcd', ['a', 'b', 'c', 'd'])─┐
|
||||
│ 1 │
|
||||
└─────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Запрос:
|
||||
|
||||
```sql
|
||||
SELECT multiMatchAny('abcd', ['ab','bc','c','d']) SETTINGS max_hyperscan_regexp_total_length = 5;
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
```text
|
||||
Exception: Total regexp lengths too large.
|
||||
```
|
||||
|
||||
**См. также**
|
||||
|
||||
- [max_hyperscan_regexp_length](#max-hyperscan-regexp-length)
|
||||
|
@ -27,7 +27,7 @@ N может быть отрицательным.
|
||||
|
||||
Округляет значение до указанного десятичного разряда.
|
||||
|
||||
Функция возвращает ближайшее значение указанного порядка. В случае, когда заданное число равноудалено от чисел необходимого порядка, функция возвращает то из них, которое имеет ближайшую чётную цифру (банковское округление).
|
||||
Функция возвращает ближайшее значение указанного порядка. В случае, когда заданное число равноудалено от чисел необходимого порядка, для типов с плавающей точкой (Float32/64) функция возвращает то из них, которое имеет ближайшую чётную цифру (банковское округление), для типов с фиксированной точкой (Decimal) функция использует округление в бо́льшую по модулю сторону (математическое округление).
|
||||
|
||||
``` sql
|
||||
round(expression [, decimal_places])
|
||||
@ -47,7 +47,7 @@ round(expression [, decimal_places])
|
||||
|
||||
### Примеры {#primery}
|
||||
|
||||
**Пример использования**
|
||||
**Пример использования с Float**
|
||||
|
||||
``` sql
|
||||
SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3
|
||||
@ -61,6 +61,21 @@ SELECT number / 2 AS x, round(x) FROM system.numbers LIMIT 3
|
||||
└─────┴──────────────────────────┘
|
||||
```
|
||||
|
||||
**Пример использования с Decimal**
|
||||
|
||||
|
||||
``` sql
|
||||
SELECT cast(number / 2 AS Decimal(10,4)) AS x, round(x) FROM system.numbers LIMIT 3
|
||||
```
|
||||
|
||||
``` text
|
||||
┌──────x─┬─round(CAST(divide(number, 2), 'Decimal(10, 4)'))─┐
|
||||
│ 0.0000 │ 0.0000 │
|
||||
│ 0.5000 │ 1.0000 │
|
||||
│ 1.0000 │ 1.0000 │
|
||||
└────────┴──────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Примеры округления**
|
||||
|
||||
Округление до ближайшего числа.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <string>
|
||||
|
||||
#include "Common/MemoryTracker.h"
|
||||
#include "Columns/ColumnsNumber.h"
|
||||
#include "ConnectionParameters.h"
|
||||
@ -1941,16 +1942,30 @@ private:
|
||||
{
|
||||
/// If INSERT data must be sent.
|
||||
auto * parsed_insert_query = parsed_query->as<ASTInsertQuery>();
|
||||
/// If query isn't parsed, no information can be got from it.
|
||||
if (!parsed_insert_query)
|
||||
return;
|
||||
|
||||
/// If data is got from file (maybe compressed file)
|
||||
if (parsed_insert_query->infile)
|
||||
{
|
||||
/// Get name of this file (path to file)
|
||||
const auto & in_file_node = parsed_insert_query->infile->as<ASTLiteral &>();
|
||||
const auto in_file = in_file_node.value.safeGet<std::string>();
|
||||
|
||||
auto in_buffer = wrapReadBufferWithCompressionMethod(std::make_unique<ReadBufferFromFile>(in_file), chooseCompressionMethod(in_file, ""));
|
||||
std::string compression_method;
|
||||
/// Compression method can be specified in query
|
||||
if (parsed_insert_query->compression)
|
||||
{
|
||||
const auto & compression_method_node = parsed_insert_query->compression->as<ASTLiteral &>();
|
||||
compression_method = compression_method_node.value.safeGet<std::string>();
|
||||
}
|
||||
|
||||
/// Otherwise, it will be detected from file name automatically (by chooseCompressionMethod)
|
||||
/// Buffer for reading from file is created and wrapped with appropriate compression method
|
||||
auto in_buffer = wrapReadBufferWithCompressionMethod(std::make_unique<ReadBufferFromFile>(in_file), chooseCompressionMethod(in_file, compression_method));
|
||||
|
||||
/// Now data is ready to be sent on server.
|
||||
try
|
||||
{
|
||||
sendDataFrom(*in_buffer, sample, columns_description);
|
||||
@ -1961,6 +1976,7 @@ private:
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// If query already has data to sent
|
||||
else if (parsed_insert_query->data)
|
||||
{
|
||||
/// Send data contained in the query.
|
||||
@ -2349,9 +2365,16 @@ private:
|
||||
const auto & out_file_node = query_with_output->out_file->as<ASTLiteral &>();
|
||||
const auto & out_file = out_file_node.value.safeGet<std::string>();
|
||||
|
||||
std::string compression_method;
|
||||
if (query_with_output->compression)
|
||||
{
|
||||
const auto & compression_method_node = query_with_output->compression->as<ASTLiteral &>();
|
||||
compression_method = compression_method_node.value.safeGet<std::string>();
|
||||
}
|
||||
|
||||
out_file_buf = wrapWriteBufferWithCompressionMethod(
|
||||
std::make_unique<WriteBufferFromFile>(out_file, DBMS_DEFAULT_BUFFER_SIZE, O_WRONLY | O_EXCL | O_CREAT),
|
||||
chooseCompressionMethod(out_file, ""),
|
||||
chooseCompressionMethod(out_file, compression_method),
|
||||
/* compression level = */ 3
|
||||
);
|
||||
|
||||
|
@ -49,6 +49,7 @@ SRCS(
|
||||
AggregateFunctionSimpleLinearRegression.cpp
|
||||
AggregateFunctionSimpleState.cpp
|
||||
AggregateFunctionSingleValueOrNull.cpp
|
||||
AggregateFunctionSparkbar.cpp
|
||||
AggregateFunctionState.cpp
|
||||
AggregateFunctionStatistics.cpp
|
||||
AggregateFunctionStatisticsSimple.cpp
|
||||
|
@ -43,7 +43,6 @@ SRCS(
|
||||
Epoll.cpp
|
||||
ErrorCodes.cpp
|
||||
Exception.cpp
|
||||
ExternalLoaderStatus.cpp
|
||||
FieldVisitorDump.cpp
|
||||
FieldVisitorHash.cpp
|
||||
FieldVisitorSum.cpp
|
||||
|
@ -35,11 +35,6 @@ SRCS(
|
||||
CompressionFactoryAdditions.cpp
|
||||
ICompressionCodec.cpp
|
||||
LZ4_decompress_faster.cpp
|
||||
fuzzers/compressed_buffer_fuzzer.cpp
|
||||
fuzzers/delta_decompress_fuzzer.cpp
|
||||
fuzzers/double_delta_decompress_fuzzer.cpp
|
||||
fuzzers/encrypted_decompress_fuzzer.cpp
|
||||
fuzzers/lz4_decompress_fuzzer.cpp
|
||||
getCompressionCodecForFile.cpp
|
||||
|
||||
)
|
||||
|
@ -466,6 +466,7 @@ class IColumn;
|
||||
M(Bool, force_optimize_projection, false, "If projection optimization is enabled, SELECT queries need to use projection", 0) \
|
||||
M(Bool, async_socket_for_remote, true, "Asynchronously read from socket executing remote query", 0) \
|
||||
M(Bool, insert_null_as_default, true, "Insert DEFAULT values instead of NULL in INSERT SELECT (UNION ALL)", 0) \
|
||||
M(Bool, describe_include_subcolumns, false, "If true, subcolumns of all table columns will be included into result of DESCRIBE query", 0) \
|
||||
\
|
||||
M(Bool, optimize_rewrite_sum_if_to_count_if, true, "Rewrite sumIf() and sum(if()) function countIf() function when logically equivalent", 0) \
|
||||
M(UInt64, insert_shard_id, 0, "If non zero, when insert into a distributed table, the data will be inserted into the shard `insert_shard_id` synchronously. Possible values range from 1 to `shards_number` of corresponding distributed table", 0) \
|
||||
|
@ -87,23 +87,38 @@ ColumnPtr IDataType::getSubcolumn(const String & subcolumn_name, const IColumn &
|
||||
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "There is no subcolumn {} in type {}", subcolumn_name, getName());
|
||||
}
|
||||
|
||||
Names IDataType::getSubcolumnNames() const
|
||||
void IDataType::forEachSubcolumn(const SubcolumnCallback & callback) const
|
||||
{
|
||||
NameSet res;
|
||||
getDefaultSerialization()->enumerateStreams([&res, this](const ISerialization::SubstreamPath & substream_path)
|
||||
NameSet set;
|
||||
getDefaultSerialization()->enumerateStreams([&, this](const ISerialization::SubstreamPath & substream_path)
|
||||
{
|
||||
ISerialization::SubstreamPath new_path;
|
||||
/// Iterate over path to try to get intermediate subcolumns for complex nested types.
|
||||
for (const auto & elem : substream_path)
|
||||
{
|
||||
new_path.push_back(elem);
|
||||
auto subcolumn_name = ISerialization::getSubcolumnNameForStream(new_path);
|
||||
if (!subcolumn_name.empty() && tryGetSubcolumnType(subcolumn_name))
|
||||
res.insert(subcolumn_name);
|
||||
auto name = ISerialization::getSubcolumnNameForStream(new_path);
|
||||
auto type = tryGetSubcolumnType(name);
|
||||
|
||||
/// Subcolumn names may repeat among several substream paths.
|
||||
if (!name.empty() && type && !set.count(name))
|
||||
{
|
||||
callback(name, type, substream_path);
|
||||
set.insert(name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Names(std::make_move_iterator(res.begin()), std::make_move_iterator(res.end()));
|
||||
Names IDataType::getSubcolumnNames() const
|
||||
{
|
||||
Names res;
|
||||
forEachSubcolumn([&](const auto & name, const auto &, const auto &)
|
||||
{
|
||||
res.push_back(name);
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void IDataType::insertDefaultInto(IColumn & column) const
|
||||
|
@ -80,6 +80,9 @@ public:
|
||||
virtual DataTypePtr tryGetSubcolumnType(const String & subcolumn_name) const;
|
||||
DataTypePtr getSubcolumnType(const String & subcolumn_name) const;
|
||||
virtual ColumnPtr getSubcolumn(const String & subcolumn_name, const IColumn & column) const;
|
||||
|
||||
using SubcolumnCallback = std::function<void(const String &, const DataTypePtr &, const ISerialization::SubstreamPath &)>;
|
||||
void forEachSubcolumn(const SubcolumnCallback & callback) const;
|
||||
Names getSubcolumnNames() const;
|
||||
|
||||
/// Returns default serialization of data type.
|
||||
|
@ -72,6 +72,7 @@ struct DivideIntegralImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfIntegerDivision<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
@ -126,6 +127,7 @@ struct ModuloImpl
|
||||
using IntegerBType = typename NumberTraits::ToInteger<B>::Type;
|
||||
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -15,11 +15,13 @@
|
||||
#include <DataTypes/DataTypeInterval.h>
|
||||
#include <DataTypes/DataTypeAggregateFunction.h>
|
||||
#include <DataTypes/DataTypeFixedString.h>
|
||||
#include <DataTypes/DataTypeString.h>
|
||||
#include <DataTypes/Native.h>
|
||||
#include <DataTypes/NumberTraits.h>
|
||||
#include <Columns/ColumnVector.h>
|
||||
#include <Columns/ColumnDecimal.h>
|
||||
#include <Columns/ColumnFixedString.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <Columns/ColumnConst.h>
|
||||
#include <Columns/ColumnAggregateFunction.h>
|
||||
#include "Core/DecimalFunctions.h"
|
||||
@ -192,6 +194,7 @@ struct BinaryOperation
|
||||
{
|
||||
using ResultType = OpResultType;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <OpCase op_case>
|
||||
static void NO_INLINE process(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t size)
|
||||
@ -208,6 +211,71 @@ struct BinaryOperation
|
||||
static ResultType process(A a, B b) { return Op::template apply<ResultType>(a, b); }
|
||||
};
|
||||
|
||||
template <typename B, typename Op>
|
||||
struct StringIntegerOperationImpl
|
||||
{
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = true;
|
||||
|
||||
template <OpCase op_case>
|
||||
static void NO_INLINE processFixedString(const UInt8 * __restrict in_vec, const UInt64 n, const B * __restrict b, ColumnFixedString::Chars & out_vec, size_t size)
|
||||
{
|
||||
size_t prev_offset = 0;
|
||||
out_vec.reserve(n * size);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
if constexpr (op_case == OpCase::LeftConstant)
|
||||
{
|
||||
Op::apply(&in_vec[0], &in_vec[n], b[i], out_vec);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t new_offset = prev_offset + n;
|
||||
|
||||
if constexpr (op_case == OpCase::Vector)
|
||||
{
|
||||
Op::apply(&in_vec[prev_offset], &in_vec[new_offset], b[i], out_vec);
|
||||
}
|
||||
else
|
||||
{
|
||||
Op::apply(&in_vec[prev_offset], &in_vec[new_offset], b[0], out_vec);
|
||||
}
|
||||
prev_offset = new_offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <OpCase op_case>
|
||||
static void NO_INLINE processString(const UInt8 * __restrict in_vec, const UInt64 * __restrict in_offsets, const B * __restrict b, ColumnString::Chars & out_vec, ColumnString::Offsets & out_offsets, size_t size)
|
||||
{
|
||||
size_t prev_offset = 0;
|
||||
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
if constexpr (op_case == OpCase::LeftConstant)
|
||||
{
|
||||
Op::apply(&in_vec[0], &in_vec[in_offsets[0] - 1], b[i], out_vec, out_offsets);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t new_offset = in_offsets[i];
|
||||
|
||||
if constexpr (op_case == OpCase::Vector)
|
||||
{
|
||||
Op::apply(&in_vec[prev_offset], &in_vec[new_offset - 1], b[i], out_vec, out_offsets);
|
||||
}
|
||||
else
|
||||
{
|
||||
Op::apply(&in_vec[prev_offset], &in_vec[new_offset - 1], b[0], out_vec, out_offsets);
|
||||
}
|
||||
|
||||
prev_offset = new_offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Op>
|
||||
struct FixedStringOperationImpl
|
||||
{
|
||||
@ -514,7 +582,7 @@ class FunctionBinaryArithmetic : public IFunction
|
||||
DataTypeInt8, DataTypeInt16, DataTypeInt32, DataTypeInt64, DataTypeInt128, DataTypeInt256,
|
||||
DataTypeDecimal32, DataTypeDecimal64, DataTypeDecimal128, DataTypeDecimal256,
|
||||
DataTypeDate, DataTypeDateTime,
|
||||
DataTypeFixedString>;
|
||||
DataTypeFixedString, DataTypeString>;
|
||||
|
||||
using Floats = TypeList<DataTypeFloat32, DataTypeFloat64>;
|
||||
|
||||
@ -953,19 +1021,33 @@ public:
|
||||
using LeftDataType = std::decay_t<decltype(left)>;
|
||||
using RightDataType = std::decay_t<decltype(right)>;
|
||||
|
||||
if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType> ||
|
||||
std::is_same_v<DataTypeFixedString, RightDataType>)
|
||||
if constexpr ((std::is_same_v<DataTypeFixedString, LeftDataType> || std::is_same_v<DataTypeString, LeftDataType>) ||
|
||||
(std::is_same_v<DataTypeFixedString, RightDataType> || std::is_same_v<DataTypeString, RightDataType>))
|
||||
{
|
||||
if constexpr (!Op<DataTypeFixedString, DataTypeFixedString>::allow_fixed_string)
|
||||
return false;
|
||||
else if constexpr (std::is_same_v<LeftDataType, RightDataType>)
|
||||
if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType> &&
|
||||
std::is_same_v<DataTypeFixedString, RightDataType>)
|
||||
{
|
||||
if (left.getN() == right.getN())
|
||||
if constexpr (!Op<DataTypeFixedString, DataTypeFixedString>::allow_fixed_string)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
type_res = std::make_shared<LeftDataType>(left.getN());
|
||||
return true;
|
||||
if (left.getN() == right.getN())
|
||||
{
|
||||
type_res = std::make_shared<LeftDataType>(left.getN());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (!Op<LeftDataType, RightDataType>::allow_string_integer)
|
||||
return false;
|
||||
else if constexpr (!IsIntegral<RightDataType>)
|
||||
return false;
|
||||
else if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType>)
|
||||
type_res = std::make_shared<LeftDataType>(left.getN());
|
||||
else
|
||||
type_res = std::make_shared<DataTypeString>();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1102,6 +1184,106 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
template <typename LeftColumnType, typename A, typename B>
|
||||
ColumnPtr executeStringInteger(const ColumnsWithTypeAndName & arguments, const A & left, const B & right) const
|
||||
{
|
||||
using LeftDataType = std::decay_t<decltype(left)>;
|
||||
using RightDataType = std::decay_t<decltype(right)>;
|
||||
|
||||
const auto * const col_left_raw = arguments[0].column.get();
|
||||
const auto * const col_right_raw = arguments[1].column.get();
|
||||
using T1 = typename RightDataType::FieldType;
|
||||
|
||||
using ColVecT1 = ColumnVector<T1>;
|
||||
const ColVecT1 * const col_right = checkAndGetColumn<ColVecT1>(col_right_raw);
|
||||
const ColumnConst * const col_right_const = checkAndGetColumnConst<ColVecT1>(col_right_raw);
|
||||
|
||||
using OpImpl = StringIntegerOperationImpl<T1, Op<LeftDataType, T1>>;
|
||||
|
||||
const ColumnConst * const col_left_const = checkAndGetColumnConst<LeftColumnType>(col_left_raw);
|
||||
|
||||
const auto * col_left = col_left_const ? checkAndGetColumn<LeftColumnType>(col_left_const->getDataColumn())
|
||||
: checkAndGetColumn<LeftColumnType>(col_left_raw);
|
||||
|
||||
if (!col_left)
|
||||
return nullptr;
|
||||
|
||||
const typename LeftColumnType::Chars & in_vec = col_left->getChars();
|
||||
|
||||
typename LeftColumnType::MutablePtr col_res;
|
||||
if constexpr (std::is_same_v<LeftDataType, DataTypeFixedString>)
|
||||
col_res = LeftColumnType::create(col_left->getN());
|
||||
else
|
||||
col_res = LeftColumnType::create();
|
||||
|
||||
typename LeftColumnType::Chars & out_vec = col_res->getChars();
|
||||
|
||||
if (col_left_const && col_right_const)
|
||||
{
|
||||
const T1 value = col_right_const->template getValue<T1>();
|
||||
if constexpr (std::is_same_v<LeftDataType, DataTypeFixedString>)
|
||||
{
|
||||
OpImpl::template processFixedString<OpCase::Vector>(in_vec.data(), col_left->getN(), &value, out_vec, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColumnString::Offsets & out_offsets = col_res->getOffsets();
|
||||
OpImpl::template processString<OpCase::Vector>(in_vec.data(), col_left->getOffsets().data(), &value, out_vec, out_offsets, 1);
|
||||
}
|
||||
|
||||
return ColumnConst::create(std::move(col_res), col_left->size());
|
||||
}
|
||||
else if (!col_left_const && !col_right_const && col_right)
|
||||
{
|
||||
if constexpr (std::is_same_v<LeftDataType, DataTypeFixedString>)
|
||||
{
|
||||
OpImpl::template processFixedString<OpCase::Vector>(in_vec.data(), col_left->getN(), col_right->getData().data(), out_vec, col_left->size());
|
||||
}
|
||||
else
|
||||
{
|
||||
ColumnString::Offsets & out_offsets = col_res->getOffsets();
|
||||
out_offsets.reserve(col_left->size());
|
||||
OpImpl::template processString<OpCase::Vector>(
|
||||
in_vec.data(), col_left->getOffsets().data(), col_right->getData().data(), out_vec, out_offsets, col_left->size());
|
||||
}
|
||||
}
|
||||
else if (col_left_const && col_right)
|
||||
{
|
||||
if constexpr (std::is_same_v<LeftDataType, DataTypeFixedString>)
|
||||
{
|
||||
OpImpl::template processFixedString<OpCase::LeftConstant>(
|
||||
in_vec.data(), col_left->getN(), col_right->getData().data(), out_vec, col_right->size());
|
||||
}
|
||||
else
|
||||
{
|
||||
ColumnString::Offsets & out_offsets = col_res->getOffsets();
|
||||
out_offsets.reserve(col_right->size());
|
||||
OpImpl::template processString<OpCase::LeftConstant>(
|
||||
in_vec.data(), col_left->getOffsets().data(), col_right->getData().data(), out_vec, out_offsets, col_right->size());
|
||||
}
|
||||
}
|
||||
else if (col_right_const)
|
||||
{
|
||||
const T1 value = col_right_const->template getValue<T1>();
|
||||
if constexpr (std::is_same_v<LeftDataType, DataTypeFixedString>)
|
||||
{
|
||||
OpImpl::template processFixedString<OpCase::RightConstant>(in_vec.data(), col_left->getN(), &value, out_vec, col_left->size());
|
||||
}
|
||||
else
|
||||
{
|
||||
ColumnString::Offsets & out_offsets = col_res->getOffsets();
|
||||
out_offsets.reserve(col_left->size());
|
||||
OpImpl::template processString<OpCase::RightConstant>(
|
||||
in_vec.data(), col_left->getOffsets().data(), &value, out_vec, out_offsets, col_left->size());
|
||||
}
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
return col_res;
|
||||
}
|
||||
|
||||
template <typename A, typename B>
|
||||
ColumnPtr executeNumeric(const ColumnsWithTypeAndName & arguments, const A & left, const B & right) const
|
||||
{
|
||||
@ -1228,13 +1410,28 @@ public:
|
||||
using LeftDataType = std::decay_t<decltype(left)>;
|
||||
using RightDataType = std::decay_t<decltype(right)>;
|
||||
|
||||
if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType> ||
|
||||
std::is_same_v<DataTypeFixedString, RightDataType>)
|
||||
if constexpr ((std::is_same_v<DataTypeFixedString, LeftDataType> || std::is_same_v<DataTypeString, LeftDataType>) ||
|
||||
(std::is_same_v<DataTypeFixedString, RightDataType> || std::is_same_v<DataTypeString, RightDataType>))
|
||||
{
|
||||
if constexpr (!Op<DataTypeFixedString, DataTypeFixedString>::allow_fixed_string)
|
||||
if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType> &&
|
||||
std::is_same_v<DataTypeFixedString, RightDataType>)
|
||||
{
|
||||
if constexpr (!Op<DataTypeFixedString, DataTypeFixedString>::allow_fixed_string)
|
||||
return false;
|
||||
else
|
||||
return (res = executeFixedString(arguments)) != nullptr;
|
||||
}
|
||||
|
||||
if constexpr (!Op<LeftDataType, RightDataType>::allow_string_integer)
|
||||
return false;
|
||||
else
|
||||
return (res = executeFixedString(arguments)) != nullptr;
|
||||
else if constexpr (!IsIntegral<RightDataType>)
|
||||
return false;
|
||||
else if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType>)
|
||||
{
|
||||
return (res = executeStringInteger<ColumnFixedString>(arguments, left, right)) != nullptr;
|
||||
}
|
||||
else if constexpr (std::is_same_v<DataTypeString, LeftDataType>)
|
||||
return (res = executeStringInteger<ColumnString>(arguments, left, right)) != nullptr;
|
||||
}
|
||||
else
|
||||
return (res = executeNumeric(arguments, left, right)) != nullptr;
|
||||
@ -1264,7 +1461,7 @@ public:
|
||||
{
|
||||
using LeftDataType = std::decay_t<decltype(left)>;
|
||||
using RightDataType = std::decay_t<decltype(right)>;
|
||||
if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType> || std::is_same_v<DataTypeFixedString, RightDataType>)
|
||||
if constexpr (std::is_same_v<DataTypeFixedString, LeftDataType> || std::is_same_v<DataTypeFixedString, RightDataType> || std::is_same_v<DataTypeString, LeftDataType> || std::is_same_v<DataTypeString, RightDataType>)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
@ -1284,7 +1481,7 @@ public:
|
||||
{
|
||||
using LeftDataType = std::decay_t<decltype(left)>;
|
||||
using RightDataType = std::decay_t<decltype(right)>;
|
||||
if constexpr (!std::is_same_v<DataTypeFixedString, LeftDataType> && !std::is_same_v<DataTypeFixedString, RightDataType>)
|
||||
if constexpr (!std::is_same_v<DataTypeFixedString, LeftDataType> && !std::is_same_v<DataTypeFixedString, RightDataType> && !std::is_same_v<DataTypeString, LeftDataType> && !std::is_same_v<DataTypeString, RightDataType>)
|
||||
{
|
||||
using ResultDataType = typename BinaryOperationTraits<Op, LeftDataType, RightDataType>::ResultDataType;
|
||||
using OpSpec = Op<typename LeftDataType::FieldType, typename RightDataType::FieldType>;
|
||||
|
@ -25,6 +25,7 @@ struct GCDLCMImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfAdditionMultiplication<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -11,6 +11,7 @@ struct AbsImpl
|
||||
{
|
||||
using ResultType = std::conditional_t<is_decimal<A>, A, typename NumberTraits::ResultOfAbs<A>::Type>;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline NO_SANITIZE_UNDEFINED ResultType apply(A a)
|
||||
{
|
||||
|
@ -17,6 +17,7 @@ struct BitAndImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
|
||||
static constexpr const bool allow_fixed_string = true;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -22,6 +22,7 @@ struct BitBoolMaskAndImpl
|
||||
{
|
||||
using ResultType = UInt8;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply([[maybe_unused]] A left, [[maybe_unused]] B right)
|
||||
|
@ -22,6 +22,7 @@ struct BitBoolMaskOrImpl
|
||||
{
|
||||
using ResultType = UInt8;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply([[maybe_unused]] A left, [[maybe_unused]] B right)
|
||||
|
@ -14,6 +14,7 @@ struct BitCountImpl
|
||||
{
|
||||
using ResultType = UInt8;
|
||||
static constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType apply(A a)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ struct BitNotImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBitNot<A>::Type;
|
||||
static const constexpr bool allow_fixed_string = true;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType apply(A a)
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ struct BitOrImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
|
||||
static constexpr const bool allow_fixed_string = true;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -17,6 +17,7 @@ struct BitRotateLeftImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||
|
@ -17,6 +17,7 @@ struct BitRotateRightImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||
|
@ -17,6 +17,7 @@ struct BitShiftLeftImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = true;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||
@ -29,6 +30,118 @@ struct BitShiftLeftImpl
|
||||
return static_cast<Result>(a) << static_cast<Result>(b);
|
||||
}
|
||||
|
||||
/// For String
|
||||
static ALWAYS_INLINE NO_SANITIZE_UNDEFINED void apply(const UInt8 * pos [[maybe_unused]], const UInt8 * end [[maybe_unused]], const B & b [[maybe_unused]], ColumnString::Chars & out_vec, ColumnString::Offsets & out_offsets)
|
||||
{
|
||||
if constexpr (is_big_int_v<B>)
|
||||
throw Exception("BitShiftLeft is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
||||
else
|
||||
{
|
||||
UInt8 word_size = 8;
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(end - pos) * word_size) || b < 0)
|
||||
{
|
||||
// insert default value
|
||||
out_vec.push_back(0);
|
||||
out_offsets.push_back(out_offsets.back() + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t shift_left_bits = b % word_size;
|
||||
size_t shift_left_bytes = b / word_size;
|
||||
|
||||
const UInt8 * begin = pos;
|
||||
|
||||
const size_t old_size = out_vec.size();
|
||||
size_t length;
|
||||
if (shift_left_bits)
|
||||
length = end + shift_left_bytes - begin + 1; /// Moving to the left here will make a redundant byte to store the overflowing bits in the front
|
||||
else
|
||||
length = end + shift_left_bytes - begin;
|
||||
|
||||
const size_t new_size = old_size + length + 1;
|
||||
out_vec.resize(new_size);
|
||||
out_vec[old_size + length] = 0;
|
||||
|
||||
UInt8 * op_pointer = const_cast<UInt8 *>(begin);
|
||||
UInt8 * out = out_vec.data() + old_size;
|
||||
|
||||
UInt8 previous = 0;
|
||||
while (op_pointer < end)
|
||||
{
|
||||
if (shift_left_bits)
|
||||
{
|
||||
/// The left b bit of the right byte is moved to the right b bit of this byte
|
||||
*out = UInt8(UInt8(*(op_pointer) >> (8 - shift_left_bits)) | previous);
|
||||
previous = *op_pointer << shift_left_bits;
|
||||
}
|
||||
else
|
||||
{
|
||||
*out = *op_pointer;
|
||||
}
|
||||
op_pointer++;
|
||||
out++;
|
||||
}
|
||||
if (shift_left_bits)
|
||||
{
|
||||
*out = *(op_pointer - 1) << shift_left_bits;
|
||||
out++;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < shift_left_bytes; ++i)
|
||||
*(out + i) = 0;
|
||||
|
||||
out_offsets.push_back(new_size);
|
||||
}
|
||||
}
|
||||
|
||||
/// For FixedString
|
||||
static ALWAYS_INLINE NO_SANITIZE_UNDEFINED void apply(const UInt8 * pos [[maybe_unused]], const UInt8 * end [[maybe_unused]], const B & b [[maybe_unused]], ColumnFixedString::Chars & out_vec)
|
||||
{
|
||||
if constexpr (is_big_int_v<B>)
|
||||
throw Exception("BitShiftLeft is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
||||
else
|
||||
{
|
||||
UInt8 word_size = 8;
|
||||
size_t n = end - pos;
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(n) * word_size) || b < 0)
|
||||
{
|
||||
// insert default value
|
||||
out_vec.resize_fill(out_vec.size() + n);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t shift_left_bytes = b / word_size;
|
||||
size_t shift_left_bits = b % word_size;
|
||||
|
||||
const UInt8 * begin = pos;
|
||||
|
||||
const size_t old_size = out_vec.size();
|
||||
const size_t new_size = old_size + n;
|
||||
|
||||
out_vec.resize(new_size);
|
||||
|
||||
UInt8 * op_pointer = const_cast<UInt8 *>(begin + shift_left_bytes);
|
||||
UInt8 * out = out_vec.data() + old_size;
|
||||
|
||||
while (op_pointer < end)
|
||||
{
|
||||
*out = *op_pointer << shift_left_bits;
|
||||
if (op_pointer + 1 < end)
|
||||
{
|
||||
/// The left b bit of the right byte is moved to the right b bit of this byte
|
||||
*out = UInt8(UInt8(*(op_pointer + 1) >> (8 - shift_left_bits)) | *out);
|
||||
}
|
||||
op_pointer++;
|
||||
out++;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < shift_left_bytes; ++i)
|
||||
*(out + i) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
static constexpr bool compilable = true;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <Functions/FunctionFactory.h>
|
||||
#include <Functions/FunctionBinaryArithmetic.h>
|
||||
#include <Common/hex.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -17,6 +18,7 @@ struct BitShiftRightImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = true;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||
@ -29,6 +31,95 @@ struct BitShiftRightImpl
|
||||
return static_cast<Result>(a) >> static_cast<Result>(b);
|
||||
}
|
||||
|
||||
static inline NO_SANITIZE_UNDEFINED void bitShiftRightForBytes(const UInt8 * op_pointer, const UInt8 * begin, UInt8 * out, const size_t shift_right_bits)
|
||||
{
|
||||
while (op_pointer > begin)
|
||||
{
|
||||
op_pointer--;
|
||||
out--;
|
||||
*out = *op_pointer >> shift_right_bits;
|
||||
if (op_pointer - 1 >= begin)
|
||||
{
|
||||
/// The right b bit of the left byte is moved to the left b bit of this byte
|
||||
*out = UInt8(UInt8(*(op_pointer - 1) << (8 - shift_right_bits)) | *out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// For String
|
||||
static ALWAYS_INLINE NO_SANITIZE_UNDEFINED void apply(const UInt8 * pos [[maybe_unused]], const UInt8 * end [[maybe_unused]], const B & b [[maybe_unused]], ColumnString::Chars & out_vec, ColumnString::Offsets & out_offsets)
|
||||
{
|
||||
if constexpr (is_big_int_v<B>)
|
||||
throw Exception("BitShiftRight is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
||||
else
|
||||
{
|
||||
UInt8 word_size = 8;
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(end - pos) * word_size) || b < 0)
|
||||
{
|
||||
/// insert default value
|
||||
out_vec.push_back(0);
|
||||
out_offsets.push_back(out_offsets.back() + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t shift_right_bytes = b / word_size;
|
||||
size_t shift_right_bits = b % word_size;
|
||||
|
||||
const UInt8 * begin = pos;
|
||||
const UInt8 * shift_right_end = end - shift_right_bytes;
|
||||
|
||||
const size_t old_size = out_vec.size();
|
||||
size_t length = shift_right_end - begin;
|
||||
const size_t new_size = old_size + length + 1;
|
||||
out_vec.resize(new_size);
|
||||
out_vec[old_size + length] = 0;
|
||||
|
||||
/// We start from the byte on the right and shift right shift_right_bits bit by byte
|
||||
UInt8 * op_pointer = const_cast<UInt8 *>(shift_right_end);
|
||||
UInt8 * out = out_vec.data() + old_size + length;
|
||||
bitShiftRightForBytes(op_pointer, begin, out, shift_right_bits);
|
||||
out_offsets.push_back(new_size);
|
||||
}
|
||||
}
|
||||
|
||||
/// For FixedString
|
||||
static ALWAYS_INLINE NO_SANITIZE_UNDEFINED void apply(const UInt8 * pos [[maybe_unused]], const UInt8 * end [[maybe_unused]], const B & b [[maybe_unused]], ColumnFixedString::Chars & out_vec)
|
||||
{
|
||||
if constexpr (is_big_int_v<B>)
|
||||
throw Exception("BitShiftRight is not implemented for big integers as second argument", ErrorCodes::NOT_IMPLEMENTED);
|
||||
else
|
||||
{
|
||||
UInt8 word_size = 8;
|
||||
size_t n = end - pos;
|
||||
/// To prevent overflow
|
||||
if (static_cast<double>(b) >= (static_cast<double>(n) * word_size) || b < 0)
|
||||
{
|
||||
// insert default value
|
||||
out_vec.resize_fill(out_vec.size() + n);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t shift_right_bytes = b / word_size;
|
||||
size_t shift_right_bits = b % word_size;
|
||||
|
||||
const UInt8 * begin = pos;
|
||||
const UInt8 * shift_right_end = end - shift_right_bytes;
|
||||
|
||||
const size_t old_size = out_vec.size();
|
||||
const size_t new_size = old_size + n;
|
||||
|
||||
/// Fill 0 to the left
|
||||
out_vec.resize_fill(out_vec.size() + old_size + shift_right_bytes);
|
||||
out_vec.resize(new_size);
|
||||
|
||||
/// We start from the byte on the right and shift right shift_right_bits bit by byte
|
||||
UInt8 * op_pointer = const_cast<UInt8 *>(shift_right_end);
|
||||
UInt8 * out = out_vec.data() + new_size;
|
||||
bitShiftRightForBytes(op_pointer, begin, out, shift_right_bits);
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
static constexpr bool compilable = true;
|
||||
|
||||
@ -41,6 +132,7 @@ struct BitShiftRightImpl
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct NameBitShiftRight { static constexpr auto name = "bitShiftRight"; };
|
||||
using FunctionBitShiftRight = BinaryArithmeticOverloadResolver<BitShiftRightImpl, NameBitShiftRight, true, false>;
|
||||
|
||||
|
@ -20,6 +20,7 @@ struct BitSwapLastTwoImpl
|
||||
{
|
||||
using ResultType = UInt8;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType NO_SANITIZE_UNDEFINED apply([[maybe_unused]] A a)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ struct BitTestImpl
|
||||
{
|
||||
using ResultType = UInt8;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
NO_SANITIZE_UNDEFINED static inline Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||
|
@ -20,6 +20,7 @@ struct BitWrapperFuncImpl
|
||||
{
|
||||
using ResultType = UInt8;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType NO_SANITIZE_UNDEFINED apply(A a [[maybe_unused]])
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ struct BitXorImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfBit<A, B>::Type;
|
||||
static constexpr bool allow_fixed_string = true;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -13,6 +13,7 @@ struct DivideFloatingImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfFloatingPointDivision<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||
|
@ -12,6 +12,7 @@ struct GreatestBaseImpl
|
||||
{
|
||||
using ResultType = NumberTraits::ResultOfGreatest<A, B>;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
@ -42,6 +43,7 @@ struct GreatestSpecialImpl
|
||||
{
|
||||
using ResultType = make_unsigned_t<A>;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -23,6 +23,7 @@ struct DivideIntegralByConstantImpl
|
||||
using Op = DivideIntegralImpl<A, B>;
|
||||
using ResultType = typename Op::ResultType;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <OpCase op_case>
|
||||
static void NO_INLINE process(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t size)
|
||||
|
@ -10,6 +10,7 @@ struct DivideIntegralOrZeroImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfIntegerDivision<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -18,6 +18,7 @@ struct IntExp10Impl
|
||||
{
|
||||
using ResultType = UInt64;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType apply([[maybe_unused]] A a)
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ struct IntExp2Impl
|
||||
{
|
||||
using ResultType = UInt64;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType apply([[maybe_unused]] A a)
|
||||
{
|
||||
|
@ -12,6 +12,7 @@ struct LeastBaseImpl
|
||||
{
|
||||
using ResultType = NumberTraits::ResultOfLeast<A, B>;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
@ -42,6 +43,7 @@ struct LeastSpecialImpl
|
||||
{
|
||||
using ResultType = std::make_signed_t<A>;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -10,6 +10,7 @@ struct MinusImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfSubtraction<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a, B b)
|
||||
|
@ -27,6 +27,7 @@ struct ModuloByConstantImpl
|
||||
using Op = ModuloImpl<A, B>;
|
||||
using ResultType = typename Op::ResultType;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <OpCase op_case>
|
||||
static void NO_INLINE process(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t size)
|
||||
|
@ -12,6 +12,7 @@ struct ModuloOrZeroImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfModulo<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline Result apply(A a, B b)
|
||||
|
@ -11,6 +11,7 @@ struct MultiplyImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfAdditionMultiplication<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a, B b)
|
||||
|
@ -10,6 +10,7 @@ struct NegateImpl
|
||||
{
|
||||
using ResultType = std::conditional_t<is_decimal<A>, A, typename NumberTraits::ResultOfNegate<A>::Type>;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline NO_SANITIZE_UNDEFINED ResultType apply(A a)
|
||||
{
|
||||
|
@ -10,6 +10,7 @@ struct PlusImpl
|
||||
{
|
||||
using ResultType = typename NumberTraits::ResultOfAdditionMultiplication<A, B>::Type;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
static const constexpr bool is_commutative = true;
|
||||
|
||||
template <typename Result = ResultType>
|
||||
|
@ -11,6 +11,7 @@ struct RoundAgeImpl
|
||||
{
|
||||
using ResultType = UInt8;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType apply(A x)
|
||||
{
|
||||
|
@ -11,6 +11,7 @@ struct RoundDurationImpl
|
||||
{
|
||||
using ResultType = UInt16;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline ResultType apply(A x)
|
||||
{
|
||||
|
@ -64,6 +64,7 @@ struct RoundToExp2Impl
|
||||
{
|
||||
using ResultType = T;
|
||||
static constexpr const bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline T apply(T x)
|
||||
{
|
||||
|
@ -10,6 +10,7 @@ struct SignImpl
|
||||
{
|
||||
using ResultType = Int8;
|
||||
static const constexpr bool allow_fixed_string = false;
|
||||
static const constexpr bool allow_string_integer = false;
|
||||
|
||||
static inline NO_SANITIZE_UNDEFINED ResultType apply(A a)
|
||||
{
|
||||
|
@ -61,7 +61,6 @@ SRCS(
|
||||
ReadBufferFromMemory.cpp
|
||||
ReadBufferFromPocoSocket.cpp
|
||||
ReadHelpers.cpp
|
||||
ReadSettings.cpp
|
||||
SeekAvoidingReadBuffer.cpp
|
||||
SynchronousReader.cpp
|
||||
ThreadPoolReader.cpp
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <Interpreters/RequiredSourceColumnsVisitor.h>
|
||||
#include <Interpreters/addTypeConversionToAST.h>
|
||||
#include <Parsers/ASTTablesInSelectQuery.h>
|
||||
#include <Parsers/ASTSelectWithUnionQuery.h>
|
||||
#include <Parsers/ASTSelectQuery.h>
|
||||
#include <Parsers/ASTSubquery.h>
|
||||
#include <Parsers/ASTAlterQuery.h>
|
||||
@ -14,8 +13,11 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
bool ColumnAliasesMatcher::needChildVisit(const ASTPtr & node, const ASTPtr &)
|
||||
bool ColumnAliasesMatcher::needChildVisit(const ASTPtr & node, const ASTPtr &, const Data & data)
|
||||
{
|
||||
if (data.excluded_nodes.contains(node.get()))
|
||||
return false;
|
||||
|
||||
if (const auto * f = node->as<ASTFunction>())
|
||||
{
|
||||
/// "lambda" visits children itself.
|
||||
|
@ -46,7 +46,7 @@ using DataTypePtr = std::shared_ptr<const IDataType>;
|
||||
class ColumnAliasesMatcher
|
||||
{
|
||||
public:
|
||||
using Visitor = InDepthNodeVisitor<ColumnAliasesMatcher, false>;
|
||||
using Visitor = InDepthNodeVisitor<ColumnAliasesMatcher, false, true>;
|
||||
|
||||
struct Data
|
||||
{
|
||||
@ -57,14 +57,16 @@ public:
|
||||
NameSet array_join_source_columns;
|
||||
ContextPtr context;
|
||||
|
||||
const std::unordered_set<IAST *> & excluded_nodes;
|
||||
|
||||
/// private_aliases are from lambda, so these are local names.
|
||||
NameSet private_aliases;
|
||||
|
||||
/// Check if query is changed by this visitor.
|
||||
bool changed = false;
|
||||
|
||||
Data(const ColumnsDescription & columns_, const NameToNameMap & array_join_result_columns_, ContextPtr context_)
|
||||
: columns(columns_), context(context_)
|
||||
Data(const ColumnsDescription & columns_, const NameToNameMap & array_join_result_columns_, ContextPtr context_, const std::unordered_set<IAST *> & excluded_nodes_)
|
||||
: columns(columns_), context(context_), excluded_nodes(excluded_nodes_)
|
||||
{
|
||||
for (const auto & [result, source] : array_join_result_columns_)
|
||||
{
|
||||
@ -75,7 +77,7 @@ public:
|
||||
};
|
||||
|
||||
static void visit(ASTPtr & ast, Data & data);
|
||||
static bool needChildVisit(const ASTPtr & node, const ASTPtr & child);
|
||||
static bool needChildVisit(const ASTPtr & node, const ASTPtr & child, const Data & data);
|
||||
|
||||
private:
|
||||
static void visit(ASTIdentifier & node, ASTPtr & ast, Data & data);
|
||||
|
@ -164,7 +164,7 @@ public:
|
||||
return table_out;
|
||||
});
|
||||
auto executor = io.pipeline.execute();
|
||||
executor->execute(io.pipeline.getNumStreams());
|
||||
executor->execute(io.pipeline.getNumThreads());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1095,7 +1095,7 @@ IColumn::Filter dictionaryJoinRightColumns(const TableJoin & table_join, AddedCo
|
||||
std::move(key_getter), nullptr, added_columns, null_map, flags);
|
||||
}
|
||||
|
||||
throw Exception("Logical error: wrong JOIN combination", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: {} {}", STRICTNESS, KIND);
|
||||
}
|
||||
|
||||
} /// nameless
|
||||
@ -1414,13 +1414,13 @@ void HashJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed)
|
||||
joinBlockImpl<Kind::Left, Strictness::Anti>(block, key_names_left, sample_block_with_columns_to_add, map);
|
||||
break;
|
||||
default:
|
||||
throw Exception("Logical error: wrong JOIN combination", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: dictionary + {} {}", strictness, kind);
|
||||
}
|
||||
}
|
||||
else if (kind == Kind::Inner && strictness == Strictness::All)
|
||||
joinBlockImpl<Kind::Left, Strictness::Semi>(block, key_names_left, sample_block_with_columns_to_add, map);
|
||||
else
|
||||
throw Exception("Logical error: wrong JOIN combination", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: dictionary + {} {}", strictness, kind);
|
||||
}
|
||||
else if (joinDispatch(kind, strictness, data->maps, [&](auto kind_, auto strictness_, auto & map)
|
||||
{
|
||||
@ -1432,7 +1432,7 @@ void HashJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed)
|
||||
else if (kind == ASTTableJoin::Kind::Cross)
|
||||
joinBlockImplCross(block, not_processed);
|
||||
else
|
||||
throw Exception("Logical error: unknown combination of JOIN", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Wrong JOIN combination: {} {}", strictness, kind);
|
||||
}
|
||||
|
||||
template <typename Mapped>
|
||||
@ -1494,7 +1494,7 @@ public:
|
||||
};
|
||||
|
||||
if (!joinDispatch(parent.kind, parent.strictness, parent.data->maps, fill_callback))
|
||||
throw Exception("Logical error: unknown JOIN strictness (must be on of: ANY, ALL, ASOF)", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unknown JOIN strictness '{}' (must be on of: ANY, ALL, ASOF)", parent.strictness);
|
||||
|
||||
fillNullsFromBlocks(columns_right, rows_added);
|
||||
return rows_added;
|
||||
|
@ -10,7 +10,7 @@ namespace DB
|
||||
|
||||
/// Visits AST tree in depth, call functions for nodes according to Matcher type data.
|
||||
/// You need to define Data, visit() and needChildVisit() in Matcher class.
|
||||
template <typename Matcher, bool _top_to_bottom, typename T = ASTPtr>
|
||||
template <typename Matcher, bool _top_to_bottom, bool need_child_accept_data = false, typename T = ASTPtr>
|
||||
class InDepthNodeVisitor
|
||||
{
|
||||
public:
|
||||
@ -51,13 +51,21 @@ private:
|
||||
void visitChildren(T & ast)
|
||||
{
|
||||
for (auto & child : ast->children)
|
||||
if (Matcher::needChildVisit(ast, child))
|
||||
{
|
||||
bool need_visit_child = false;
|
||||
if constexpr (need_child_accept_data)
|
||||
need_visit_child = Matcher::needChildVisit(ast, child, data);
|
||||
else
|
||||
need_visit_child = Matcher::needChildVisit(ast, child);
|
||||
|
||||
if (need_visit_child)
|
||||
visit(child);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Matcher, bool top_to_bottom>
|
||||
using ConstInDepthNodeVisitor = InDepthNodeVisitor<Matcher, top_to_bottom, const ASTPtr>;
|
||||
template <typename Matcher, bool top_to_bottom, bool need_child_accept_data = false>
|
||||
using ConstInDepthNodeVisitor = InDepthNodeVisitor<Matcher, top_to_bottom, need_child_accept_data, const ASTPtr>;
|
||||
|
||||
struct NeedChild
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <Storages/IStorage.h>
|
||||
#include <DataStreams/OneBlockInputStream.h>
|
||||
#include <DataStreams/BlockIO.h>
|
||||
#include <DataTypes/DataTypeString.h>
|
||||
#include <Parsers/queryToString.h>
|
||||
@ -15,20 +14,14 @@
|
||||
#include <Parsers/ASTFunction.h>
|
||||
#include <Parsers/ASTTablesInSelectQuery.h>
|
||||
#include <Parsers/TablePropertiesQueriesASTs.h>
|
||||
#include <DataTypes/NestedUtils.h>
|
||||
#include <Processors/Sources/SourceFromSingleChunk.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
BlockIO InterpreterDescribeQuery::execute()
|
||||
{
|
||||
BlockIO res;
|
||||
res.in = executeImpl();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Block InterpreterDescribeQuery::getSampleBlock()
|
||||
Block InterpreterDescribeQuery::getSampleBlock(bool include_subcolumns)
|
||||
{
|
||||
Block block;
|
||||
|
||||
@ -56,11 +49,19 @@ Block InterpreterDescribeQuery::getSampleBlock()
|
||||
col.name = "ttl_expression";
|
||||
block.insert(col);
|
||||
|
||||
if (include_subcolumns)
|
||||
{
|
||||
col.name = "is_subcolumn";
|
||||
col.type = std::make_shared<DataTypeUInt8>();
|
||||
col.column = col.type->createColumn();
|
||||
block.insert(col);
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
BlockInputStreamPtr InterpreterDescribeQuery::executeImpl()
|
||||
BlockIO InterpreterDescribeQuery::execute()
|
||||
{
|
||||
ColumnsDescription columns;
|
||||
|
||||
@ -87,7 +88,8 @@ BlockInputStreamPtr InterpreterDescribeQuery::executeImpl()
|
||||
columns = metadata_snapshot->getColumns();
|
||||
}
|
||||
|
||||
Block sample_block = getSampleBlock();
|
||||
bool include_subcolumns = getContext()->getSettingsRef().describe_include_subcolumns;
|
||||
Block sample_block = getSampleBlock(include_subcolumns);
|
||||
MutableColumns res_columns = sample_block.cloneEmptyColumns();
|
||||
|
||||
for (const auto & column : columns)
|
||||
@ -117,9 +119,47 @@ BlockInputStreamPtr InterpreterDescribeQuery::executeImpl()
|
||||
res_columns[6]->insert(queryToString(column.ttl));
|
||||
else
|
||||
res_columns[6]->insertDefault();
|
||||
|
||||
if (include_subcolumns)
|
||||
res_columns[7]->insertDefault();
|
||||
}
|
||||
|
||||
return std::make_shared<OneBlockInputStream>(sample_block.cloneWithColumns(std::move(res_columns)));
|
||||
if (include_subcolumns)
|
||||
{
|
||||
for (const auto & column : columns)
|
||||
{
|
||||
column.type->forEachSubcolumn([&](const auto & name, const auto & type, const auto & path)
|
||||
{
|
||||
res_columns[0]->insert(Nested::concatenateName(column.name, name));
|
||||
res_columns[1]->insert(type->getName());
|
||||
|
||||
/// It's not trivial to calculate default expression for subcolumn.
|
||||
/// So, leave it empty.
|
||||
res_columns[2]->insertDefault();
|
||||
res_columns[3]->insertDefault();
|
||||
res_columns[4]->insert(column.comment);
|
||||
|
||||
if (column.codec && ISerialization::isSpecialCompressionAllowed(path))
|
||||
res_columns[5]->insert(queryToString(column.codec->as<ASTFunction>()->arguments));
|
||||
else
|
||||
res_columns[5]->insertDefault();
|
||||
|
||||
if (column.ttl)
|
||||
res_columns[6]->insert(queryToString(column.ttl));
|
||||
else
|
||||
res_columns[6]->insertDefault();
|
||||
|
||||
res_columns[7]->insert(1u);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
BlockIO res;
|
||||
size_t num_rows = res_columns[0]->size();
|
||||
auto source = std::make_shared<SourceFromSingleChunk>(sample_block, Chunk(std::move(res_columns), num_rows));
|
||||
res.pipeline.init(Pipe(std::move(source)));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,12 +16,10 @@ public:
|
||||
|
||||
BlockIO execute() override;
|
||||
|
||||
static Block getSampleBlock();
|
||||
static Block getSampleBlock(bool include_subcolumns);
|
||||
|
||||
private:
|
||||
ASTPtr query_ptr;
|
||||
|
||||
BlockInputStreamPtr executeImpl();
|
||||
};
|
||||
|
||||
|
||||
|
@ -339,8 +339,16 @@ static std::optional<String> getDictKeyName(const String & dict_name , ContextPt
|
||||
|
||||
bool TableJoin::tryInitDictJoin(const Block & sample_block, ContextPtr context)
|
||||
{
|
||||
using Strictness = ASTTableJoin::Strictness;
|
||||
|
||||
bool allowed_inner = isInner(kind()) && strictness() == Strictness::All;
|
||||
bool allowed_left = isLeft(kind()) && (strictness() == Strictness::Any ||
|
||||
strictness() == Strictness::All ||
|
||||
strictness() == Strictness::Semi ||
|
||||
strictness() == Strictness::Anti);
|
||||
|
||||
/// Support ALL INNER, [ANY | ALL | SEMI | ANTI] LEFT
|
||||
if (!isLeft(kind()) && !(isInner(kind()) && strictness() == ASTTableJoin::Strictness::All))
|
||||
if (!allowed_inner && !allowed_left)
|
||||
return false;
|
||||
|
||||
const Names & right_keys = keyNamesRight();
|
||||
|
@ -951,16 +951,9 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
|
||||
setJoinStrictness(
|
||||
*select_query, settings.join_default_strictness, settings.any_join_distinct_right_table_keys, result.analyzed_join->table_join);
|
||||
|
||||
if (const auto * join_ast = select_query->join(); join_ast && tables_with_columns.size() >= 2)
|
||||
{
|
||||
auto & table_join_ast = join_ast->table_join->as<ASTTableJoin &>();
|
||||
if (table_join_ast.using_expression_list && result.metadata_snapshot)
|
||||
replaceAliasColumnsInQuery(table_join_ast.using_expression_list, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext());
|
||||
if (table_join_ast.on_expression && result.metadata_snapshot)
|
||||
replaceAliasColumnsInQuery(table_join_ast.on_expression, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext());
|
||||
|
||||
collectJoinedColumns(*result.analyzed_join, table_join_ast, tables_with_columns, result.aliases);
|
||||
}
|
||||
auto * table_join_ast = select_query->join() ? select_query->join()->table_join->as<ASTTableJoin>() : nullptr;
|
||||
if (table_join_ast && tables_with_columns.size() >= 2)
|
||||
collectJoinedColumns(*result.analyzed_join, *table_join_ast, tables_with_columns, result.aliases);
|
||||
|
||||
result.aggregates = getAggregates(query, *select_query);
|
||||
result.window_function_asts = getWindowFunctions(query, *select_query);
|
||||
@ -971,8 +964,19 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
|
||||
bool is_initiator = getContext()->getClientInfo().distributed_depth == 0;
|
||||
if (settings.optimize_respect_aliases && result.metadata_snapshot && is_initiator)
|
||||
{
|
||||
std::unordered_set<IAST *> excluded_nodes;
|
||||
{
|
||||
/// Do not replace ALIASed columns in JOIN ON/USING sections
|
||||
if (table_join_ast && table_join_ast->on_expression)
|
||||
excluded_nodes.insert(table_join_ast->on_expression.get());
|
||||
if (table_join_ast && table_join_ast->using_expression_list)
|
||||
excluded_nodes.insert(table_join_ast->using_expression_list.get());
|
||||
}
|
||||
|
||||
bool is_changed = replaceAliasColumnsInQuery(query, result.metadata_snapshot->getColumns(),
|
||||
result.array_join_result_to_source, getContext(), excluded_nodes);
|
||||
/// If query is changed, we need to redo some work to correct name resolution.
|
||||
if (replaceAliasColumnsInQuery(query, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext()))
|
||||
if (is_changed)
|
||||
{
|
||||
result.aggregates = getAggregates(query, *select_query);
|
||||
result.window_function_asts = getWindowFunctions(query, *select_query);
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <Common/ProfileEvents.h>
|
||||
|
||||
#include <Common/SensitiveDataMasker.h>
|
||||
#include "IO/CompressionMethod.h"
|
||||
|
||||
#include <Processors/Transforms/LimitsCheckingTransform.h>
|
||||
#include <Processors/Transforms/MaterializingTransform.h>
|
||||
@ -1071,9 +1072,17 @@ void executeQuery(
|
||||
throw Exception("INTO OUTFILE is not allowed", ErrorCodes::INTO_OUTFILE_NOT_ALLOWED);
|
||||
|
||||
const auto & out_file = ast_query_with_output->out_file->as<ASTLiteral &>().value.safeGet<std::string>();
|
||||
|
||||
std::string compression_method;
|
||||
if (ast_query_with_output->compression)
|
||||
{
|
||||
const auto & compression_method_node = ast_query_with_output->compression->as<ASTLiteral &>();
|
||||
compression_method = compression_method_node.value.safeGet<std::string>();
|
||||
}
|
||||
|
||||
compressed_buffer = wrapWriteBufferWithCompressionMethod(
|
||||
std::make_unique<WriteBufferFromFile>(out_file, DBMS_DEFAULT_BUFFER_SIZE, O_WRONLY | O_EXCL | O_CREAT),
|
||||
chooseCompressionMethod(out_file, ""),
|
||||
chooseCompressionMethod(out_file, compression_method),
|
||||
/* compression level = */ 3
|
||||
);
|
||||
}
|
||||
@ -1119,9 +1128,17 @@ void executeQuery(
|
||||
throw Exception("INTO OUTFILE is not allowed", ErrorCodes::INTO_OUTFILE_NOT_ALLOWED);
|
||||
|
||||
const auto & out_file = typeid_cast<const ASTLiteral &>(*ast_query_with_output->out_file).value.safeGet<std::string>();
|
||||
|
||||
std::string compression_method;
|
||||
if (ast_query_with_output->compression)
|
||||
{
|
||||
const auto & compression_method_node = ast_query_with_output->compression->as<ASTLiteral &>();
|
||||
compression_method = compression_method_node.value.safeGet<std::string>();
|
||||
}
|
||||
|
||||
compressed_buffer = wrapWriteBufferWithCompressionMethod(
|
||||
std::make_unique<WriteBufferFromFile>(out_file, DBMS_DEFAULT_BUFFER_SIZE, O_WRONLY | O_EXCL | O_CREAT),
|
||||
chooseCompressionMethod(out_file, ""),
|
||||
chooseCompressionMethod(out_file, compression_method),
|
||||
/* compression level = */ 3
|
||||
);
|
||||
}
|
||||
|
@ -7,9 +7,13 @@ namespace DB
|
||||
{
|
||||
|
||||
bool replaceAliasColumnsInQuery(
|
||||
ASTPtr & ast, const ColumnsDescription & columns, const NameToNameMap & array_join_result_to_source, ContextPtr context)
|
||||
ASTPtr & ast,
|
||||
const ColumnsDescription & columns,
|
||||
const NameToNameMap & array_join_result_to_source,
|
||||
ContextPtr context,
|
||||
const std::unordered_set<IAST *> & excluded_nodes)
|
||||
{
|
||||
ColumnAliasesVisitor::Data aliases_column_data(columns, array_join_result_to_source, context);
|
||||
ColumnAliasesVisitor::Data aliases_column_data(columns, array_join_result_to_source, context, excluded_nodes);
|
||||
ColumnAliasesVisitor aliases_column_visitor(aliases_column_data);
|
||||
aliases_column_visitor.visit(ast);
|
||||
return aliases_column_data.changed;
|
||||
|
@ -12,6 +12,10 @@ class ColumnsDescription;
|
||||
|
||||
/// Replace storage alias columns in select query if possible. Return true if the query is changed.
|
||||
bool replaceAliasColumnsInQuery(
|
||||
ASTPtr & ast, const ColumnsDescription & columns, const NameToNameMap & array_join_result_to_source, ContextPtr context);
|
||||
ASTPtr & ast,
|
||||
const ColumnsDescription & columns,
|
||||
const NameToNameMap & array_join_result_to_source,
|
||||
ContextPtr context,
|
||||
const std::unordered_set<IAST *> & excluded_nodes = {});
|
||||
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ SRCS(
|
||||
DatabaseAndTableWithAlias.cpp
|
||||
DatabaseCatalog.cpp
|
||||
DictionaryReader.cpp
|
||||
DuplicateOrderByVisitor.cpp
|
||||
EmbeddedDictionaries.cpp
|
||||
ExecuteScalarSubqueriesVisitor.cpp
|
||||
ExpressionActions.cpp
|
||||
|
@ -57,6 +57,8 @@ void ASTInsertQuery::formatImpl(const FormatSettings & settings, FormatState & s
|
||||
if (infile)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM INFILE " << (settings.hilite ? hilite_none : "") << infile->as<ASTLiteral &>().value.safeGet<std::string>();
|
||||
if (compression)
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << " COMPRESSION " << (settings.hilite ? hilite_none : "") << compression->as<ASTLiteral &>().value.safeGet<std::string>();
|
||||
}
|
||||
if (!format.empty())
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
String format;
|
||||
ASTPtr select;
|
||||
ASTPtr infile;
|
||||
ASTPtr compression;
|
||||
ASTPtr watch;
|
||||
ASTPtr table_function;
|
||||
ASTPtr partition_by;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <Parsers/IAST.h>
|
||||
#include <IO/Operators.h>
|
||||
#include "Parsers/IAST_fwd.h"
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -16,6 +17,7 @@ public:
|
||||
ASTPtr out_file;
|
||||
ASTPtr format;
|
||||
ASTPtr settings_ast;
|
||||
ASTPtr compression;
|
||||
|
||||
void formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const final;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Parsers/IAST.h>
|
||||
#include <common/EnumReflection.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
|
@ -25,8 +25,10 @@ namespace ErrorCodes
|
||||
|
||||
bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
{
|
||||
/// Create parsers
|
||||
ParserKeyword s_insert_into("INSERT INTO");
|
||||
ParserKeyword s_from_infile("FROM INFILE");
|
||||
ParserKeyword s_compression("COMPRESSION");
|
||||
ParserKeyword s_table("TABLE");
|
||||
ParserKeyword s_function("FUNCTION");
|
||||
ParserToken s_dot(TokenType::Dot);
|
||||
@ -45,6 +47,8 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
ParserStringLiteral infile_name_p;
|
||||
ParserExpressionWithOptionalAlias exp_elem_p(false);
|
||||
|
||||
/// create ASTPtr variables (result of parsing will be put in them).
|
||||
/// They will be used to initialize ASTInsertQuery's fields.
|
||||
ASTPtr database;
|
||||
ASTPtr table;
|
||||
ASTPtr infile;
|
||||
@ -55,20 +59,28 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
ASTPtr table_function;
|
||||
ASTPtr settings_ast;
|
||||
ASTPtr partition_by_expr;
|
||||
ASTPtr compression;
|
||||
|
||||
/// Insertion data
|
||||
const char * data = nullptr;
|
||||
|
||||
/// Check for key words `INSERT INTO`. If it isn't found, the query can't be parsed as insert query.
|
||||
if (!s_insert_into.ignore(pos, expected))
|
||||
return false;
|
||||
|
||||
/// try to find 'TABLE'
|
||||
s_table.ignore(pos, expected);
|
||||
|
||||
/// Search for 'FUNCTION'. If this key word is in query, read fields for insertion into 'TABLE FUNCTION'.
|
||||
/// Word table is optional for table functions. (for example, s3 table function)
|
||||
/// Otherwise fill 'TABLE' fields.
|
||||
if (s_function.ignore(pos, expected))
|
||||
{
|
||||
/// Read function name
|
||||
if (!table_function_p.parse(pos, table_function, expected))
|
||||
return false;
|
||||
|
||||
/// Support insertion values with partition by.
|
||||
if (s_partition_by.ignore(pos, expected))
|
||||
{
|
||||
if (!exp_elem_p.parse(pos, partition_by_expr, expected))
|
||||
@ -77,9 +89,12 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Read one word. It can be table or database name.
|
||||
if (!name_p.parse(pos, table, expected))
|
||||
return false;
|
||||
|
||||
/// If there is a dot, previous name was database name,
|
||||
/// so read table name after dot.
|
||||
if (s_dot.ignore(pos, expected))
|
||||
{
|
||||
database = table;
|
||||
@ -98,26 +113,41 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
return false;
|
||||
}
|
||||
|
||||
Pos before_values = pos;
|
||||
|
||||
/// Check if file is a source of data.
|
||||
if (s_from_infile.ignore(pos, expected))
|
||||
{
|
||||
/// Read its name to process it later
|
||||
if (!infile_name_p.parse(pos, infile, expected))
|
||||
return false;
|
||||
|
||||
/// Check for 'COMPRESSION' parameter (optional)
|
||||
if (s_compression.ignore(pos, expected))
|
||||
{
|
||||
/// Read compression name. Create parser for this purpose.
|
||||
ParserStringLiteral compression_p;
|
||||
if (!compression_p.parse(pos, compression, expected))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Pos before_values = pos;
|
||||
|
||||
/// VALUES or FROM INFILE or FORMAT or SELECT
|
||||
if (!infile && s_values.ignore(pos, expected))
|
||||
{
|
||||
/// If VALUES is defined in query, everything except setting will be parsed as data
|
||||
data = pos->begin;
|
||||
}
|
||||
else if (s_format.ignore(pos, expected))
|
||||
{
|
||||
/// If FORMAT is defined, read format name
|
||||
if (!name_p.parse(pos, format, expected))
|
||||
return false;
|
||||
}
|
||||
else if (s_select.ignore(pos, expected) || s_with.ignore(pos,expected))
|
||||
{
|
||||
/// If SELECT is defined, return to position before select and parse
|
||||
/// rest of query as SELECT query.
|
||||
pos = before_values;
|
||||
ParserSelectWithUnionQuery select_p;
|
||||
select_p.parse(pos, select, expected);
|
||||
@ -128,6 +158,8 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
}
|
||||
else if (s_watch.ignore(pos, expected))
|
||||
{
|
||||
/// If WATCH is defined, return to position before WATCH and parse
|
||||
/// rest of query as WATCH query.
|
||||
pos = before_values;
|
||||
ParserWatchQuery watch_p;
|
||||
watch_p.parse(pos, watch, expected);
|
||||
@ -138,11 +170,14 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
}
|
||||
else
|
||||
{
|
||||
/// If all previous conditions were false, query is incorrect
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Read SETTINGS if they are defined
|
||||
if (s_settings.ignore(pos, expected))
|
||||
{
|
||||
/// Settings are written like SET query, so parse them with ParserSetQuery
|
||||
ParserSetQuery parser_settings(true);
|
||||
if (!parser_settings.parse(pos, settings_ast, expected))
|
||||
return false;
|
||||
@ -155,13 +190,14 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
InsertQuerySettingsPushDownVisitor(visitor_data).visit(select);
|
||||
}
|
||||
|
||||
|
||||
/// In case of defined format, data follows it.
|
||||
if (format && !infile)
|
||||
{
|
||||
Pos last_token = pos;
|
||||
--last_token;
|
||||
data = last_token->end;
|
||||
|
||||
/// If format name is followed by ';' (end of query symbol) there is no data to insert.
|
||||
if (data < end && *data == ';')
|
||||
throw Exception("You have excessive ';' symbol before data for INSERT.\n"
|
||||
"Example:\n\n"
|
||||
@ -184,11 +220,16 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
++data;
|
||||
}
|
||||
|
||||
/// Create query and fill its fields.
|
||||
auto query = std::make_shared<ASTInsertQuery>();
|
||||
node = query;
|
||||
|
||||
if (infile)
|
||||
{
|
||||
query->infile = infile;
|
||||
if (compression)
|
||||
query->compression = compression;
|
||||
}
|
||||
|
||||
if (table_function)
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <Parsers/ParserTablePropertiesQuery.h>
|
||||
#include <Parsers/ParserWatchQuery.h>
|
||||
#include <Parsers/QueryWithOutputSettingsPushDownVisitor.h>
|
||||
#include "Common/Exception.h"
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -86,6 +87,14 @@ bool ParserQueryWithOutput::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
if (!out_file_p.parse(pos, query_with_output.out_file, expected))
|
||||
return false;
|
||||
|
||||
ParserKeyword s_compression_method("COMPRESSION");
|
||||
if (s_compression_method.ignore(pos, expected))
|
||||
{
|
||||
ParserStringLiteral compression;
|
||||
if (!compression.parse(pos, query_with_output.compression, expected))
|
||||
return false;
|
||||
}
|
||||
|
||||
query_with_output.children.push_back(query_with_output.out_file);
|
||||
}
|
||||
|
||||
|
@ -367,15 +367,10 @@ static ColumnWithTypeAndName readColumnFromArrowColumn(
|
||||
}
|
||||
case arrow::Type::TIMESTAMP:
|
||||
return readColumnWithTimestampData(arrow_column, column_name);
|
||||
#if defined(ARCADIA_BUILD)
|
||||
case arrow::Type::DECIMAL:
|
||||
return readColumnWithDecimalData<Decimal128, arrow::Decimal128Array>(arrow_column, column_name);
|
||||
#else
|
||||
case arrow::Type::DECIMAL128:
|
||||
return readColumnWithDecimalData<Decimal128, arrow::Decimal128Array>(arrow_column, column_name);
|
||||
case arrow::Type::DECIMAL256:
|
||||
return readColumnWithDecimalData<Decimal256, arrow::Decimal256Array>(arrow_column, column_name);
|
||||
#endif
|
||||
case arrow::Type::MAP:
|
||||
{
|
||||
auto arrow_nested_column = getNestedArrowColumn(arrow_column);
|
||||
|
@ -34,6 +34,7 @@ Pipe getSourceFromFromASTInsertQuery(
|
||||
ContextPtr context,
|
||||
const ASTPtr & input_function)
|
||||
{
|
||||
/// get ast query
|
||||
const auto * ast_insert_query = ast->as<ASTInsertQuery>();
|
||||
|
||||
if (!ast_insert_query)
|
||||
@ -51,10 +52,10 @@ Pipe getSourceFromFromASTInsertQuery(
|
||||
}
|
||||
|
||||
/// Data could be in parsed (ast_insert_query.data) and in not parsed yet (input_buffer_tail_part) part of query.
|
||||
|
||||
auto input_buffer_ast_part = std::make_unique<ReadBufferFromMemory>(
|
||||
ast_insert_query->data, ast_insert_query->data ? ast_insert_query->end - ast_insert_query->data : 0);
|
||||
|
||||
/// Input buffer will be defined by reading from file buffer or by ConcatReadBuffer (concatenation of data and tail)
|
||||
std::unique_ptr<ReadBuffer> input_buffer;
|
||||
|
||||
if (ast_insert_query->infile)
|
||||
@ -63,10 +64,21 @@ Pipe getSourceFromFromASTInsertQuery(
|
||||
const auto & in_file_node = ast_insert_query->infile->as<ASTLiteral &>();
|
||||
const auto in_file = in_file_node.value.safeGet<std::string>();
|
||||
|
||||
input_buffer = wrapReadBufferWithCompressionMethod(std::make_unique<ReadBufferFromFile>(in_file), chooseCompressionMethod(in_file, ""));
|
||||
/// It can be compressed and compression method maybe specified in query
|
||||
std::string compression_method;
|
||||
if (ast_insert_query->compression)
|
||||
{
|
||||
const auto & compression_method_node = ast_insert_query->compression->as<ASTLiteral &>();
|
||||
compression_method = compression_method_node.value.safeGet<std::string>();
|
||||
}
|
||||
|
||||
/// Otherwise, it will be detected from file name automatically (by chooseCompressionMethod)
|
||||
/// Buffer for reading from file is created and wrapped with appropriate compression method
|
||||
input_buffer = wrapReadBufferWithCompressionMethod(std::make_unique<ReadBufferFromFile>(in_file), chooseCompressionMethod(in_file, compression_method));
|
||||
}
|
||||
else
|
||||
{
|
||||
/// concatenation of data and tail
|
||||
ConcatReadBuffer::ReadBuffers buffers;
|
||||
if (ast_insert_query->data)
|
||||
buffers.push_back(input_buffer_ast_part.get());
|
||||
@ -81,6 +93,7 @@ Pipe getSourceFromFromASTInsertQuery(
|
||||
input_buffer = std::make_unique<ConcatReadBuffer>(buffers);
|
||||
}
|
||||
|
||||
/// Create a source from input buffer using format from query
|
||||
auto source = FormatFactory::instance().getInput(format, *input_buffer, header, context, context->getSettings().max_insert_block_size);
|
||||
Pipe pipe(source);
|
||||
|
||||
|
@ -1299,34 +1299,48 @@ bool KeyCondition::tryParseAtomFromAST(const ASTPtr & node, ContextPtr context,
|
||||
}
|
||||
}
|
||||
|
||||
key_expr_type = recursiveRemoveLowCardinality(key_expr_type);
|
||||
DataTypePtr key_expr_type_not_null;
|
||||
bool key_expr_type_is_nullable = false;
|
||||
if (const auto * nullable_type = typeid_cast<const DataTypeNullable *>(key_expr_type.get()))
|
||||
{
|
||||
key_expr_type_is_nullable = true;
|
||||
key_expr_type_not_null = nullable_type->getNestedType();
|
||||
}
|
||||
else
|
||||
key_expr_type_not_null = key_expr_type;
|
||||
|
||||
bool cast_not_needed = is_set_const /// Set args are already casted inside Set::createFromAST
|
||||
|| ((isNativeNumber(key_expr_type) || isDateTime(key_expr_type))
|
||||
|| ((isNativeNumber(key_expr_type_not_null) || isDateTime(key_expr_type_not_null))
|
||||
&& (isNativeNumber(const_type) || isDateTime(const_type))); /// Numbers and DateTime are accurately compared without cast.
|
||||
|
||||
if (!cast_not_needed && !key_expr_type->equals(*const_type))
|
||||
if (!cast_not_needed && !key_expr_type_not_null->equals(*const_type))
|
||||
{
|
||||
if (const_value.getType() == Field::Types::String)
|
||||
{
|
||||
const_value = convertFieldToType(const_value, *key_expr_type);
|
||||
const_value = convertFieldToType(const_value, *key_expr_type_not_null);
|
||||
if (const_value.isNull())
|
||||
return false;
|
||||
// No need to set is_constant_transformed because we're doing exact conversion
|
||||
}
|
||||
else
|
||||
{
|
||||
DataTypePtr common_type = getLeastSupertype({key_expr_type, const_type});
|
||||
DataTypePtr common_type = getLeastSupertype({key_expr_type_not_null, const_type});
|
||||
if (!const_type->equals(*common_type))
|
||||
{
|
||||
castValueToType(common_type, const_value, const_type, node);
|
||||
|
||||
// Need to set is_constant_transformed unless we're doing exact conversion
|
||||
if (!key_expr_type->equals(*common_type))
|
||||
if (!key_expr_type_not_null->equals(*common_type))
|
||||
is_constant_transformed = true;
|
||||
}
|
||||
if (!key_expr_type->equals(*common_type))
|
||||
if (!key_expr_type_not_null->equals(*common_type))
|
||||
{
|
||||
auto common_type_maybe_nullable
|
||||
= key_expr_type_is_nullable ? DataTypePtr(std::make_shared<DataTypeNullable>(common_type)) : common_type;
|
||||
ColumnsWithTypeAndName arguments{
|
||||
{nullptr, key_expr_type, ""}, {DataTypeString().createColumnConst(1, common_type->getName()), common_type, ""}};
|
||||
{nullptr, key_expr_type, ""},
|
||||
{DataTypeString().createColumnConst(1, common_type_maybe_nullable->getName()), common_type_maybe_nullable, ""}};
|
||||
FunctionOverloadResolverPtr func_builder_cast = CastInternalOverloadResolver<CastType::nonAccurate>::createImpl();
|
||||
auto func_cast = func_builder_cast->build(arguments);
|
||||
|
||||
|
@ -5000,7 +5000,8 @@ void StorageReplicatedMergeTree::alter(
|
||||
else if (rc == Coordination::Error::ZBADVERSION)
|
||||
{
|
||||
if (results[0]->error != Coordination::Error::ZOK)
|
||||
throw Exception("Metadata on replica is not up to date with common metadata in Zookeeper. Cannot alter",
|
||||
throw Exception("Metadata on replica is not up to date with common metadata in Zookeeper. It means that this replica still not applied some of previous alters."
|
||||
" Probably too many alters executing concurrently (highly not recommended). You can retry this error",
|
||||
ErrorCodes::CANNOT_ASSIGN_ALTER);
|
||||
|
||||
/// Cannot retry automatically, because some zookeeper ops were lost on the first attempt. Will retry on DDLWorker-level.
|
||||
|
@ -18,7 +18,7 @@ SRCS(
|
||||
Distributed/DirectoryMonitor.cpp
|
||||
Distributed/DistributedSettings.cpp
|
||||
Distributed/DistributedSink.cpp
|
||||
ExecutablePoolSettings.cpp
|
||||
ExecutableSettings.cpp
|
||||
IStorage.cpp
|
||||
IndicesDescription.cpp
|
||||
JoinSettings.cpp
|
||||
|
@ -16,6 +16,12 @@ flat: any left
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 0 0
|
||||
flat: any left + any_join_distinct_right_table_keys
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 0 0
|
||||
flat: semi left
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
|
@ -1,12 +1,5 @@
|
||||
-- Tags: no-parallel
|
||||
|
||||
SET send_logs_level = 'fatal';
|
||||
|
||||
DROP DATABASE IF EXISTS db_01115;
|
||||
CREATE DATABASE db_01115;
|
||||
|
||||
USE db_01115;
|
||||
|
||||
DROP DICTIONARY IF EXISTS dict_flat;
|
||||
DROP DICTIONARY IF EXISTS dict_hashed;
|
||||
DROP DICTIONARY IF EXISTS dict_complex_cache;
|
||||
@ -16,19 +9,19 @@ INSERT INTO t1 SELECT number, number, toString(number), number from numbers(4);
|
||||
|
||||
CREATE DICTIONARY dict_flat (key UInt64 DEFAULT 0, a UInt8 DEFAULT 42, b String DEFAULT 'x', c Float64 DEFAULT 42.0)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 't1' PASSWORD '' DB 'db_01115'))
|
||||
SOURCE(CLICKHOUSE(TABLE 't1'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(FLAT());
|
||||
|
||||
CREATE DICTIONARY db_01115.dict_hashed (key UInt64 DEFAULT 0, a UInt8 DEFAULT 42, b String DEFAULT 'x', c Float64 DEFAULT 42.0)
|
||||
CREATE DICTIONARY dict_hashed (key UInt64 DEFAULT 0, a UInt8 DEFAULT 42, b String DEFAULT 'x', c Float64 DEFAULT 42.0)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 't1' DB 'db_01115'))
|
||||
SOURCE(CLICKHOUSE(TABLE 't1'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(HASHED());
|
||||
|
||||
CREATE DICTIONARY dict_complex_cache (key UInt64 DEFAULT 0, a UInt8 DEFAULT 42, b String DEFAULT 'x', c Float64 DEFAULT 42.0)
|
||||
PRIMARY KEY key, b
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 't1' DB 'db_01115'))
|
||||
SOURCE(CLICKHOUSE(TABLE 't1'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(COMPLEX_KEY_CACHE(SIZE_IN_CELLS 1));
|
||||
|
||||
@ -40,6 +33,8 @@ SELECT 'flat: left';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 LEFT JOIN dict_flat d USING(key) ORDER BY key;
|
||||
SELECT 'flat: any left';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 ANY LEFT JOIN dict_flat d USING(key) ORDER BY key;
|
||||
SELECT 'flat: any left + any_join_distinct_right_table_keys'; -- falls back to regular join
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 ANY LEFT JOIN dict_flat d USING(key) ORDER BY key SETTINGS any_join_distinct_right_table_keys = '1';
|
||||
SELECT 'flat: semi left';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 SEMI JOIN dict_flat d USING(key) ORDER BY key;
|
||||
SELECT 'flat: anti left';
|
||||
@ -104,10 +99,8 @@ SELECT * FROM (SELECT number AS key FROM numbers(5)) s1 ANY LEFT JOIN dict_flat
|
||||
SELECT '-';
|
||||
SELECT * FROM (SELECT number AS key FROM numbers(2)) s1 RIGHT JOIN dict_flat d ON s1.key = d.key ORDER BY d.key;
|
||||
|
||||
|
||||
DROP DICTIONARY dict_flat;
|
||||
DROP DICTIONARY dict_hashed;
|
||||
DROP DICTIONARY dict_complex_cache;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE IF EXISTS db_01115;
|
||||
|
@ -15,9 +15,9 @@ $CLICKHOUSE_CLIENT --query "CREATE TABLE test_01150.t2 (x UInt64, s Array(Nullab
|
||||
|
||||
function thread_detach_attach {
|
||||
while true; do
|
||||
$CLICKHOUSE_CLIENT --query "DETACH DATABASE test_01150" 2>&1 | grep -v -F -e 'Received exception from server' -e 'Code: (219)' -e '(query: '
|
||||
$CLICKHOUSE_CLIENT --query "DETACH DATABASE test_01150" 2>&1 | grep -v -F -e 'Received exception from server' -e 'Code: 219' -e '(query: '
|
||||
sleep 0.0$RANDOM
|
||||
$CLICKHOUSE_CLIENT --query "ATTACH DATABASE test_01150" 2>&1 | grep -v -F -e 'Received exception from server' -e 'Code: (219)' -e '(query: '
|
||||
$CLICKHOUSE_CLIENT --query "ATTACH DATABASE test_01150" 2>&1 | grep -v -F -e 'Received exception from server' -e 'Code: 82' -e '(query: '
|
||||
sleep 0.0$RANDOM
|
||||
done
|
||||
}
|
||||
|
@ -22,3 +22,13 @@ fact1t1_val1 fact1t2_val2
|
||||
fact2t1_val2 fact2t1_val2
|
||||
-
|
||||
2020-02-02 13:00:00 2020-02-05 13:00:00
|
||||
-
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
-
|
||||
2020-01-01 12:00:00
|
||||
2020-01-01 12:00:00
|
||||
2020-01-01 12:00:00
|
||||
2020-01-01 12:00:00
|
||||
|
@ -2,17 +2,23 @@ DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
time DateTime, foo String, dimension_1 String,
|
||||
time DateTime,
|
||||
foo String,
|
||||
dimension_1 String,
|
||||
dt Date MATERIALIZED toDate(time),
|
||||
dt1 Date MATERIALIZED toDayOfYear(time),
|
||||
aliascol1 ALIAS foo || dimension_1
|
||||
aliascol1 ALIAS foo || dimension_1,
|
||||
time_alias DateTime ALIAS time
|
||||
) ENGINE = MergeTree() PARTITION BY toYYYYMM(dt) ORDER BY (dt, foo);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
time DateTime, bar String, dimension_2 String,
|
||||
time DateTime,
|
||||
bar String,
|
||||
dimension_2 String,
|
||||
dt Date MATERIALIZED toDate(time),
|
||||
dt2 Date MATERIALIZED toDayOfYear(time),
|
||||
aliascol2 ALIAS bar || dimension_2
|
||||
aliascol2 ALIAS bar || dimension_2,
|
||||
time_alias DateTime ALIAS time
|
||||
) ENGINE = MergeTree() PARTITION BY toYYYYMM(dt) ORDER BY (dt, bar);
|
||||
|
||||
INSERT INTO t1 VALUES ('2020-01-01 12:00:00', 'fact1', 't1_val1'), ('2020-02-02 13:00:00', 'fact2', 't1_val2'), ('2020-01-01 13:00:00', 'fact3', 't1_val3');
|
||||
@ -35,3 +41,15 @@ SELECT '-';
|
||||
SELECT t1.aliascol1, t2.aliascol2 FROM t1 JOIN t2 ON t1.foo = t2.bar ORDER BY t1.time, t2.time;
|
||||
SELECT '-';
|
||||
SELECT t1.time, t2.time FROM t1 JOIN t2 ON t1.aliascol1 = t2.aliascol2 ORDER BY t1.time, t2.time;
|
||||
SELECT '-';
|
||||
SELECT count() FROM t1 JOIN t2 ON t1.time_alias = t2.time;
|
||||
SELECT count() FROM t1 JOIN t2 ON t1.time = t2.time_alias;
|
||||
SELECT count() FROM t1 JOIN t2 ON t1.time_alias = t2.time_alias;
|
||||
SELECT count() FROM t1 JOIN t2 USING (time_alias);
|
||||
SELECT '-';
|
||||
SELECT t1.time as talias FROM t1 JOIN t2 ON talias = t2.time;
|
||||
SELECT t1.time as talias FROM t1 JOIN t2 ON talias = t2.time_alias;
|
||||
SELECT t2.time as talias FROM t1 JOIN t2 ON t1.time = talias;
|
||||
SELECT t2.time as talias FROM t1 JOIN t2 ON t1.time_alias = talias;
|
||||
SELECT time as talias FROM t1 JOIN t2 ON t1.time = talias; -- { serverError AMBIGUOUS_COLUMN_NAME }
|
||||
SELECT time as talias FROM t1 JOIN t2 ON talias = t2.time; -- { serverError AMBIGUOUS_COLUMN_NAME }
|
||||
|
@ -0,0 +1,339 @@
|
||||
String ConstConst
|
||||
1
|
||||
0 Hello 0100100001100101011011000110110001101111
|
||||
1 Hello 0010010000110010101101100011011000110111
|
||||
2 Hello 0001001000011001010110110001101100011011
|
||||
3 Hello 0000100100001100101011011000110110001101
|
||||
4 Hello 0000010010000110010101101100011011000110
|
||||
5 Hello 0000001001000011001010110110001101100011
|
||||
6 Hello 0000000100100001100101011011000110110001
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
8 Hello 01001000011001010110110001101100
|
||||
9 Hello 00100100001100101011011000110110
|
||||
10 Hello 00010010000110010101101100011011
|
||||
11 Hello 00001001000011001010110110001101
|
||||
12 Hello 00000100100001100101011011000110
|
||||
13 Hello 00000010010000110010101101100011
|
||||
14 Hello 00000001001000011001010110110001
|
||||
15 Hello 00000000100100001100101011011000
|
||||
16 Hello 010010000110010101101100
|
||||
17 Hello 001001000011001010110110
|
||||
18 Hello 000100100001100101011011
|
||||
19 Hello 000010010000110010101101
|
||||
20 Hello 000001001000011001010110
|
||||
21 Hello 000000100100001100101011
|
||||
22 Hello 000000010010000110010101
|
||||
23 Hello 000000001001000011001010
|
||||
24 Hello 0100100001100101
|
||||
25 Hello 0010010000110010
|
||||
26 Hello 0001001000011001
|
||||
27 Hello 0000100100001100
|
||||
28 Hello 0000010010000110
|
||||
29 Hello 0000001001000011
|
||||
30 Hello 0000000100100001
|
||||
31 Hello 0000000010010000
|
||||
32 Hello 01001000
|
||||
33 Hello 00100100
|
||||
34 Hello 00010010
|
||||
35 Hello 00001001
|
||||
36 Hello 00000100
|
||||
37 Hello 00000010
|
||||
38 Hello 00000001
|
||||
39 Hello 00000000
|
||||
40 Hello
|
||||
41 Hello
|
||||
42 Hello
|
||||
FixedString ConstConst
|
||||
1
|
||||
0 Hello\0\0\0\0\0 01001000011001010110110001101100011011110000000000000000000000000000000000000000
|
||||
1 Hello\0\0\0\0\0 00100100001100101011011000110110001101111000000000000000000000000000000000000000
|
||||
2 Hello\0\0\0\0\0 00010010000110010101101100011011000110111100000000000000000000000000000000000000
|
||||
3 Hello\0\0\0\0\0 00001001000011001010110110001101100011011110000000000000000000000000000000000000
|
||||
4 Hello\0\0\0\0\0 00000100100001100101011011000110110001101111000000000000000000000000000000000000
|
||||
5 Hello\0\0\0\0\0 00000010010000110010101101100011011000110111100000000000000000000000000000000000
|
||||
6 Hello\0\0\0\0\0 00000001001000011001010110110001101100011011110000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 00000000001001000011001010110110001101100011011110000000000000000000000000000000
|
||||
10 Hello\0\0\0\0\0 00000000000100100001100101011011000110110001101111000000000000000000000000000000
|
||||
11 Hello\0\0\0\0\0 00000000000010010000110010101101100011011000110111100000000000000000000000000000
|
||||
12 Hello\0\0\0\0\0 00000000000001001000011001010110110001101100011011110000000000000000000000000000
|
||||
13 Hello\0\0\0\0\0 00000000000000100100001100101011011000110110001101111000000000000000000000000000
|
||||
14 Hello\0\0\0\0\0 00000000000000010010000110010101101100011011000110111100000000000000000000000000
|
||||
15 Hello\0\0\0\0\0 00000000000000001001000011001010110110001101100011011110000000000000000000000000
|
||||
16 Hello\0\0\0\0\0 00000000000000000100100001100101011011000110110001101111000000000000000000000000
|
||||
17 Hello\0\0\0\0\0 00000000000000000010010000110010101101100011011000110111100000000000000000000000
|
||||
18 Hello\0\0\0\0\0 00000000000000000001001000011001010110110001101100011011110000000000000000000000
|
||||
19 Hello\0\0\0\0\0 00000000000000000000100100001100101011011000110110001101111000000000000000000000
|
||||
20 Hello\0\0\0\0\0 00000000000000000000010010000110010101101100011011000110111100000000000000000000
|
||||
21 Hello\0\0\0\0\0 00000000000000000000001001000011001010110110001101100011011110000000000000000000
|
||||
22 Hello\0\0\0\0\0 00000000000000000000000100100001100101011011000110110001101111000000000000000000
|
||||
23 Hello\0\0\0\0\0 00000000000000000000000010010000110010101101100011011000110111100000000000000000
|
||||
24 Hello\0\0\0\0\0 00000000000000000000000001001000011001010110110001101100011011110000000000000000
|
||||
25 Hello\0\0\0\0\0 00000000000000000000000000100100001100101011011000110110001101111000000000000000
|
||||
26 Hello\0\0\0\0\0 00000000000000000000000000010010000110010101101100011011000110111100000000000000
|
||||
27 Hello\0\0\0\0\0 00000000000000000000000000001001000011001010110110001101100011011110000000000000
|
||||
28 Hello\0\0\0\0\0 00000000000000000000000000000100100001100101011011000110110001101111000000000000
|
||||
29 Hello\0\0\0\0\0 00000000000000000000000000000010010000110010101101100011011000110111100000000000
|
||||
30 Hello\0\0\0\0\0 00000000000000000000000000000001001000011001010110110001101100011011110000000000
|
||||
31 Hello\0\0\0\0\0 00000000000000000000000000000000100100001100101011011000110110001101111000000000
|
||||
32 Hello\0\0\0\0\0 00000000000000000000000000000000010010000110010101101100011011000110111100000000
|
||||
33 Hello\0\0\0\0\0 00000000000000000000000000000000001001000011001010110110001101100011011110000000
|
||||
34 Hello\0\0\0\0\0 00000000000000000000000000000000000100100001100101011011000110110001101111000000
|
||||
35 Hello\0\0\0\0\0 00000000000000000000000000000000000010010000110010101101100011011000110111100000
|
||||
36 Hello\0\0\0\0\0 00000000000000000000000000000000000001001000011001010110110001101100011011110000
|
||||
37 Hello\0\0\0\0\0 00000000000000000000000000000000000000100100001100101011011000110110001101111000
|
||||
38 Hello\0\0\0\0\0 00000000000000000000000000000000000000010010000110010101101100011011000110111100
|
||||
39 Hello\0\0\0\0\0 00000000000000000000000000000000000000001001000011001010110110001101100011011110
|
||||
40 Hello\0\0\0\0\0 00000000000000000000000000000000000000000100100001100101011011000110110001101111
|
||||
41 Hello\0\0\0\0\0 00000000000000000000000000000000000000000010010000110010101101100011011000110111
|
||||
42 Hello\0\0\0\0\0 00000000000000000000000000000000000000000001001000011001010110110001101100011011
|
||||
77 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000010
|
||||
78 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
79 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
80 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
81 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
String VectorVector
|
||||
-1 Hello
|
||||
0 Hello 0100100001100101011011000110110001101111
|
||||
1 Hello 0010010000110010101101100011011000110111
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
8 Hello 01001000011001010110110001101100
|
||||
9 Hello 00100100001100101011011000110110
|
||||
15 Hello 00000000100100001100101011011000
|
||||
16 Hello 010010000110010101101100
|
||||
17 Hello 001001000011001010110110
|
||||
23 Hello 000000001001000011001010
|
||||
24 Hello 0100100001100101
|
||||
25 Hello 0010010000110010
|
||||
31 Hello 0000000010010000
|
||||
32 Hello 01001000
|
||||
33 Hello 00100100
|
||||
39 Hello 00000000
|
||||
40 Hello
|
||||
41 Hello
|
||||
42 Hello
|
||||
7 Hel 000000001001000011001010
|
||||
8 Hel 0100100001100101
|
||||
9 Hel 0010010000110010
|
||||
23 Hello 000000001001000011001010
|
||||
24 Hello 0100100001100101
|
||||
25 Hello 0010010000110010
|
||||
7 Hel 000000001001000011001010
|
||||
8 Hel 0100100001100101
|
||||
9 Hel 0010010000110010
|
||||
|
||||
FixedString VectorVector
|
||||
-1 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0 Hello\0\0\0\0\0 01001000011001010110110001101100011011110000000000000000000000000000000000000000
|
||||
1 Hello\0\0\0\0\0 00100100001100101011011000110110001101111000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 00000000001001000011001010110110001101100011011110000000000000000000000000000000
|
||||
15 Hello\0\0\0\0\0 00000000000000001001000011001010110110001101100011011110000000000000000000000000
|
||||
16 Hello\0\0\0\0\0 00000000000000000100100001100101011011000110110001101111000000000000000000000000
|
||||
17 Hello\0\0\0\0\0 00000000000000000010010000110010101101100011011000110111100000000000000000000000
|
||||
23 Hello\0\0\0\0\0 00000000000000000000000010010000110010101101100011011000110111100000000000000000
|
||||
24 Hello\0\0\0\0\0 00000000000000000000000001001000011001010110110001101100011011110000000000000000
|
||||
25 Hello\0\0\0\0\0 00000000000000000000000000100100001100101011011000110110001101111000000000000000
|
||||
31 Hello\0\0\0\0\0 00000000000000000000000000000000100100001100101011011000110110001101111000000000
|
||||
32 Hello\0\0\0\0\0 00000000000000000000000000000000010010000110010101101100011011000110111100000000
|
||||
33 Hello\0\0\0\0\0 00000000000000000000000000000000001001000011001010110110001101100011011110000000
|
||||
39 Hello\0\0\0\0\0 00000000000000000000000000000000000000001001000011001010110110001101100011011110
|
||||
40 Hello\0\0\0\0\0 00000000000000000000000000000000000000000100100001100101011011000110110001101111
|
||||
41 Hello\0\0\0\0\0 00000000000000000000000000000000000000000010010000110010101101100011011000110111
|
||||
42 Hello\0\0\0\0\0 00000000000000000000000000000000000000000001001000011001010110110001101100011011
|
||||
7 Hel\0\0\0\0\0\0\0 00000000100100001100101011011000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 00000000010010000110010101101100000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 00000000001001000011001010110110000000000000000000000000000000000000000000000000
|
||||
23 Hello\0\0\0\0\0 00000000000000000000000010010000110010101101100011011000110111100000000000000000
|
||||
24 Hello\0\0\0\0\0 00000000000000000000000001001000011001010110110001101100011011110000000000000000
|
||||
25 Hello\0\0\0\0\0 00000000000000000000000000100100001100101011011000110110001101111000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00000000100100001100101011011000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 00000000010010000110010101101100000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 00000000001001000011001010110110000000000000000000000000000000000000000000000000
|
||||
|
||||
String VectorConst
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
7 Hel 000000001001000011001010
|
||||
7 Hel 000000001001000011001010
|
||||
7 Hel 000000001001000011001010
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hello 01001000011001010110110001101100
|
||||
8 Hel 0100100001100101
|
||||
8 Hel 0100100001100101
|
||||
8 Hel 0100100001100101
|
||||
|
||||
FixedString VectorConst
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00000000100100001100101011011000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00000000100100001100101011011000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00000000100100001100101011011000000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 00000000010010000110010101101100000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 00000000010010000110010101101100000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 00000000010010000110010101101100000000000000000000000000000000000000000000000000
|
||||
|
||||
String ConstVector
|
||||
-1 Hello
|
||||
0 Hello 0100100001100101011011000110110001101111
|
||||
1 Hello 0010010000110010101101100011011000110111
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
8 Hello 01001000011001010110110001101100
|
||||
9 Hello 00100100001100101011011000110110
|
||||
15 Hello 00000000100100001100101011011000
|
||||
16 Hello 010010000110010101101100
|
||||
17 Hello 001001000011001010110110
|
||||
23 Hello 000000001001000011001010
|
||||
24 Hello 0100100001100101
|
||||
25 Hello 0010010000110010
|
||||
31 Hello 0000000010010000
|
||||
32 Hello 01001000
|
||||
33 Hello 00100100
|
||||
39 Hello 00000000
|
||||
40 Hello
|
||||
41 Hello
|
||||
42 Hello
|
||||
7 Hello 0000000010010000110010101101100011011000
|
||||
8 Hello 01001000011001010110110001101100
|
||||
9 Hello 00100100001100101011011000110110
|
||||
-1 Hel
|
||||
0 Hel 010010000110010101101100
|
||||
1 Hel 001001000011001010110110
|
||||
7 Hel 000000001001000011001010
|
||||
8 Hel 0100100001100101
|
||||
9 Hel 0010010000110010
|
||||
15 Hel 0000000010010000
|
||||
16 Hel 01001000
|
||||
17 Hel 00100100
|
||||
23 Hel 00000000
|
||||
24 Hel
|
||||
25 Hel
|
||||
31 Hel
|
||||
32 Hel
|
||||
33 Hel
|
||||
39 Hel
|
||||
40 Hel
|
||||
41 Hel
|
||||
42 Hel
|
||||
7 Hel 000000001001000011001010
|
||||
8 Hel 0100100001100101
|
||||
9 Hel 0010010000110010
|
||||
|
||||
FixedString ConstVector
|
||||
-1 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0 Hello\0\0\0\0\0 01001000011001010110110001101100011011110000000000000000000000000000000000000000
|
||||
1 Hello\0\0\0\0\0 00100100001100101011011000110110001101111000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 00000000001001000011001010110110001101100011011110000000000000000000000000000000
|
||||
15 Hello\0\0\0\0\0 00000000000000001001000011001010110110001101100011011110000000000000000000000000
|
||||
16 Hello\0\0\0\0\0 00000000000000000100100001100101011011000110110001101111000000000000000000000000
|
||||
17 Hello\0\0\0\0\0 00000000000000000010010000110010101101100011011000110111100000000000000000000000
|
||||
23 Hello\0\0\0\0\0 00000000000000000000000010010000110010101101100011011000110111100000000000000000
|
||||
24 Hello\0\0\0\0\0 00000000000000000000000001001000011001010110110001101100011011110000000000000000
|
||||
25 Hello\0\0\0\0\0 00000000000000000000000000100100001100101011011000110110001101111000000000000000
|
||||
31 Hello\0\0\0\0\0 00000000000000000000000000000000100100001100101011011000110110001101111000000000
|
||||
32 Hello\0\0\0\0\0 00000000000000000000000000000000010010000110010101101100011011000110111100000000
|
||||
33 Hello\0\0\0\0\0 00000000000000000000000000000000001001000011001010110110001101100011011110000000
|
||||
39 Hello\0\0\0\0\0 00000000000000000000000000000000000000001001000011001010110110001101100011011110
|
||||
40 Hello\0\0\0\0\0 00000000000000000000000000000000000000000100100001100101011011000110110001101111
|
||||
41 Hello\0\0\0\0\0 00000000000000000000000000000000000000000010010000110010101101100011011000110111
|
||||
42 Hello\0\0\0\0\0 00000000000000000000000000000000000000000001001000011001010110110001101100011011
|
||||
7 Hello\0\0\0\0\0 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 00000000010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 00000000001001000011001010110110001101100011011110000000000000000000000000000000
|
||||
-1 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0 Hel\0\0\0\0\0\0\0 01001000011001010110110000000000000000000000000000000000000000000000000000000000
|
||||
1 Hel\0\0\0\0\0\0\0 00100100001100101011011000000000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00000000100100001100101011011000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 00000000010010000110010101101100000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 00000000001001000011001010110110000000000000000000000000000000000000000000000000
|
||||
15 Hel\0\0\0\0\0\0\0 00000000000000001001000011001010110110000000000000000000000000000000000000000000
|
||||
16 Hel\0\0\0\0\0\0\0 00000000000000000100100001100101011011000000000000000000000000000000000000000000
|
||||
17 Hel\0\0\0\0\0\0\0 00000000000000000010010000110010101101100000000000000000000000000000000000000000
|
||||
23 Hel\0\0\0\0\0\0\0 00000000000000000000000010010000110010101101100000000000000000000000000000000000
|
||||
24 Hel\0\0\0\0\0\0\0 00000000000000000000000001001000011001010110110000000000000000000000000000000000
|
||||
25 Hel\0\0\0\0\0\0\0 00000000000000000000000000100100001100101011011000000000000000000000000000000000
|
||||
31 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000100100001100101011011000000000000000000000000000
|
||||
32 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000010010000110010101101100000000000000000000000000
|
||||
33 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000001001000011001010110110000000000000000000000000
|
||||
39 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000001001000011001010110110000000000000000000
|
||||
40 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000100100001100101011011000000000000000000
|
||||
41 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000010010000110010101101100000000000000000
|
||||
42 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000001001000011001010110110000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00000000100100001100101011011000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 00000000010010000110010101101100000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 00000000001001000011001010110110000000000000000000000000000000000000000000000000
|
@ -0,0 +1,134 @@
|
||||
SELECT 'String ConstConst';
|
||||
SELECT bin('Hello') == bin(bitShiftRight('Hello', 0));
|
||||
SELECT 0, 'Hello',bin(bitShiftRight('Hello', 0));
|
||||
SELECT 1, 'Hello',bin(bitShiftRight('Hello', 1));
|
||||
SELECT 2, 'Hello',bin(bitShiftRight('Hello', 2));
|
||||
SELECT 3, 'Hello',bin(bitShiftRight('Hello', 3));
|
||||
SELECT 4, 'Hello',bin(bitShiftRight('Hello', 4));
|
||||
SELECT 5, 'Hello',bin(bitShiftRight('Hello', 5));
|
||||
SELECT 6, 'Hello',bin(bitShiftRight('Hello', 6));
|
||||
SELECT 7, 'Hello',bin(bitShiftRight('Hello', 7));
|
||||
SELECT 8, 'Hello',bin(bitShiftRight('Hello', 8));
|
||||
SELECT 9, 'Hello',bin(bitShiftRight('Hello', 9));
|
||||
SELECT 10,'Hello',bin(bitShiftRight('Hello', 10));
|
||||
SELECT 11,'Hello',bin(bitShiftRight('Hello', 11));
|
||||
SELECT 12,'Hello',bin(bitShiftRight('Hello', 12));
|
||||
SELECT 13,'Hello',bin(bitShiftRight('Hello', 13));
|
||||
SELECT 14,'Hello',bin(bitShiftRight('Hello', 14));
|
||||
SELECT 15,'Hello',bin(bitShiftRight('Hello', 15));
|
||||
SELECT 16,'Hello',bin(bitShiftRight('Hello', 16));
|
||||
SELECT 17,'Hello',bin(bitShiftRight('Hello', 17));
|
||||
SELECT 18,'Hello',bin(bitShiftRight('Hello', 18));
|
||||
SELECT 19,'Hello',bin(bitShiftRight('Hello', 19));
|
||||
SELECT 20,'Hello',bin(bitShiftRight('Hello', 20));
|
||||
SELECT 21,'Hello',bin(bitShiftRight('Hello', 21));
|
||||
SELECT 22,'Hello',bin(bitShiftRight('Hello', 22));
|
||||
SELECT 23,'Hello',bin(bitShiftRight('Hello', 23));
|
||||
SELECT 24,'Hello',bin(bitShiftRight('Hello', 24));
|
||||
SELECT 25,'Hello',bin(bitShiftRight('Hello', 25));
|
||||
SELECT 26,'Hello',bin(bitShiftRight('Hello', 26));
|
||||
SELECT 27,'Hello',bin(bitShiftRight('Hello', 27));
|
||||
SELECT 28,'Hello',bin(bitShiftRight('Hello', 28));
|
||||
SELECT 29,'Hello',bin(bitShiftRight('Hello', 29));
|
||||
SELECT 30,'Hello',bin(bitShiftRight('Hello', 30));
|
||||
SELECT 31,'Hello',bin(bitShiftRight('Hello', 31));
|
||||
SELECT 32,'Hello',bin(bitShiftRight('Hello', 32));
|
||||
SELECT 33,'Hello',bin(bitShiftRight('Hello', 33));
|
||||
SELECT 34,'Hello',bin(bitShiftRight('Hello', 34));
|
||||
SELECT 35,'Hello',bin(bitShiftRight('Hello', 35));
|
||||
SELECT 36,'Hello',bin(bitShiftRight('Hello', 36));
|
||||
SELECT 37,'Hello',bin(bitShiftRight('Hello', 37));
|
||||
SELECT 38,'Hello',bin(bitShiftRight('Hello', 38));
|
||||
SELECT 39,'Hello',bin(bitShiftRight('Hello', 39));
|
||||
SELECT 40,'Hello',bin(bitShiftRight('Hello', 40));
|
||||
SELECT 41,'Hello',bin(bitShiftRight('Hello', 41));
|
||||
SELECT 42,'Hello',bin(bitShiftRight('Hello', 42));
|
||||
|
||||
SELECT 'FixedString ConstConst';
|
||||
SELECT bin(toFixedString('Hello', 10)) == bin(bitShiftRight(toFixedString('Hello', 10), 0));
|
||||
SELECT 0, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 0));
|
||||
SELECT 1, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 1));
|
||||
SELECT 2, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 2));
|
||||
SELECT 3, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 3));
|
||||
SELECT 4, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 4));
|
||||
SELECT 5, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 5));
|
||||
SELECT 6, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 6));
|
||||
SELECT 7, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 7));
|
||||
SELECT 8, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 8));
|
||||
SELECT 9, toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 9));
|
||||
SELECT 10,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 10));
|
||||
SELECT 11,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 11));
|
||||
SELECT 12,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 12));
|
||||
SELECT 13,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 13));
|
||||
SELECT 14,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 14));
|
||||
SELECT 15,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 15));
|
||||
SELECT 16,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 16));
|
||||
SELECT 17,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 17));
|
||||
SELECT 18,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 18));
|
||||
SELECT 19,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 19));
|
||||
SELECT 20,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 20));
|
||||
SELECT 21,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 21));
|
||||
SELECT 22,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 22));
|
||||
SELECT 23,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 23));
|
||||
SELECT 24,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 24));
|
||||
SELECT 25,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 25));
|
||||
SELECT 26,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 26));
|
||||
SELECT 27,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 27));
|
||||
SELECT 28,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 28));
|
||||
SELECT 29,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 29));
|
||||
SELECT 30,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 30));
|
||||
SELECT 31,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 31));
|
||||
SELECT 32,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 32));
|
||||
SELECT 33,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 33));
|
||||
SELECT 34,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 34));
|
||||
SELECT 35,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 35));
|
||||
SELECT 36,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 36));
|
||||
SELECT 37,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 37));
|
||||
SELECT 38,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 38));
|
||||
SELECT 39,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 39));
|
||||
SELECT 40,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 40));
|
||||
SELECT 41,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 41));
|
||||
SELECT 42,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 42));
|
||||
SELECT 77,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 77));
|
||||
SELECT 78,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 78));
|
||||
SELECT 79,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 79));
|
||||
SELECT 80,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 80));
|
||||
SELECT 81,toFixedString('Hello', 10), bin(bitShiftRight(toFixedString('Hello', 10), 81));
|
||||
|
||||
DROP TABLE IF EXISTS test_bit_shift_right_string_integer;
|
||||
|
||||
CREATE TABLE test_bit_shift_right_string_integer (str String, fixedStr FixedString(10), id Int64) engine=Log;
|
||||
|
||||
INSERT INTO test_bit_shift_right_string_integer VALUES('Hello','Hello',-1)('Hello','Hello',0),('Hello','Hello',1),('Hello','Hello',7),('Hello','Hello',8),('Hello','Hello',9),('Hello','Hello',15),('Hello','Hello',16),('Hello','Hello',17),('Hello','Hello',23),('Hello','Hello',24),('Hello','Hello',25),('Hello','Hello',31),('Hello','Hello',32),('Hello','Hello',33),('Hello','Hello',39),('Hello','Hello',40),('Hello','Hello',41),('Hello','Hello',42),('Hel','Hel',7),('Hel','Hel',8),('Hel','Hel',9);
|
||||
|
||||
SELECT bin(bitShiftRight('Hello', 42)); --A blank line
|
||||
SELECT 'String VectorVector';
|
||||
SELECT id as shift_right_bit,str as arg,bin(bitShiftRight(str, id)) as string_res FROM test_bit_shift_right_string_integer;
|
||||
SELECT id as shift_right_bit,str as arg,bin(bitShiftRight(str, id)) as string_res FROM test_bit_shift_right_string_integer WHERE (str='Hello' AND (id=23 OR id=24 OR id=25)) OR (str='Hel' AND (id=7 OR id=8 OR id=9));
|
||||
|
||||
SELECT bin(bitShiftRight('Hello', 42));
|
||||
SELECT 'FixedString VectorVector';
|
||||
SELECT id as shift_right_bit,fixedStr as arg,bin(bitShiftRight(fixedStr, id)) as fixed_string_res FROM test_bit_shift_right_string_integer;
|
||||
SELECT id as shift_right_bit,fixedStr as arg,bin(bitShiftRight(fixedStr, id)) as fixed_string_res FROM test_bit_shift_right_string_integer WHERE (str='Hello' AND (id=23 OR id=24 OR id=25)) OR (str='Hel' AND (id=7 OR id=8 OR id=9));
|
||||
|
||||
SELECT bin(bitShiftRight('Hello', 42)); --A blank line
|
||||
SELECT 'String VectorConst';
|
||||
SELECT 7 as shift_right_bit,str as arg,bin(bitShiftRight(str, 7)) as string_res FROM test_bit_shift_right_string_integer;
|
||||
SELECT 8 as shift_right_bit,str as arg,bin(bitShiftRight(str, 8)) as string_res FROM test_bit_shift_right_string_integer;
|
||||
|
||||
SELECT bin(bitShiftRight('Hello', 42)); --A blank line
|
||||
SELECT 'FixedString VectorConst';
|
||||
SELECT 7 as shift_right_bit,fixedStr as arg,bin(bitShiftRight(fixedStr, 7)) as fixed_string_res FROM test_bit_shift_right_string_integer;
|
||||
SELECT 8 as shift_right_bit,fixedStr as arg,bin(bitShiftRight(fixedStr, 8)) as fixed_string_res FROM test_bit_shift_right_string_integer;
|
||||
|
||||
SELECT bin(bitShiftRight('Hello', 42)); --A blank line
|
||||
SELECT 'String ConstVector';
|
||||
SELECT id as shift_right_bit,'Hello' as arg,bin(bitShiftRight('Hello', id)) as string_res FROM test_bit_shift_right_string_integer;
|
||||
SELECT id as shift_right_bit,'Hel' as arg,bin(bitShiftRight('Hel', id)) as string_res FROM test_bit_shift_right_string_integer;
|
||||
|
||||
SELECT bin(bitShiftRight('Hello', 42)); --A blank line
|
||||
SELECT 'FixedString ConstVector';
|
||||
SELECT id as shift_right_bit,toFixedString('Hello', 10) as arg,bin(bitShiftRight(toFixedString('Hello', 10), id)) as fixed_string_res FROM test_bit_shift_right_string_integer;
|
||||
SELECT id as shift_right_bit,toFixedString('Hel', 10) as arg,bin(bitShiftRight(toFixedString('Hel', 10), id)) as fixed_string_res FROM test_bit_shift_right_string_integer;
|
||||
|
||||
DROP TABLE IF EXISTS test_bit_shift_right_string_integer;
|
@ -0,0 +1,339 @@
|
||||
String ConstConst
|
||||
1
|
||||
0 Hello 0100100001100101011011000110110001101111
|
||||
1 Hello 000000001001000011001010110110001101100011011110
|
||||
2 Hello 000000010010000110010101101100011011000110111100
|
||||
3 Hello 000000100100001100101011011000110110001101111000
|
||||
4 Hello 000001001000011001010110110001101100011011110000
|
||||
5 Hello 000010010000110010101101100011011000110111100000
|
||||
6 Hello 000100100001100101011011000110110001101111000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
9 Hello 00000000100100001100101011011000110110001101111000000000
|
||||
10 Hello 00000001001000011001010110110001101100011011110000000000
|
||||
11 Hello 00000010010000110010101101100011011000110111100000000000
|
||||
12 Hello 00000100100001100101011011000110110001101111000000000000
|
||||
13 Hello 00001001000011001010110110001101100011011110000000000000
|
||||
14 Hello 00010010000110010101101100011011000110111100000000000000
|
||||
15 Hello 00100100001100101011011000110110001101111000000000000000
|
||||
16 Hello 01001000011001010110110001101100011011110000000000000000
|
||||
17 Hello 0000000010010000110010101101100011011000110111100000000000000000
|
||||
18 Hello 0000000100100001100101011011000110110001101111000000000000000000
|
||||
19 Hello 0000001001000011001010110110001101100011011110000000000000000000
|
||||
20 Hello 0000010010000110010101101100011011000110111100000000000000000000
|
||||
21 Hello 0000100100001100101011011000110110001101111000000000000000000000
|
||||
22 Hello 0001001000011001010110110001101100011011110000000000000000000000
|
||||
23 Hello 0010010000110010101101100011011000110111100000000000000000000000
|
||||
24 Hello 0100100001100101011011000110110001101111000000000000000000000000
|
||||
25 Hello 000000001001000011001010110110001101100011011110000000000000000000000000
|
||||
26 Hello 000000010010000110010101101100011011000110111100000000000000000000000000
|
||||
27 Hello 000000100100001100101011011000110110001101111000000000000000000000000000
|
||||
28 Hello 000001001000011001010110110001101100011011110000000000000000000000000000
|
||||
29 Hello 000010010000110010101101100011011000110111100000000000000000000000000000
|
||||
30 Hello 000100100001100101011011000110110001101111000000000000000000000000000000
|
||||
31 Hello 001001000011001010110110001101100011011110000000000000000000000000000000
|
||||
32 Hello 010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
33 Hello 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
34 Hello 00000001001000011001010110110001101100011011110000000000000000000000000000000000
|
||||
35 Hello 00000010010000110010101101100011011000110111100000000000000000000000000000000000
|
||||
36 Hello 00000100100001100101011011000110110001101111000000000000000000000000000000000000
|
||||
37 Hello 00001001000011001010110110001101100011011110000000000000000000000000000000000000
|
||||
38 Hello 00010010000110010101101100011011000110111100000000000000000000000000000000000000
|
||||
39 Hello 00100100001100101011011000110110001101111000000000000000000000000000000000000000
|
||||
40 Hello
|
||||
41 Hello
|
||||
42 Hello
|
||||
FixedString ConstConst
|
||||
1
|
||||
0 Hello\0\0\0\0\0 01001000011001010110110001101100011011110000000000000000000000000000000000000000
|
||||
1 Hello\0\0\0\0\0 10010000110010101101100011011000110111100000000000000000000000000000000000000000
|
||||
2 Hello\0\0\0\0\0 00100001100101011011000110110001101111000000000000000000000000000000000000000000
|
||||
3 Hello\0\0\0\0\0 01000011001010110110001101100011011110000000000000000000000000000000000000000000
|
||||
4 Hello\0\0\0\0\0 10000110010101101100011011000110111100000000000000000000000000000000000000000000
|
||||
5 Hello\0\0\0\0\0 00001100101011011000110110001101111000000000000000000000000000000000000000000000
|
||||
6 Hello\0\0\0\0\0 00011001010110110001101100011011110000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 11001010110110001101100011011110000000000000000000000000000000000000000000000000
|
||||
10 Hello\0\0\0\0\0 10010101101100011011000110111100000000000000000000000000000000000000000000000000
|
||||
11 Hello\0\0\0\0\0 00101011011000110110001101111000000000000000000000000000000000000000000000000000
|
||||
12 Hello\0\0\0\0\0 01010110110001101100011011110000000000000000000000000000000000000000000000000000
|
||||
13 Hello\0\0\0\0\0 10101101100011011000110111100000000000000000000000000000000000000000000000000000
|
||||
14 Hello\0\0\0\0\0 01011011000110110001101111000000000000000000000000000000000000000000000000000000
|
||||
15 Hello\0\0\0\0\0 10110110001101100011011110000000000000000000000000000000000000000000000000000000
|
||||
16 Hello\0\0\0\0\0 01101100011011000110111100000000000000000000000000000000000000000000000000000000
|
||||
17 Hello\0\0\0\0\0 11011000110110001101111000000000000000000000000000000000000000000000000000000000
|
||||
18 Hello\0\0\0\0\0 10110001101100011011110000000000000000000000000000000000000000000000000000000000
|
||||
19 Hello\0\0\0\0\0 01100011011000110111100000000000000000000000000000000000000000000000000000000000
|
||||
20 Hello\0\0\0\0\0 11000110110001101111000000000000000000000000000000000000000000000000000000000000
|
||||
21 Hello\0\0\0\0\0 10001101100011011110000000000000000000000000000000000000000000000000000000000000
|
||||
22 Hello\0\0\0\0\0 00011011000110111100000000000000000000000000000000000000000000000000000000000000
|
||||
23 Hello\0\0\0\0\0 00110110001101111000000000000000000000000000000000000000000000000000000000000000
|
||||
24 Hello\0\0\0\0\0 01101100011011110000000000000000000000000000000000000000000000000000000000000000
|
||||
25 Hello\0\0\0\0\0 11011000110111100000000000000000000000000000000000000000000000000000000000000000
|
||||
26 Hello\0\0\0\0\0 10110001101111000000000000000000000000000000000000000000000000000000000000000000
|
||||
27 Hello\0\0\0\0\0 01100011011110000000000000000000000000000000000000000000000000000000000000000000
|
||||
28 Hello\0\0\0\0\0 11000110111100000000000000000000000000000000000000000000000000000000000000000000
|
||||
29 Hello\0\0\0\0\0 10001101111000000000000000000000000000000000000000000000000000000000000000000000
|
||||
30 Hello\0\0\0\0\0 00011011110000000000000000000000000000000000000000000000000000000000000000000000
|
||||
31 Hello\0\0\0\0\0 00110111100000000000000000000000000000000000000000000000000000000000000000000000
|
||||
32 Hello\0\0\0\0\0 01101111000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
33 Hello\0\0\0\0\0 11011110000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
34 Hello\0\0\0\0\0 10111100000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
35 Hello\0\0\0\0\0 01111000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
36 Hello\0\0\0\0\0 11110000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
37 Hello\0\0\0\0\0 11100000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
38 Hello\0\0\0\0\0 11000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
39 Hello\0\0\0\0\0 10000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
40 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
41 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
42 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
77 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
78 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
79 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
80 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
81 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
String VectorVector
|
||||
-1 Hello
|
||||
0 Hello 0100100001100101011011000110110001101111
|
||||
1 Hello 000000001001000011001010110110001101100011011110
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
9 Hello 00000000100100001100101011011000110110001101111000000000
|
||||
15 Hello 00100100001100101011011000110110001101111000000000000000
|
||||
16 Hello 01001000011001010110110001101100011011110000000000000000
|
||||
17 Hello 0000000010010000110010101101100011011000110111100000000000000000
|
||||
23 Hello 0010010000110010101101100011011000110111100000000000000000000000
|
||||
24 Hello 0100100001100101011011000110110001101111000000000000000000000000
|
||||
25 Hello 000000001001000011001010110110001101100011011110000000000000000000000000
|
||||
31 Hello 001001000011001010110110001101100011011110000000000000000000000000000000
|
||||
32 Hello 010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
33 Hello 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
39 Hello 00100100001100101011011000110110001101111000000000000000000000000000000000000000
|
||||
40 Hello
|
||||
41 Hello
|
||||
42 Hello
|
||||
7 Hel 00100100001100101011011000000000
|
||||
8 Hel 01001000011001010110110000000000
|
||||
9 Hel 0000000010010000110010101101100000000000
|
||||
23 Hello 0010010000110010101101100011011000110111100000000000000000000000
|
||||
24 Hello 0100100001100101011011000110110001101111000000000000000000000000
|
||||
25 Hello 000000001001000011001010110110001101100011011110000000000000000000000000
|
||||
7 Hel 00100100001100101011011000000000
|
||||
8 Hel 01001000011001010110110000000000
|
||||
9 Hel 0000000010010000110010101101100000000000
|
||||
|
||||
FixedString VectorVector
|
||||
-1 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0 Hello\0\0\0\0\0 01001000011001010110110001101100011011110000000000000000000000000000000000000000
|
||||
1 Hello\0\0\0\0\0 10010000110010101101100011011000110111100000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 11001010110110001101100011011110000000000000000000000000000000000000000000000000
|
||||
15 Hello\0\0\0\0\0 10110110001101100011011110000000000000000000000000000000000000000000000000000000
|
||||
16 Hello\0\0\0\0\0 01101100011011000110111100000000000000000000000000000000000000000000000000000000
|
||||
17 Hello\0\0\0\0\0 11011000110110001101111000000000000000000000000000000000000000000000000000000000
|
||||
23 Hello\0\0\0\0\0 00110110001101111000000000000000000000000000000000000000000000000000000000000000
|
||||
24 Hello\0\0\0\0\0 01101100011011110000000000000000000000000000000000000000000000000000000000000000
|
||||
25 Hello\0\0\0\0\0 11011000110111100000000000000000000000000000000000000000000000000000000000000000
|
||||
31 Hello\0\0\0\0\0 00110111100000000000000000000000000000000000000000000000000000000000000000000000
|
||||
32 Hello\0\0\0\0\0 01101111000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
33 Hello\0\0\0\0\0 11011110000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
39 Hello\0\0\0\0\0 10000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
40 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
41 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
42 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00110010101101100000000000000000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 01100101011011000000000000000000000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 11001010110110000000000000000000000000000000000000000000000000000000000000000000
|
||||
23 Hello\0\0\0\0\0 00110110001101111000000000000000000000000000000000000000000000000000000000000000
|
||||
24 Hello\0\0\0\0\0 01101100011011110000000000000000000000000000000000000000000000000000000000000000
|
||||
25 Hello\0\0\0\0\0 11011000110111100000000000000000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00110010101101100000000000000000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 01100101011011000000000000000000000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 11001010110110000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
String VectorConst
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
7 Hel 00100100001100101011011000000000
|
||||
7 Hel 00100100001100101011011000000000
|
||||
7 Hel 00100100001100101011011000000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
8 Hel 01001000011001010110110000000000
|
||||
8 Hel 01001000011001010110110000000000
|
||||
8 Hel 01001000011001010110110000000000
|
||||
|
||||
FixedString VectorConst
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00110010101101100000000000000000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00110010101101100000000000000000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00110010101101100000000000000000000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 01100101011011000000000000000000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 01100101011011000000000000000000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 01100101011011000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
String ConstVector
|
||||
-1 Hello
|
||||
0 Hello 0100100001100101011011000110110001101111
|
||||
1 Hello 000000001001000011001010110110001101100011011110
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
9 Hello 00000000100100001100101011011000110110001101111000000000
|
||||
15 Hello 00100100001100101011011000110110001101111000000000000000
|
||||
16 Hello 01001000011001010110110001101100011011110000000000000000
|
||||
17 Hello 0000000010010000110010101101100011011000110111100000000000000000
|
||||
23 Hello 0010010000110010101101100011011000110111100000000000000000000000
|
||||
24 Hello 0100100001100101011011000110110001101111000000000000000000000000
|
||||
25 Hello 000000001001000011001010110110001101100011011110000000000000000000000000
|
||||
31 Hello 001001000011001010110110001101100011011110000000000000000000000000000000
|
||||
32 Hello 010010000110010101101100011011000110111100000000000000000000000000000000
|
||||
33 Hello 00000000100100001100101011011000110110001101111000000000000000000000000000000000
|
||||
39 Hello 00100100001100101011011000110110001101111000000000000000000000000000000000000000
|
||||
40 Hello
|
||||
41 Hello
|
||||
42 Hello
|
||||
7 Hello 001001000011001010110110001101100011011110000000
|
||||
8 Hello 010010000110010101101100011011000110111100000000
|
||||
9 Hello 00000000100100001100101011011000110110001101111000000000
|
||||
-1 Hel
|
||||
0 Hel 010010000110010101101100
|
||||
1 Hel 00000000100100001100101011011000
|
||||
7 Hel 00100100001100101011011000000000
|
||||
8 Hel 01001000011001010110110000000000
|
||||
9 Hel 0000000010010000110010101101100000000000
|
||||
15 Hel 0010010000110010101101100000000000000000
|
||||
16 Hel 0100100001100101011011000000000000000000
|
||||
17 Hel 000000001001000011001010110110000000000000000000
|
||||
23 Hel 001001000011001010110110000000000000000000000000
|
||||
24 Hel
|
||||
25 Hel
|
||||
31 Hel
|
||||
32 Hel
|
||||
33 Hel
|
||||
39 Hel
|
||||
40 Hel
|
||||
41 Hel
|
||||
42 Hel
|
||||
7 Hel 00100100001100101011011000000000
|
||||
8 Hel 01001000011001010110110000000000
|
||||
9 Hel 0000000010010000110010101101100000000000
|
||||
|
||||
FixedString ConstVector
|
||||
-1 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0 Hello\0\0\0\0\0 01001000011001010110110001101100011011110000000000000000000000000000000000000000
|
||||
1 Hello\0\0\0\0\0 10010000110010101101100011011000110111100000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 11001010110110001101100011011110000000000000000000000000000000000000000000000000
|
||||
15 Hello\0\0\0\0\0 10110110001101100011011110000000000000000000000000000000000000000000000000000000
|
||||
16 Hello\0\0\0\0\0 01101100011011000110111100000000000000000000000000000000000000000000000000000000
|
||||
17 Hello\0\0\0\0\0 11011000110110001101111000000000000000000000000000000000000000000000000000000000
|
||||
23 Hello\0\0\0\0\0 00110110001101111000000000000000000000000000000000000000000000000000000000000000
|
||||
24 Hello\0\0\0\0\0 01101100011011110000000000000000000000000000000000000000000000000000000000000000
|
||||
25 Hello\0\0\0\0\0 11011000110111100000000000000000000000000000000000000000000000000000000000000000
|
||||
31 Hello\0\0\0\0\0 00110111100000000000000000000000000000000000000000000000000000000000000000000000
|
||||
32 Hello\0\0\0\0\0 01101111000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
33 Hello\0\0\0\0\0 11011110000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
39 Hello\0\0\0\0\0 10000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
40 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
41 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
42 Hello\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
7 Hello\0\0\0\0\0 00110010101101100011011000110111100000000000000000000000000000000000000000000000
|
||||
8 Hello\0\0\0\0\0 01100101011011000110110001101111000000000000000000000000000000000000000000000000
|
||||
9 Hello\0\0\0\0\0 11001010110110001101100011011110000000000000000000000000000000000000000000000000
|
||||
-1 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0 Hel\0\0\0\0\0\0\0 01001000011001010110110000000000000000000000000000000000000000000000000000000000
|
||||
1 Hel\0\0\0\0\0\0\0 10010000110010101101100000000000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00110010101101100000000000000000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 01100101011011000000000000000000000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 11001010110110000000000000000000000000000000000000000000000000000000000000000000
|
||||
15 Hel\0\0\0\0\0\0\0 10110110000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
16 Hel\0\0\0\0\0\0\0 01101100000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
17 Hel\0\0\0\0\0\0\0 11011000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
23 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
24 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
25 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
31 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
32 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
33 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
39 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
40 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
41 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
42 Hel\0\0\0\0\0\0\0 00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
7 Hel\0\0\0\0\0\0\0 00110010101101100000000000000000000000000000000000000000000000000000000000000000
|
||||
8 Hel\0\0\0\0\0\0\0 01100101011011000000000000000000000000000000000000000000000000000000000000000000
|
||||
9 Hel\0\0\0\0\0\0\0 11001010110110000000000000000000000000000000000000000000000000000000000000000000
|
@ -0,0 +1,134 @@
|
||||
SELECT 'String ConstConst';
|
||||
SELECT bin('Hello') == bin(bitShiftLeft('Hello', 0));
|
||||
SELECT 0, 'Hello',bin(bitShiftLeft('Hello', 0));
|
||||
SELECT 1, 'Hello',bin(bitShiftLeft('Hello', 1));
|
||||
SELECT 2, 'Hello',bin(bitShiftLeft('Hello', 2));
|
||||
SELECT 3, 'Hello',bin(bitShiftLeft('Hello', 3));
|
||||
SELECT 4, 'Hello',bin(bitShiftLeft('Hello', 4));
|
||||
SELECT 5, 'Hello',bin(bitShiftLeft('Hello', 5));
|
||||
SELECT 6, 'Hello',bin(bitShiftLeft('Hello', 6));
|
||||
SELECT 7, 'Hello',bin(bitShiftLeft('Hello', 7));
|
||||
SELECT 8, 'Hello',bin(bitShiftLeft('Hello', 8));
|
||||
SELECT 9, 'Hello',bin(bitShiftLeft('Hello', 9));
|
||||
SELECT 10,'Hello',bin(bitShiftLeft('Hello', 10));
|
||||
SELECT 11,'Hello',bin(bitShiftLeft('Hello', 11));
|
||||
SELECT 12,'Hello',bin(bitShiftLeft('Hello', 12));
|
||||
SELECT 13,'Hello',bin(bitShiftLeft('Hello', 13));
|
||||
SELECT 14,'Hello',bin(bitShiftLeft('Hello', 14));
|
||||
SELECT 15,'Hello',bin(bitShiftLeft('Hello', 15));
|
||||
SELECT 16,'Hello',bin(bitShiftLeft('Hello', 16));
|
||||
SELECT 17,'Hello',bin(bitShiftLeft('Hello', 17));
|
||||
SELECT 18,'Hello',bin(bitShiftLeft('Hello', 18));
|
||||
SELECT 19,'Hello',bin(bitShiftLeft('Hello', 19));
|
||||
SELECT 20,'Hello',bin(bitShiftLeft('Hello', 20));
|
||||
SELECT 21,'Hello',bin(bitShiftLeft('Hello', 21));
|
||||
SELECT 22,'Hello',bin(bitShiftLeft('Hello', 22));
|
||||
SELECT 23,'Hello',bin(bitShiftLeft('Hello', 23));
|
||||
SELECT 24,'Hello',bin(bitShiftLeft('Hello', 24));
|
||||
SELECT 25,'Hello',bin(bitShiftLeft('Hello', 25));
|
||||
SELECT 26,'Hello',bin(bitShiftLeft('Hello', 26));
|
||||
SELECT 27,'Hello',bin(bitShiftLeft('Hello', 27));
|
||||
SELECT 28,'Hello',bin(bitShiftLeft('Hello', 28));
|
||||
SELECT 29,'Hello',bin(bitShiftLeft('Hello', 29));
|
||||
SELECT 30,'Hello',bin(bitShiftLeft('Hello', 30));
|
||||
SELECT 31,'Hello',bin(bitShiftLeft('Hello', 31));
|
||||
SELECT 32,'Hello',bin(bitShiftLeft('Hello', 32));
|
||||
SELECT 33,'Hello',bin(bitShiftLeft('Hello', 33));
|
||||
SELECT 34,'Hello',bin(bitShiftLeft('Hello', 34));
|
||||
SELECT 35,'Hello',bin(bitShiftLeft('Hello', 35));
|
||||
SELECT 36,'Hello',bin(bitShiftLeft('Hello', 36));
|
||||
SELECT 37,'Hello',bin(bitShiftLeft('Hello', 37));
|
||||
SELECT 38,'Hello',bin(bitShiftLeft('Hello', 38));
|
||||
SELECT 39,'Hello',bin(bitShiftLeft('Hello', 39));
|
||||
SELECT 40,'Hello',bin(bitShiftLeft('Hello', 40));
|
||||
SELECT 41,'Hello',bin(bitShiftLeft('Hello', 41));
|
||||
SELECT 42,'Hello',bin(bitShiftLeft('Hello', 42));
|
||||
|
||||
SELECT 'FixedString ConstConst';
|
||||
SELECT bin(toFixedString('Hello', 10)) == bin(bitShiftLeft(toFixedString('Hello', 10), 0));
|
||||
SELECT 0, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 0));
|
||||
SELECT 1, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 1));
|
||||
SELECT 2, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 2));
|
||||
SELECT 3, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 3));
|
||||
SELECT 4, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 4));
|
||||
SELECT 5, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 5));
|
||||
SELECT 6, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 6));
|
||||
SELECT 7, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 7));
|
||||
SELECT 8, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 8));
|
||||
SELECT 9, toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 9));
|
||||
SELECT 10,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 10));
|
||||
SELECT 11,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 11));
|
||||
SELECT 12,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 12));
|
||||
SELECT 13,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 13));
|
||||
SELECT 14,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 14));
|
||||
SELECT 15,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 15));
|
||||
SELECT 16,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 16));
|
||||
SELECT 17,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 17));
|
||||
SELECT 18,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 18));
|
||||
SELECT 19,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 19));
|
||||
SELECT 20,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 20));
|
||||
SELECT 21,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 21));
|
||||
SELECT 22,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 22));
|
||||
SELECT 23,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 23));
|
||||
SELECT 24,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 24));
|
||||
SELECT 25,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 25));
|
||||
SELECT 26,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 26));
|
||||
SELECT 27,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 27));
|
||||
SELECT 28,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 28));
|
||||
SELECT 29,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 29));
|
||||
SELECT 30,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 30));
|
||||
SELECT 31,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 31));
|
||||
SELECT 32,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 32));
|
||||
SELECT 33,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 33));
|
||||
SELECT 34,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 34));
|
||||
SELECT 35,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 35));
|
||||
SELECT 36,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 36));
|
||||
SELECT 37,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 37));
|
||||
SELECT 38,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 38));
|
||||
SELECT 39,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 39));
|
||||
SELECT 40,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 40));
|
||||
SELECT 41,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 41));
|
||||
SELECT 42,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 42));
|
||||
SELECT 77,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 77));
|
||||
SELECT 78,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 78));
|
||||
SELECT 79,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 79));
|
||||
SELECT 80,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 80));
|
||||
SELECT 81,toFixedString('Hello', 10), bin(bitShiftLeft(toFixedString('Hello', 10), 81));
|
||||
|
||||
DROP TABLE IF EXISTS test_bit_shift_left_string_integer;
|
||||
|
||||
CREATE TABLE test_bit_shift_left_string_integer (str String, fixedStr FixedString(10), id Int64) engine=Log;
|
||||
|
||||
INSERT INTO test_bit_shift_left_string_integer VALUES('Hello','Hello',-1)('Hello','Hello',0),('Hello','Hello',1),('Hello','Hello',7),('Hello','Hello',8),('Hello','Hello',9),('Hello','Hello',15),('Hello','Hello',16),('Hello','Hello',17),('Hello','Hello',23),('Hello','Hello',24),('Hello','Hello',25),('Hello','Hello',31),('Hello','Hello',32),('Hello','Hello',33),('Hello','Hello',39),('Hello','Hello',40),('Hello','Hello',41),('Hello','Hello',42),('Hel','Hel',7),('Hel','Hel',8),('Hel','Hel',9);
|
||||
|
||||
SELECT bin(bitShiftLeft('Hello', 42)); --A blank line
|
||||
SELECT 'String VectorVector';
|
||||
SELECT id as shift_right_bit,str as arg,bin(bitShiftLeft(str, id)) as string_res FROM test_bit_shift_left_string_integer;
|
||||
SELECT id as shift_right_bit,str as arg,bin(bitShiftLeft(str, id)) as string_res FROM test_bit_shift_left_string_integer WHERE (str='Hello' AND (id=23 OR id=24 OR id=25)) OR (str='Hel' AND (id=7 OR id=8 OR id=9));
|
||||
|
||||
SELECT bin(bitShiftLeft('Hello', 42));
|
||||
SELECT 'FixedString VectorVector';
|
||||
SELECT id as shift_right_bit,fixedStr as arg,bin(bitShiftLeft(fixedStr, id)) as fixed_string_res FROM test_bit_shift_left_string_integer;
|
||||
SELECT id as shift_right_bit,fixedStr as arg,bin(bitShiftLeft(fixedStr, id)) as fixed_string_res FROM test_bit_shift_left_string_integer WHERE (str='Hello' AND (id=23 OR id=24 OR id=25)) OR (str='Hel' AND (id=7 OR id=8 OR id=9));
|
||||
|
||||
SELECT bin(bitShiftLeft('Hello', 42)); --A blank line
|
||||
SELECT 'String VectorConst';
|
||||
SELECT 7 as shift_right_bit,str as arg,bin(bitShiftLeft(str, 7)) as string_res FROM test_bit_shift_left_string_integer;
|
||||
SELECT 8 as shift_right_bit,str as arg,bin(bitShiftLeft(str, 8)) as string_res FROM test_bit_shift_left_string_integer;
|
||||
|
||||
SELECT bin(bitShiftLeft('Hello', 42)); --A blank line
|
||||
SELECT 'FixedString VectorConst';
|
||||
SELECT 7 as shift_right_bit,fixedStr as arg,bin(bitShiftLeft(fixedStr, 7)) as fixed_string_res FROM test_bit_shift_left_string_integer;
|
||||
SELECT 8 as shift_right_bit,fixedStr as arg,bin(bitShiftLeft(fixedStr, 8)) as fixed_string_res FROM test_bit_shift_left_string_integer;
|
||||
|
||||
SELECT bin(bitShiftLeft('Hello', 42)); --A blank line
|
||||
SELECT 'String ConstVector';
|
||||
SELECT id as shift_right_bit,'Hello' as arg,bin(bitShiftLeft('Hello', id)) as string_res FROM test_bit_shift_left_string_integer;
|
||||
SELECT id as shift_right_bit,'Hel' as arg,bin(bitShiftLeft('Hel', id)) as string_res FROM test_bit_shift_left_string_integer;
|
||||
|
||||
SELECT bin(bitShiftLeft('Hello', 42)); --A blank line
|
||||
SELECT 'FixedString ConstVector';
|
||||
SELECT id as shift_right_bit,toFixedString('Hello', 10) as arg,bin(bitShiftLeft(toFixedString('Hello', 10), id)) as fixed_string_res FROM test_bit_shift_left_string_integer;
|
||||
SELECT id as shift_right_bit,toFixedString('Hel', 10) as arg,bin(bitShiftLeft(toFixedString('Hel', 10), id)) as fixed_string_res FROM test_bit_shift_left_string_integer;
|
||||
|
||||
DROP TABLE IF EXISTS test_bit_shift_left_string_integer;
|
@ -0,0 +1 @@
|
||||
21585718595728998
|
10
tests/queries/0_stateless/02023_nullable_int_uint_where.sql
Normal file
10
tests/queries/0_stateless/02023_nullable_int_uint_where.sql
Normal file
@ -0,0 +1,10 @@
|
||||
drop table if exists t1;
|
||||
|
||||
set allow_suspicious_low_cardinality_types = 1;
|
||||
create table t1 (id LowCardinality(Nullable(Int64))) engine MergeTree order by id settings allow_nullable_key = 1, index_granularity = 1;
|
||||
|
||||
insert into t1 values (21585718595728998), (null);
|
||||
|
||||
select * from t1 where id = 21585718595728998;
|
||||
|
||||
drop table t1;
|
@ -0,0 +1,10 @@
|
||||
Hello, World! From client.
|
||||
Hello, World! From client.
|
||||
Hello, World! From client.
|
||||
Hello, World! From client.
|
||||
Hello, World! From client.
|
||||
Hello, World! From local.
|
||||
Hello, World! From local.
|
||||
Hello, World! From local.
|
||||
Hello, World! From local.
|
||||
Hello, World! From local.
|
84
tests/queries/0_stateless/02024_compression_in_query.sh
Executable file
84
tests/queries/0_stateless/02024_compression_in_query.sh
Executable file
@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
set -e
|
||||
|
||||
#____________________CLIENT__________________
|
||||
# clear files from previous tests.
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output.gz ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output.gz
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz.gz ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz.gz
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz_to_decomp ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz_to_decomp
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_to_decomp ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_to_decomp
|
||||
|
||||
# create files using compression method and without it to check that both queries work correct
|
||||
${CLICKHOUSE_CLIENT} --query "SELECT * FROM (SELECT 'Hello, World! From client.') INTO OUTFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz' FORMAT TabSeparated;"
|
||||
${CLICKHOUSE_CLIENT} --query "SELECT * FROM (SELECT 'Hello, World! From client.') INTO OUTFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz' COMPRESSION 'GZ' FORMAT TabSeparated;"
|
||||
|
||||
# check content of files
|
||||
cp ${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp.gz
|
||||
gunzip ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp.gz
|
||||
cat ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp
|
||||
|
||||
cp ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp.gz
|
||||
gunzip ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp.gz
|
||||
cat ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp
|
||||
|
||||
# create table to check inserts
|
||||
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS test_compression_keyword;"
|
||||
${CLICKHOUSE_CLIENT} --query "CREATE TABLE test_compression_keyword (text String) Engine=Memory;"
|
||||
|
||||
# insert them
|
||||
${CLICKHOUSE_CLIENT} --query "INSERT INTO TABLE test_compression_keyword FROM INFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz' FORMAT TabSeparated;"
|
||||
${CLICKHOUSE_CLIENT} --query "INSERT INTO TABLE test_compression_keyword FROM INFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz' COMPRESSION 'gz' FORMAT TabSeparated;"
|
||||
${CLICKHOUSE_CLIENT} --query "INSERT INTO TABLE test_compression_keyword FROM INFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz' COMPRESSION 'gz' FORMAT TabSeparated;"
|
||||
|
||||
# check result
|
||||
${CLICKHOUSE_CLIENT} --query "SELECT * FROM test_compression_keyword;"
|
||||
|
||||
# delete all created elements
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp"
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz"
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp"
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz"
|
||||
${CLICKHOUSE_CLIENT} --query "DROP TABLE IF EXISTS test_compression_keyword;"
|
||||
|
||||
#____________________LOCAL__________________
|
||||
# clear files from previous tests.
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output.gz ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output.gz
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz
|
||||
[ -e "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz.gz ] && rm "${CLICKHOUSE_TMP}"/test_comp_for_input_and_output_without_gz.gz
|
||||
|
||||
# create files using compression method and without it to check that both queries work correct
|
||||
${CLICKHOUSE_LOCAL} --query "SELECT * FROM (SELECT 'Hello, World! From local.') INTO OUTFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz' FORMAT TabSeparated;"
|
||||
${CLICKHOUSE_LOCAL} --query "SELECT * FROM (SELECT 'Hello, World! From local.') INTO OUTFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz' COMPRESSION 'GZ' FORMAT TabSeparated;"
|
||||
|
||||
# check content of files
|
||||
cp ${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp.gz
|
||||
gunzip ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp.gz
|
||||
cat ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp
|
||||
|
||||
cp ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp.gz
|
||||
gunzip ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp.gz
|
||||
cat ${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp
|
||||
|
||||
# create table to check inserts
|
||||
${CLICKHOUSE_LOCAL} --query "
|
||||
DROP TABLE IF EXISTS test_compression_keyword;
|
||||
CREATE TABLE test_compression_keyword (text String) Engine=Memory;
|
||||
INSERT INTO TABLE test_compression_keyword FROM INFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz' FORMAT TabSeparated;
|
||||
INSERT INTO TABLE test_compression_keyword FROM INFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz' COMPRESSION 'gz' FORMAT TabSeparated;
|
||||
INSERT INTO TABLE test_compression_keyword FROM INFILE '${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz' COMPRESSION 'gz' FORMAT TabSeparated;
|
||||
SELECT * FROM test_compression_keyword;
|
||||
"
|
||||
|
||||
# delete all created elements
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output_to_decomp"
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output.gz"
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz_to_decomp"
|
||||
rm -f "${CLICKHOUSE_TMP}/test_comp_for_input_and_output_without_gz"
|
@ -0,0 +1,23 @@
|
||||
┌─name─┬─type────────────────────────────────────────────────┬─default_type─┬─default_expression─┬─comment─────────────────┬─codec_expression─┬─ttl_expression───────┐
|
||||
│ d │ Date │ │ │ │ │ │
|
||||
│ n │ Nullable(String) │ │ │ It is a nullable column │ │ │
|
||||
│ arr1 │ Array(UInt32) │ │ │ │ ZSTD(1) │ │
|
||||
│ arr2 │ Array(Array(String)) │ │ │ │ │ d + toIntervalDay(1) │
|
||||
│ t │ Tuple(s String, a Array(Tuple(a UInt32, b UInt32))) │ │ │ │ ZSTD(1) │ │
|
||||
└──────┴─────────────────────────────────────────────────────┴──────────────┴────────────────────┴─────────────────────────┴──────────────────┴──────────────────────┘
|
||||
┌─name───────┬─type────────────────────────────────────────────────┬─default_type─┬─default_expression─┬─comment─────────────────┬─codec_expression─┬─ttl_expression───────┬─is_subcolumn─┐
|
||||
│ d │ Date │ │ │ │ │ │ 0 │
|
||||
│ n │ Nullable(String) │ │ │ It is a nullable column │ │ │ 0 │
|
||||
│ arr1 │ Array(UInt32) │ │ │ │ ZSTD(1) │ │ 0 │
|
||||
│ arr2 │ Array(Array(String)) │ │ │ │ │ d + toIntervalDay(1) │ 0 │
|
||||
│ t │ Tuple(s String, a Array(Tuple(a UInt32, b UInt32))) │ │ │ │ ZSTD(1) │ │ 0 │
|
||||
│ n.null │ UInt8 │ │ │ It is a nullable column │ │ │ 1 │
|
||||
│ arr1.size0 │ UInt64 │ │ │ │ │ │ 1 │
|
||||
│ arr2.size0 │ UInt64 │ │ │ │ │ d + toIntervalDay(1) │ 1 │
|
||||
│ arr2.size1 │ Array(UInt64) │ │ │ │ │ d + toIntervalDay(1) │ 1 │
|
||||
│ t.s │ String │ │ │ │ ZSTD(1) │ │ 1 │
|
||||
│ t.a │ Array(Tuple(a UInt32, b UInt32)) │ │ │ │ │ │ 1 │
|
||||
│ t.a.size0 │ UInt64 │ │ │ │ │ │ 1 │
|
||||
│ t.a.a │ Array(UInt32) │ │ │ │ ZSTD(1) │ │ 1 │
|
||||
│ t.a.b │ Array(UInt32) │ │ │ │ ZSTD(1) │ │ 1 │
|
||||
└────────────┴─────────────────────────────────────────────────────┴──────────────┴────────────────────┴─────────────────────────┴──────────────────┴──────────────────────┴──────────────┘
|
@ -0,0 +1,18 @@
|
||||
DROP TABLE IF EXISTS t_desc_subcolumns;
|
||||
|
||||
CREATE TABLE t_desc_subcolumns
|
||||
(
|
||||
d Date,
|
||||
n Nullable(String) COMMENT 'It is a nullable column',
|
||||
arr1 Array(UInt32) CODEC(ZSTD),
|
||||
arr2 Array(Array(String)) TTL d + INTERVAL 1 DAY,
|
||||
t Tuple(s String, a Array(Tuple(a UInt32, b UInt32))) CODEC(ZSTD)
|
||||
)
|
||||
ENGINE = MergeTree ORDER BY d;
|
||||
|
||||
DESCRIBE TABLE t_desc_subcolumns FORMAT PrettyCompactNoEscapes;
|
||||
|
||||
DESCRIBE TABLE t_desc_subcolumns FORMAT PrettyCompactNoEscapes
|
||||
SETTINGS describe_include_subcolumns = 1;
|
||||
|
||||
DROP TABLE t_desc_subcolumns;
|
@ -0,0 +1,2 @@
|
||||
10
|
||||
1
|
9
tests/queries/0_stateless/2015_global_in_threads.sh
Executable file
9
tests/queries/0_stateless/2015_global_in_threads.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
${CLICKHOUSE_CLIENT} --log_queries=1 --max_threads=32 --query_id "2015_${CLICKHOUSE_DATABASE}_query" -q "select count() from remote('127.0.0.{2,3}', numbers(10)) where number global in (select number % 5 from numbers_mt(1000000))"
|
||||
${CLICKHOUSE_CLIENT} -q "system flush logs"
|
||||
${CLICKHOUSE_CLIENT} -q "select length(thread_ids) >= 32 from system.query_log where event_date = today() and query_id = '2015_${CLICKHOUSE_DATABASE}_query' and type = 'QueryFinish' and current_database = currentDatabase()"
|
Loading…
Reference in New Issue
Block a user