Commit Graph

67485 Commits

Author SHA1 Message Date
Maksim Kita
1e2f22a183 Aggregator compile part of aggregate functions 2021-07-01 22:56:36 +03:00
Maksim Kita
eb29490102 Fix AggregateFunctionAvg denominator type 2021-07-01 22:56:36 +03:00
Maksim Kita
d4742f91e6 Check min_count_to_compile_aggregate_expression setting before compilation 2021-07-01 22:56:36 +03:00
Maksim Kita
e67198c144 Compile AggregateFunctionIfNull 2021-07-01 22:56:36 +03:00
Maksim Kita
507d9405e2 Compile AggregateFunctionAvgWeighted 2021-07-01 22:56:36 +03:00
Maksim Kita
56c1a4e447 Added tests 2021-07-01 22:56:36 +03:00
Maksim Kita
a7a7623b36 Fixed style check 2021-07-01 22:56:36 +03:00
Maksim Kita
44259736ed Compile AggregateFunctionMax 2021-07-01 22:56:36 +03:00
Maksim Kita
ddc96374c8 Compile AggregateFunctionMin 2021-07-01 22:56:35 +03:00
Maksim Kita
88d536ea5c Update compilation for AggregateFunctionAny, AggregateFunctionAnyLast 2021-07-01 22:56:35 +03:00
Maksim Kita
fdfb17370d Compile AggregateFunctionAnyLast 2021-07-01 22:56:35 +03:00
Maksim Kita
905f48ccce Compile AggregateFunctionAny 2021-07-01 22:56:35 +03:00
Maksim Kita
f93da5ed2b Compile AggregateFunctionNullUnary 2021-07-01 22:56:35 +03:00
Maksim Kita
f88d8ccb1f Compile AggregateFunctionAvg 2021-07-01 22:56:35 +03:00
Maksim Kita
b491e75a56 Fix compile functions data type offset 2021-07-01 22:56:35 +03:00
Maksim Kita
a5ef0067b8 Compile AggregateFunctionIf 2021-07-01 22:56:35 +03:00
Maksim Kita
9b71b1040a Aggregate functions update compile interface 2021-07-01 22:56:35 +03:00
Maksim Kita
3fe559b31f Compile aggregate functions 2021-07-01 22:56:35 +03:00
Maksim Kita
aa8d4aea54
Merge pull request #25903 from ClickHouse/blinkov-patch-22
Update the Slack link to the one that's supposed to never expire
2021-07-01 22:30:02 +03:00
Aleksei Semiglazov
9a5365fc41
CLICKHOUSE-784: reset merge tree setting
Add an ability to reset custom setting to default and remove it from table's metadata.
This will allow to rollback the change without knowing the system/config's default.

Signed-off-by: Aleksei Semiglazov <asemiglazov@cloudflare.com>
2021-07-01 20:09:54 +01:00
Aleksei Semiglazov
f47e1ff102
CLICKHOUSE-1194: add skipping index to the beginning of the list
add the FIRST keyword to the ADD INDEX command to be able to add index in the beginning of the list.

Signed-off-by: Aleksei Semiglazov <asemiglazov@cloudflare.com>
2021-07-01 19:37:48 +01:00
Ivan Blinkov
3525f93a64
Update community.html 2021-07-01 21:20:19 +03:00
Ivan Blinkov
d1a63a5506
Update the Slack link 2021-07-01 21:18:28 +03:00
Kruglov Pavel
e23cf79338
Merge pull request #25596 from ildus/map_add_for_maps
Support Map type in mapAdd and mapSubtract
2021-07-01 21:08:07 +03:00
kssenii
4c8d82001f Fix checks 2021-07-01 17:52:21 +00:00
kssenii
9977629c89 Fix 2021-07-01 17:26:15 +00:00
kssenii
4d4ba4b5b1 More types for json functions 2021-07-01 16:46:34 +00:00
feng lv
9ad405cae8 update
update

fix test

