Conversation
|
@KochetovNicolai I know about some issues with
AFAICS you are touching related bits, so will this PR address such things or this is just "code" refactoring? |
|
@azat it is mainly just "code" refactoring, but I will check if those issues may be fixed easily. |
|
Thanks (than I will wait your PR to avoid conflicts) |
|
@azat |
Add ArrayJoinTransform and ArrayJoinStep.
d715899 to
8e631a9
Compare
Ok, will take a look after this PR will be merged.
Ok, then something should be done with |
| case ARRAY_JOIN: | ||
| { | ||
| array_join->prepare(sample_block); | ||
| ColumnWithTypeAndName current = sample_block.getByName(source_name); |
There was a problem hiding this comment.
The idea was to have one-line function here. Why do we need such a complex logic inside of switch?
There was a problem hiding this comment.
Well, I think one-line functions are more readable.
However, it would be reasonable rewrite the whole function then. I would rather do it next time.
Also, I don't think this logic is complex, especially comparing with previous many-column implementation.
| case ARRAY_JOIN: | ||
| { | ||
| array_join->execute(block, dry_run); | ||
| auto source = block.getByName(source_name); |
There was a problem hiding this comment.
The same: why not to move all this logic in separate function?
| } | ||
|
|
||
| bool depends_on_array_join = false; | ||
| for (auto & column : action.getNeededColumns()) |
There was a problem hiding this comment.
This cycle is candidate for function extraction: action.dependsOnArrayJoin()
There was a problem hiding this comment.
My argument against doing it:
When I see function dependsOnArrayJoin I have no idea what this function actually does. I will need to switch my attention and read it anyway. It's better to read this 3 lines of code here.
There was a problem hiding this comment.
Also, it is not clear why action should know something about arrayJoin.
As for me, it looks like inserting unnecessary business-logic into simple interface.
| /// Each alias has separate dependencies, so we split this action into two parts. | ||
| NamesWithAliases split_aliases; | ||
| NamesWithAliases depend_aliases; | ||
| for (const auto & pair : action.projection) |
There was a problem hiding this comment.
Could we extract this cycle into a function action.extractArrayJoinDependentColumns() ?
There was a problem hiding this comment.
It doesn't look pretty much reasonable to me.
There is no copy-paste, this code is very context-dependent, and comment to such function will be longer then it's implementation.
src/Interpreters/ExpressionActions.h
Outdated
|
|
||
| struct Step | ||
| { | ||
| std::variant<ExpressionActionsLink, ArrayJoinLink> link; |
There was a problem hiding this comment.
Step, ArrayJoinLink and ExpressionActionsLink have mostly the same interface. Wouldn't it be better to make a base class instead of variant?
There was a problem hiding this comment.
Yes, I had the same idea.
But I didn't like doing virtual calls even thought if we always know exact type.
So, I did a static interface.
Well, maybe class is more readable.
|
01444_create_table_drop_database_race - was broken in master, fixed |
|
Not waiting for perftests. |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):