-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Allow to attach partition from table with different partition expression when destination partition expression doesn't re-partition #39507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tavplubix
merged 170 commits into
ClickHouse:master
from
arthurpassos:allow_attach_more_granular_partition
Jan 22, 2024
Merged
Changes from all commits
Commits
Show all changes
170 commits
Select commit
Hold shift + click to select a range
2ee716e
temp commit
arthurpassos c913dcf
temp commit
arthurpassos d633bd1
draft impl for feedback
arthurpassos a2e9082
Merge branch 'ClickHouse:master' into allow_attach_more_granular_part…
arthurpassos b38045d
fix weird style changes
arthurpassos 456313b
fix weird style changes
arthurpassos f61eab2
fix weird style changes
arthurpassos 7946494
fix weird style changes
arthurpassos 70d5b41
fix weird style changes
arthurpassos b850783
aa
arthurpassos 68af6d4
aa
arthurpassos c7d91d8
Add integ tests and remove partition key restriction
arthurpassos a5bc31b
fix small incosistency in partition id
arthurpassos ca8f940
style fix
arthurpassos 17b393c
style fix
arthurpassos 98c732e
style fix
arthurpassos 4855dd3
use existing DataPartStorageBuilder instead of new one
arthurpassos 8f34190
Refactor part clone to make it more readable and maintainable
arthurpassos afca632
Add MergeTreeDataPartCloner docs
arthurpassos b27375e
define ErrorCodes::BAD_ARGUMENTS
arthurpassos 34348a6
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos e739670
Rebase
arthurpassos fdc0f68
camel case methods
arthurpassos 3325bf6
address some comments
arthurpassos 25ab01b
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos cc48924
yet another rebase?
arthurpassos edf8e7d
Move from integ tests to stateless tests
arthurpassos eb74497
address more comments
arthurpassos 3a338e2
add finalize on min_max_idx files
arthurpassos 2e42ce4
Add sync option to DistinctPartitionExpCloner
arthurpassos 62ec90d
just a temp test
arthurpassos 22ccdd2
revert temp change
arthurpassos 85724a1
Use echoOn to distinguish test queries
arthurpassos c9159fb
remove comment
arthurpassos da94a54
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos d7449fc
fix build issue during rebase
arthurpassos 10f31c8
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos a24e85c
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 034bcec
atempt to fix build after rebase
arthurpassos a6fa4b1
finally fix build
arthurpassos 8ff4276
Merge branch 'master' into allow_attach_more_granular_partition
alexey-milovidov e89100d
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 8dfcbec
clear minmaxidx hyperrectangle before loading it
arthurpassos c2a26ee
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 742f371
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos edb5e1d
Fix error on min_max files deletion where it was being assumed that p…
arthurpassos 8357782
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 38240a9
get it to the state it was previously
arthurpassos f7cc616
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos f1df6d6
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 5eb8671
add missing include
arthurpassos 350fab3
getting functional?
arthurpassos 5d7e629
refactoring and renaming
arthurpassos 0f9b578
some more refactoring
arthurpassos 154969b
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 1c56872
extern bad arguments
arthurpassos 6f248b2
try to fix style
arthurpassos 2ef6aeb
improvements and docs
arthurpassos 2237fa5
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 690f00d
remove duplicate includes
arthurpassos c96e6f8
fix crash
arthurpassos e0112c9
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 86866d3
make tests more stable by ordering
arthurpassos 843043f
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 52dfc71
rebase once again..
arthurpassos 925d431
fix
arthurpassos 78b75bb
Merge branch 'master' into allow_attach_more_granular_partition
alexey-milovidov ef6c716
make ci happy?
arthurpassos 8582e7b
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos ce9fddc
fix rebase issues
arthurpassos d3656d4
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 4bb7f17
docs
arthurpassos 1ff45ba
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 4dcd28f
rebase, but prolly needs to be improved
arthurpassos e9ba192
refactor out from nasty inheritance to static methods
arthurpassos 15a8376
fix style
arthurpassos 23df591
work around optional
arthurpassos 6ebfc00
refactor & integrate some changes
arthurpassos 6ca0e21
update column_type
arthurpassos 920fcf4
add tests by dencrane
arthurpassos 124b434
set utc
arthurpassos 2f7315b
fix ref file
arthurpassos 48e9b1b
fix tests
arthurpassos e2ca5ae
use MergeTree instead of SummingMergeTree
arthurpassos 91a83c7
Merge branch 'ClickHouse:master' into allow_attach_more_granular_part…
arthurpassos 116af6e
mark MergeTreeDataPart::getBlock as const
arthurpassos 276694b
address a few comments
arthurpassos 395ef94
compute module function name size at compile time
arthurpassos 6e5cb74
simplify branching in getPartitionAstFieldsCount
arthurpassos 8355db2
remove column_indexes argument
arthurpassos f9c8633
merge getBlock with buildBlock
arthurpassos d683045
add some const specifiers
arthurpassos 6091213
small adjustments
arthurpassos 129db26
remove no longer needed isNull check
arthurpassos b2fe79d
use std::min and max to update global min max idx
arthurpassos 8188c8c
add some assertions
arthurpassos 3784730
forward declare some symbols
arthurpassos c190882
fix grammar
arthurpassos 0326f39
forward decl
arthurpassos ad4cb04
try to fix build..
arthurpassos 8037cf0
remove IFunction forward decl
arthurpassos 20246d4
Revert "use std::min and max to update global min max idx"
arthurpassos 9416087
Revert "remove no longer needed isNull check"
arthurpassos 7a76cf7
Revert "Revert "remove no longer needed isNull check""
arthurpassos 16c3948
Revert "Revert "use std::min and max to update global min max idx""
arthurpassos 441c99c
Merge branch 'ClickHouse:master' into allow_attach_more_granular_part…
arthurpassos 352b4ca
remove some comments
arthurpassos 8401568
partial use of MonotonicityCheckMatcher
arthurpassos b845b03
ranges
arthurpassos 5d5b70c
remove KeyDescriptionMonotonicityChecker
arthurpassos e11bb59
remove duplication of applyfunction
arthurpassos 54ae855
move functions to anonymous namespace
arthurpassos 80a8d7b
move functions to cpp
arthurpassos a402a04
Relax partition compatibility requirements by accepting subset, add t…
arthurpassos 776ce93
updte reference file
arthurpassos 0621d4d
Support for partition by a, b, c to partition by a, b
arthurpassos 7e0aa19
refactoring part 1
arthurpassos b807d02
refactoring part 2, use hyperrectangle, still not complete
arthurpassos 6a9b81c
refactoring part 3, build hyperrectangle with intersection of source …
arthurpassos 9366d6e
Support attaching to table with partition expression of multiple expr…
arthurpassos e61d564
add tests
arthurpassos 151ac94
rename method
arthurpassos 28598c2
remove some code duplication
arthurpassos 0830008
draft impl for replicatedmergetree, need to dive deeper
arthurpassos cf22dac
ship ref file
arthurpassos 0eca23c
fix impl for replicatedmergetree..
arthurpassos f5c739d
forbid attach empty partition replicatedmergetree
arthurpassos 92afe9e
Add replicated merge tree integration tests
arthurpassos b16573a
add test missing files
arthurpassos cbd29de
fix black
arthurpassos 07cc30d
do not check for monotonicity of empty partition
arthurpassos 2427cf9
add empty tests & fix replicated
arthurpassos f393663
remove no longer needed buildBlockWithMinMaxINdexes
arthurpassos de0bf3d
remove column logic in buildHyperrectangle
arthurpassos d5b012f
simplify implementation by using existing methods
arthurpassos 3798e5d
further simplify implementation
arthurpassos 6410828
move all MergeTreeDataPartClone private methods to .cpp file
arthurpassos 6c24a1b
decrease decomposition
arthurpassos be8158b
use different namespaces
arthurpassos 077e290
reduce code duplication
arthurpassos 796b40a
fix style
arthurpassos bd00b10
address a few comments
arthurpassos 2dc4f45
add chassert to assert arguments size on MonotonicityCheckVisitor
arthurpassos 61fe4d9
remove deleteMinMaxFiles method
arthurpassos eab15dc
remove useless checks from sanitycheck
arthurpassos 826a3c4
add tests for attach partition (not id)
arthurpassos e3194e0
Remove sanityCheckASTPartition and bring back conditional getPartitio…
arthurpassos 074c47e
remove empty block comment
arthurpassos 18c9521
small fixes
arthurpassos 5e33da3
fix formatting
arthurpassos 5c72acb
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos 766fe33
add missing include
arthurpassos f47c25b
remove duplicate iuncludes
arthurpassos ac53355
trigger ci
arthurpassos bebb1f4
reduce some code duplication
arthurpassos 9054222
use updated partition id on replicatedmergetree
arthurpassos fe24e89
fix build
arthurpassos 6675818
fix build
arthurpassos 6ea844d
small refactor
arthurpassos 9aa84bc
do not use insert increment on fetch part
arthurpassos f023a67
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos b73e246
remove duplicate includes
arthurpassos 13d3f52
add one more integ test
arthurpassos 9ccde30
black
arthurpassos bdcc0fd
black
arthurpassos 606ab61
rely on partition exp instead of partition id on replicated part fetc…
arthurpassos 938551b
add one more integ test
arthurpassos 9fba9a8
add order by clause
arthurpassos d585f2a
fix black
arthurpassos fe1e326
Merge branch 'master' into allow_attach_more_granular_partition
arthurpassos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #include <Interpreters/applyFunction.h> | ||
|
|
||
| #include <Core/Range.h> | ||
| #include <Functions/IFunction.h> | ||
|
|
||
| namespace DB | ||
| { | ||
|
|
||
| static Field applyFunctionForField(const FunctionBasePtr & func, const DataTypePtr & arg_type, const Field & arg_value) | ||
| { | ||
| ColumnsWithTypeAndName columns{ | ||
| {arg_type->createColumnConst(1, arg_value), arg_type, "x"}, | ||
| }; | ||
|
|
||
| auto col = func->execute(columns, func->getResultType(), 1); | ||
| return (*col)[0]; | ||
| } | ||
|
|
||
| FieldRef applyFunction(const FunctionBasePtr & func, const DataTypePtr & current_type, const FieldRef & field) | ||
| { | ||
| /// Fallback for fields without block reference. | ||
| if (field.isExplicit()) | ||
| return applyFunctionForField(func, current_type, field); | ||
|
|
||
| String result_name = "_" + func->getName() + "_" + toString(field.column_idx); | ||
| const auto & columns = field.columns; | ||
| size_t result_idx = columns->size(); | ||
|
|
||
| for (size_t i = 0; i < result_idx; ++i) | ||
| if ((*columns)[i].name == result_name) | ||
| result_idx = i; | ||
|
|
||
| if (result_idx == columns->size()) | ||
| { | ||
| ColumnsWithTypeAndName args{(*columns)[field.column_idx]}; | ||
| field.columns->emplace_back(ColumnWithTypeAndName{nullptr, func->getResultType(), result_name}); | ||
| (*columns)[result_idx].column = func->execute(args, (*columns)[result_idx].type, columns->front().column->size()); | ||
| } | ||
|
|
||
| return {field.columns, field.row_idx, result_idx}; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #pragma once | ||
|
|
||
| #include <memory> | ||
|
|
||
| namespace DB | ||
| { | ||
| struct FieldRef; | ||
|
|
||
| class IFunctionBase; | ||
| class IDataType; | ||
|
|
||
| using DataTypePtr = std::shared_ptr<const IDataType>; | ||
| using FunctionBasePtr = std::shared_ptr<const IFunctionBase>; | ||
|
|
||
| FieldRef applyFunction(const FunctionBasePtr & func, const DataTypePtr & current_type, const FieldRef & field); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.