fix test
2021-07-01 15:19:36 +00:00
Maksim Kita
6bbec92614
Merge pull request #25837 from azat/perf-query_log-map-fix
Fix performance tests after converting ProfileEvents to Map type
2021-07-01 16:24:42 +03:00
alesapin
7792b09911 Reset counter if background pool is full 2021-07-01 16:10:07 +03:00
feng lv
fe22563465 fix conflict 2021-07-01 13:09:33 +00:00
Ildus Kurbangaliev
c86739794f Change error code in mapAdd 2021-07-01 13:41:12 +02:00
Ildus Kurbangaliev
f56ae8f9cd
Apply suggestions from code review
Co-authored-by: Kruglov Pavel <48961922+Avogar@users.noreply.github.com>
2021-07-01 13:38:13 +02:00
mergify[bot]
98fa9f7951
Merge branch 'master' into better_remove_empty_parts 2021-07-01 11:32:43 +00:00
Kruglov Pavel
0b032e852d
Merge pull request #25874 from Avogar/fix-arrow-test
Fix typo in the test 00900_orc_arrow_parquet_maps
2021-07-01 12:25:31 +03:00
kssenii
4ad0f45f0e Some more tests 2021-07-01 08:35:28 +00:00
Vladimir
d0b28a7d6e
Merge pull request #25793 from Slach/improve_alter_partition_docs
add DELETE IN PARTITION and UPDATE IN PARTITION into ALTER syntax TOC
2021-07-01 10:55:44 +03:00
kssenii
f01c8edbff Fix access to tables after restart 2021-07-01 07:33:58 +00:00
alexey-milovidov
cae19ca36e
Merge pull request #25559 from MyroTk/tfs_bigdatatypes_fix
Testflows - Extended Precision Data Type Tests - Minor syntax update.
2021-07-01 02:59:19 +03:00
tavplubix
afbc6bf17d
Merge pull request #25684 from ClickHouse/cancel_merges_on_drop_partition
Cancel merges on DROP PARTITION
2021-06-30 23:41:04 +03:00
Maksim Kita
227913579d
Merge pull request #25872 from ClickHouse/add-arm-link
Add Linux ARM build to the front page
2021-06-30 23:11:57 +03:00
Alexey
46e6062c44 Fixed Syntax section of quantileExactLow 2021-06-30 19:42:41 +00:00
alesapin
0193a9d087 Fix locking 2021-06-30 22:41:25 +03:00
Alexey
b852253153 Fixed Wikipedia link 2021-06-30 19:37:52 +00:00
Alexey
8a3a142f75 Fixed links in quantiles.md 2021-06-30 19:28:57 +00:00
Alexey
414f48e1c0 Function added to quantiles.md 2021-06-30 19:23:46 +00:00
alesapin
45edc8c861 Fix tidy 2021-06-30 22:11:00 +03:00
Alexey
38e6c52a1c Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into alexey-sm-DOCSUP-9779-document-quantileBFloat16 2021-06-30 19:10:34 +00:00
Azat Khuzhin
626f47e044 Convert history file from readline format to replxx format
replxx requires each history line to prepended with time line:

    ### YYYY-MM-DD HH:MM:SS.SSS
    select 1

And w/o those service lines it will load all lines from history file as
one history line for suggestion. And if there are lots of lines in file it
will take lots of time (getline() + tons of reallocations).
2021-06-30 22:06:16 +03:00
Azat Khuzhin
fc46effe16 Fix race between DETACH and merges
CI reports failure of the 01442_merge_detach_attach test [1]:

<details>

    2021-06-21 02:25:43 01442_merge_detach_attach:                                              [ FAIL ] 122.37 sec. - result differs with reference:
    2021-06-21 02:25:43 --- /usr/share/clickhouse-test/queries/0_stateless/01442_merge_detach_attach.reference	2021-06-21 00:43:12.000000000 +0300
    2021-06-21 02:25:43 +++ /tmp/clickhouse-test/0_stateless/01442_merge_detach_attach.stdout	2021-06-21 02:25:43.211212197 +0300
    2021-06-21 02:25:43 @@ -0,0 +1 @@
    2021-06-21 02:25:43 +2

    2021.06.21 02:25:08.930896 [ 100543 ] {16eb4fe5-2d6b-4c81-a6be-c6a3b293edd3} <Debug> executeQuery: (from [::1]:36540, using production parser) (comment: '/usr/share/clickhouse-test/queries/0_stateless/01442_merge_detach_attach.sh') ALTER TABLE t DETACH PARTITION tuple()
    2021.06.21 02:25:08.931245 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> executeQuery: (from [::1]:36542, using production parser) (comment: '/usr/share/clickhouse-test/queries/0_stateless/01442_merge_detach_attach.sh') OPTIMIZE TABLE t FINAL
    2021.06.21 02:25:08.931826 [ 100543 ] {16eb4fe5-2d6b-4c81-a6be-c6a3b293edd3} <Trace> ContextAccess (default): Access granted: ALTER DELETE ON test_89nl0v.t
    2021.06.21 02:25:08.932159 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Trace> ContextAccess (default): Access granted: OPTIMIZE ON test_89nl0v.t
    2021.06.21 02:25:08.932889 [ 100543 ] {16eb4fe5-2d6b-4c81-a6be-c6a3b293edd3} <Information> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249): Detaching all_143_143_0
    2021.06.21 02:25:08.932921 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (MergerMutator): Selected 2 parts from all_143_143_0 to all_144_144_0
    2021.06.21 02:25:08.933530 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> DiskLocal: Reserving 1.00 MiB on disk `default`, having unreserved 4.60 TiB.
    2021.06.21 02:25:08.933705 [ 100543 ] {16eb4fe5-2d6b-4c81-a6be-c6a3b293edd3} <Information> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249): Detaching all_144_144_0
    2021.06.21 02:25:08.934215 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (MergerMutator): Merging 2 parts: from all_143_143_0 to all_144_144_0 into Compact
    2021.06.21 02:25:08.934280 [ 100543 ] {16eb4fe5-2d6b-4c81-a6be-c6a3b293edd3} <Information> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249): Detached 2 parts.
    2021.06.21 02:25:08.934948 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (MergerMutator): Selected MergeAlgorithm: Horizontal
    2021.06.21 02:25:08.936090 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> MergeTreeSequentialSource: Reading 2 marks from part all_143_143_0, total 1 rows starting from the beginning of the part, column x
    2021.06.21 02:25:08.937621 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> MergeTreeSequentialSource: Reading 2 marks from part all_144_144_0, total 1 rows starting from the beginning of the part, column x
    2021.06.21 02:25:08.938124 [ 100543 ] {16eb4fe5-2d6b-4c81-a6be-c6a3b293edd3} <Debug> MemoryTracker: Peak memory usage (for query): 0.00 B.
    2021.06.21 02:25:08.939928 [ 100543 ] {} <Debug> TCPHandler: Processed in 0.018537432 sec.
    2021.06.21 02:25:08.942140 [ 100543 ] {} <Debug> TCPHandler: Done processing connection.
    2021.06.21 02:25:08.948343 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (MergerMutator): Merge sorted 2 rows, containing 1 columns (1 merged, 0 gathered) in 0.014203821 sec., 140.80718139154246 rows/sec., 140.81 B/sec.
    2021.06.21 02:25:08.952021 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Trace> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249): Renaming temporary part tmp_merge_all_143_144_1 to all_143_144_1.
    2021.06.21 02:25:08.952869 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Warning> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (MergerMutator): Unexpected number of parts removed when adding all_143_144_1: 0 instead of 2
    2021.06.21 02:25:08.953264 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Trace> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (MergerMutator): Merged 2 parts: from all_143_143_0 to all_144_144_0
    2021.06.21 02:25:08.953913 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> MemoryTracker: Peak memory usage: 4.01 MiB.
    2021.06.21 02:25:08.958369 [ 100540 ] {bd4b710d-cd27-44ea-9dc9-e45d6ace0bd7} <Debug> MemoryTracker: Peak memory usage (for query): 4.01 MiB.
    ...
    2021.06.21 02:25:09.216075 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Debug> executeQuery: (from [::1]:36544, using production parser) (comment: '/usr/share/clickhouse-test/queries/0_stateless/01442_merge_detach_attach.sh') SELECT count() FROM t HAVING count() > 0
    2021.06.21 02:25:09.229491 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Trace> ContextAccess (default): Access granted: SELECT(x) ON test_89nl0v.t
    2021.06.21 02:25:09.232000 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Trace> InterpreterSelectQuery: FetchColumns -> Complete
    2021.06.21 02:25:09.239907 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Debug> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (SelectExecutor): Key condition: unknown
    2021.06.21 02:25:09.240358 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Debug> test_89nl0v.t (efd364af-6721-4249-afd3-64af67214249) (SelectExecutor): Selected 1/1 parts by partition key, 1 parts by primary key, 1/1 marks by primary key, 1 marks to read from 1 ranges
    2021.06.21 02:25:09.241560 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Debug> MergeTreeSelectProcessor: Reading 1 ranges from part all_143_144_1, approx. 2 rows starting from 0
    2021.06.21 02:25:09.256053 [ 58403 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Trace> AggregatingTransform: Aggregating
    2021.06.21 02:25:09.256410 [ 58403 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Trace> Aggregator: Aggregation method: without_key
    2021.06.21 02:25:09.257576 [ 58403 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Debug> AggregatingTransform: Aggregated. 2 to 1 rows (from 2.00 B) in 0.013910412 sec. (143.777 rows/sec., 143.78 B/sec.)
    2021.06.21 02:25:09.257911 [ 58403 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Trace> Aggregator: Merging aggregated data
    2021.06.21 02:25:09.262595 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Information> executeQuery: Read 2 rows, 2.00 B in 0.045805192 sec., 43 rows/sec., 43.66 B/sec.
    2021.06.21 02:25:09.263337 [ 100543 ] {1699b404-b132-4b96-b04a-1c28cd062a79} <Debug> MemoryTracker: Peak memory usage (for query): 0.00 B.

</details>

  [1]: https://clickhouse-test-reports.s3.yandex.net/25513/b96df135aee40b1a54a4fc3f0d4db89e11385564/functional_stateless_tests_(memory).html#fail1

The problem here is that there is a tiny race window between DETACH
and OPTIMIZE.

DETACH cancel merges, and checks that there no merges for parts
currently under lock, and later changes the state of parts. After it
allows merges.

However OPTIMIZE get parts for processing under lock and only when it
starts writing temporary part it checks that merges are not canceled.

So suppose the following scenario:

      T#OPTIMIZE                       T#DETACH

                                       - cancel merges
                                           - lock
                                             - check that no merges are in progress
                                           - unlock
    - lock
      - get parts

          *<--Here, state of the parts are not changed yet,
              and lock is not held,
              so OPTIMIZE may (and will) get those parts. -->*

      - write temporary part
        - check merges not canceled
    - unlock
                                           - change the parts state
                                       - allows merges

Plus this patch will also fail merges earlier in case of concurrent
DETACH.

Refs: #13746
Refs: #23315
2021-06-30 21:13:31 +03:00