Skip to content
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

Interpolate feature #35349

Merged

Conversation

yakov-olkhovskiy
Copy link
Member

@yakov-olkhovskiy yakov-olkhovskiy commented Mar 17, 2022

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
added INTERPOLATE extension to the ORDER BY ... WITH FILL
closes #34903

Information about CI checks: https://clickhouse.tech/docs/en/development/continuous-integration/

@robot-clickhouse robot-clickhouse added doc-alert pr-feature Pull request with new product feature labels Mar 17, 2022
@CLAassistant
Copy link

CLAassistant commented Mar 17, 2022

CLA assistant check
All committers have signed the CLA.

@yakov-olkhovskiy
Copy link
Member Author

this is a preliminary version, some polishing is required
syntax example:

SELECT n, source, m FROM (
   SELECT toFloat32(number % 10) AS n, 'original '||toString(m) AS source, n as m
   FROM numbers(10) WHERE number % 3 = 1
) ORDER BY n WITH FILL FROM 0 TO 5.51 STEP 0.3 INTERPOLATE(m AS m+1, source as source||'c')

┌───n─┬─source───────────────┬──m─┐
│   0 │                      │  0 │
│ 0.3 │                      │  0 │
│ 0.6 │                      │  0 │
│ 0.9 │                      │  0 │
│   1 │ original 1           │  1 │
│ 1.2 │ original 1c          │  2 │
│ 1.5 │ original 1cc         │  3 │
│ 1.8 │ original 1ccc        │  4 │
│ 2.1 │ original 1cccc       │  5 │
│ 2.4 │ original 1ccccc      │  6 │
│ 2.7 │ original 1cccccc     │  7 │
│   3 │ original 1ccccccc    │  8 │
│ 3.3 │ original 1cccccccc   │  9 │
│ 3.6 │ original 1ccccccccc  │ 10 │
│ 3.9 │ original 1cccccccccc │ 11 │
│   4 │ original 4           │  4 │
│ 4.2 │ original 4c          │  5 │
│ 4.5 │ original 4cc         │  6 │
│ 4.8 │ original 4ccc        │  7 │
│ 5.1 │ original 4cccc       │  8 │
│ 5.4 │ original 4ccccc      │  9 │
│   7 │ original 7           │  7 │
└─────┴──────────────────────┴────┘

@KochetovNicolai KochetovNicolai self-assigned this Mar 17, 2022
@yakov-olkhovskiy yakov-olkhovskiy changed the title Interpolate feature Interpolate feature (closes #34903) Mar 17, 2022
@yakov-olkhovskiy yakov-olkhovskiy changed the title Interpolate feature (closes #34903) Interpolate feature Mar 17, 2022
yakov-olkhovskiy and others added 8 commits March 19, 2022 02:41
INTERPOLATE is added
INTERPOLATE is added
INTERPOLATE is added
INTERPOLATE is added
INTERPOLATE fix
INTERPOLATE fix
@yakov-olkhovskiy yakov-olkhovskiy marked this pull request as ready for review March 19, 2022 07:19
use range-based for loop
bugfix: check column existence for INTERPOLATE expression target
Copy link
Member

@KochetovNicolai KochetovNicolai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally ok

src/Core/InterpolateDescription.h Outdated Show resolved Hide resolved
src/Core/InterpolateDescription.h Outdated Show resolved Hide resolved
src/Core/InterpolateDescription.cpp Outdated Show resolved Hide resolved
src/Interpreters/FillingRow.h Outdated Show resolved Hide resolved
src/Parsers/ParserSelectQuery.cpp Show resolved Hide resolved
src/Interpreters/InterpreterSelectQuery.cpp Outdated Show resolved Hide resolved
@yakov-olkhovskiy yakov-olkhovskiy marked this pull request as draft March 25, 2022 13:04
@yakov-olkhovskiy
Copy link
Member Author

NOTE: we have decided to refactor filling transform itself to simplify everything and possibly optimize

@yakov-olkhovskiy yakov-olkhovskiy marked this pull request as ready for review April 4, 2022 02:34
@@ -2499,7 +2557,9 @@ void InterpreterSelectQuery::executeWithFill(QueryPlan & query_plan)
if (fill_descr.empty())
return;

auto filling_step = std::make_unique<FillingStep>(query_plan.getCurrentDataStream(), std::move(fill_descr));
InterpolateDescriptionPtr interpolate_descr =
getInterpolateDescription(query, source_header, result_header, syntax_analyzer_result->aliases, context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use a source_header here? I think it should be query_plan.getCurrentDataStream().header instead.

SELECT
    n,
    any(source),
    sum(inter) AS inter_s
FROM
(
    SELECT
        toFloat32(number % 10) AS n,
        'original' AS source,
        number AS inter
    FROM numbers(10)
    WHERE (number % 3) = 1
)
GROUP BY n
ORDER BY n ASC WITH FILL FROM 0 TO 11.51 STEP 0.5
INTERPOLATE ( inter_s AS inter_s + 1 )

Query id: c4a37d26-ec08-42dc-9e0b-eee9a4419eb3


0 rows in set. Elapsed: 0.002 sec. 

Received exception from server (version 22.4.1):
Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Missing columns: 'inter_s' while processing query: 'SELECT n, any(source), sum(inter) AS inter_s FROM (SELECT toFloat32(number % 10) AS n, 'original' AS source, number AS inter FROM numbers(10) WHERE (number % 3) = 1) GROUP BY n ORDER BY n ASC WITH FILL FROM 0 TO 11.51 STEP 0.5 INTERPOLATE ( inter_s AS inter_s + 1 )', required columns: 'n' 'inter_s' 'source' 'inter' 'n' 'inter_s' 'source' 'inter'. (UNKNOWN_IDENTIFIER)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, why spaces inside interpolate expression? Let's fix formatting
INTERPOLATE ( inter_s AS inter_s + 1 ) -> INTERPOLATE (inter_s AS inter_s + 1)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I need columns which participate in interpolate expressions - they can be from source_header and result_header, but getCurrentDataStream().header seems the same as result_header

{
if (auto * ident = fn->as<ASTIdentifier>())
{
step.addRequiredOutput(ident->getColumnName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like here we add alias to required output instead of full column name.
At list this does not work:

SELECT
    n,
    source,
    inter + 1 AS inter_p
FROM
(
    SELECT
        toFloat32(number % 10) AS n,
        'original' AS source,
        number AS inter
    FROM numbers(10)
    WHERE (number % 3) = 1
)
ORDER BY n ASC WITH FILL FROM 0 TO 11.51 STEP 0.5
INTERPOLATE ( inter_p AS inter_p + 1 )

Query id: 9c5b264e-0dca-406e-a2c3-7d9dd43f6609


0 rows in set. Elapsed: 0.002 sec. 

Received exception from server (version 22.4.1):
Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Missing columns: 'inter_p' while processing query: 'SELECT n, source, inter + 1 AS inter_p FROM (SELECT toFloat32(number % 10) AS n, 'original' AS source, number AS inter FROM numbers(10) WHERE (number % 3) = 1) ORDER BY n ASC WITH FILL FROM 0 TO 11.51 STEP 0.5 INTERPOLATE ( inter_p AS inter_p + 1 )', required columns: 'n' 'inter_p' 'source' 'inter' 'n' 'inter_p' 'source' 'inter'. (UNKNOWN_IDENTIFIER)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can build actions for interpolate here as well?

Now I think that maybe it would be easier to substitute aliases for interpolate.
Like, fix QueryNormalizer a little bit (add ASTInterpolateElement)

if (auto * node_id = ast->as<ASTIdentifier>())
visit(*node_id, ast, data);
else if (auto * node_tables = ast->as<ASTTablesInSelectQueryElement>())
visit(*node_tables, ast, data);
else if (auto * node_select = ast->as<ASTSelectQuery>())
visit(*node_select, ast, data);
else if (auto * node_param = ast->as<ASTQueryParameter>())
throw Exception("Query parameter " + backQuote(node_param->name) + " was not set", ErrorCodes::UNKNOWN_QUERY_PARAMETER);
else if (auto * node_function = ast->as<ASTFunction>())
if (node_function->parameters)
visit(node_function->parameters, data);

so that in AST inter_p AS inter_p + 1 would be rewritten into inter_p AS (inter + 1) + 1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's rather I shouldn't add this column as required because it's not a source column...

ASTPtr clone() const override
{
auto clone = std::make_shared<ASTInterpolateElement>(*this);
clone->cloneChildren();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I think you need to fix ptr for clone->expr; otherwise it still points to old ast.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe like here

ASTPtr ASTColumnDeclaration::clone() const
{
const auto res = std::make_shared<ASTColumnDeclaration>(*this);
res->children.clear();
if (type)
{
// Type may be an ASTFunction (e.g. `create table t (a Decimal(9,0))`),
// so we have to clone it properly as well.
res->type = type->clone();
res->children.push_back(res->type);
}
if (default_expression)
{
res->default_expression = default_expression->clone();
res->children.push_back(res->default_expression);
}
if (comment)
{
res->comment = comment->clone();
res->children.push_back(res->comment);
}
if (codec)
{
res->codec = codec->clone();
res->children.push_back(res->codec);
}
if (ttl)
{
res->ttl = ttl->clone();
res->children.push_back(res->ttl);
}
return res;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did something, but probably still wrong - will revisit tomorrow...


auto elem = std::make_shared<ASTInterpolateElement>();
elem->column = ident->getColumnName();
elem->expr = expr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to add expr to children. Right now, when I do EXPLAIN AST, it does not show interpolate child:

EXPLAIN AST
SELECT
    n,
    source,
    inter + 1 AS inter_p
FROM
(
    SELECT
        toFloat32(number % 10) AS n,
        'original' AS source,
        number AS inter
    FROM numbers(10)
    WHERE (number % 3) = 1
)
ORDER BY n ASC WITH FILL FROM 0 TO 11.51 STEP 0.5
INTERPOLATE ( inter_p AS inter_p + 1 )

Query id: a0864985-0068-40ae-91d1-64e528442940

┌─explain──────────────────────────────────────────────┐
│ SelectWithUnionQuery (children 1)                    │
...
│    ExpressionList (children 1)                       │
│     InterpolateElement                               │
└──────────────────────────────────────────────────────┘

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@KochetovNicolai
Copy link
Member

found by fuzzer

[ip-172-31-12-180] 2022.04.07 10:21:15.943335 [ 437 ] <Fatal> BaseDaemon: ########################################
[ip-172-31-12-180] 2022.04.07 10:21:15.943422 [ 437 ] <Fatal> BaseDaemon: (version 22.4.1.1471, build id: 57344BC9447B12F0) (from thread 435) (query_id: 2500bf69-77e6-4ed9-929c-4b4dc50e74b5) (query: SELECT (-2147483649 % NULL) % NULL, inter + NULL AS inter_p FROM (SELECT toFloat32(number % 65537) AS n, concat(inter, 'inte\0'), NULL, '' AS source, number AS inter FROM numbers(255) WHERE (number % 1.1920928955078125e-7) = '0.01') ORDER BY 2147483648 ASC NULLS FIRST, n ASC NULLS FIRST WITH FILL FROM 0 TO 11.51 STEP 0.5 INTERPOLATE ( inter_p AS inter_p + 1 )) Received signal Unknown signal (-3)
[ip-172-31-12-180] 2022.04.07 10:21:15.943456 [ 437 ] <Fatal> BaseDaemon: Sanitizer trap.
[ip-172-31-12-180] 2022.04.07 10:21:15.943511 [ 437 ] <Fatal> BaseDaemon: Stack trace: 0xfcaac4a 0x22129071 0xfc63dd6 0xfc75b19 0x238c0cb5 0x24ad5a45 0x24ac98e2 0x1d32bb8b 0x2461b111 0x246426d9 0x24642568 0x24634bc1 0x24634547 0x246340ad 0x24646d43 0x24646ca2 0x24646b5b 0xfd56a7a 0xfd59542 0x7f932f16d609 0x7f932f092163
[ip-172-31-12-180] 2022.04.07 10:21:15.951790 [ 437 ] <Fatal> BaseDaemon: 0.1. inlined from ./build_docker/../src/Common/StackTrace.cpp:305: StackTrace::tryCapture()
[ip-172-31-12-180] 2022.04.07 10:21:15.951818 [ 437 ] <Fatal> BaseDaemon: 0. ../src/Common/StackTrace.cpp:266: StackTrace::StackTrace() @ 0xfcaac4a in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:15.970160 [ 437 ] <Fatal> BaseDaemon: 1. ./build_docker/../base/daemon/BaseDaemon.cpp:0: sanitizerDeathCallback() @ 0x22129071 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:16.919974 [ 437 ] <Fatal> BaseDaemon: 2. __sanitizer::Die() @ 0xfc63dd6 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:17.875912 [ 437 ] <Fatal> BaseDaemon: 3. ? @ 0xfc75b19 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:17.888005 [ 437 ] <Fatal> BaseDaemon: 4.1. inlined from ./build_docker/../src/Common/assert_cast.h:0: DB::ColumnNullable const& assert_cast<DB::ColumnNullable const&, DB::IColumn const&>(DB::IColumn const&)
[ip-172-31-12-180] 2022.04.07 10:21:17.888048 [ 437 ] <Fatal> BaseDaemon: 4. ../src/Columns/ColumnNullable.cpp:188: DB::ColumnNullable::insertFrom(DB::IColumn const&, unsigned long) @ 0x238c0cb5 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:17.972911 [ 437 ] <Fatal> BaseDaemon: 5. ./build_docker/../src/Interpreters/FillingRow.cpp:124: DB::insertFromFillingRow(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::FillingRow const&, DB::Block const&) @ 0x24ad5a45 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.003736 [ 437 ] <Fatal> BaseDaemon: 6. ./build_docker/../src/Processors/Transforms/FillingTransform.cpp:0: DB::FillingTransform::transform(DB::Chunk&) @ 0x24ac98e2 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.019585 [ 437 ] <Fatal> BaseDaemon: 7. ./build_docker/../src/Processors/ISimpleTransform.h:38: DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) @ 0x1d32bb8b in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.030614 [ 437 ] <Fatal> BaseDaemon: 8. ./build_docker/../src/Processors/ISimpleTransform.cpp:99: DB::ISimpleTransform::work() @ 0x2461b111 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.037044 [ 437 ] <Fatal> BaseDaemon: 9. ./build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:53: DB::executeJob(DB::IProcessor*) @ 0x246426d9 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.042914 [ 437 ] <Fatal> BaseDaemon: 10. ./build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:65: DB::ExecutionThreadContext::executeTask() @ 0x24642568 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.057424 [ 437 ] <Fatal> BaseDaemon: 11. ./build_docker/../src/Processors/Executors/PipelineExecutor.cpp:213: DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) @ 0x24634bc1 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.069996 [ 437 ] <Fatal> BaseDaemon: 12. ./build_docker/../src/Processors/Executors/PipelineExecutor.cpp:326: DB::PipelineExecutor::executeImpl(unsigned long) @ 0x24634547 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.084028 [ 437 ] <Fatal> BaseDaemon: 13.1. inlined from ./build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:284: std::__1::unique_ptr<DB::ExecutingGraph, std::__1::default_delete<DB::ExecutingGraph> >::operator->() const
[ip-172-31-12-180] 2022.04.07 10:21:18.084060 [ 437 ] <Fatal> BaseDaemon: 13. ../src/Processors/Executors/PipelineExecutor.cpp:87: DB::PipelineExecutor::execute(unsigned long) @ 0x246340ad in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.098229 [ 437 ] <Fatal> BaseDaemon: 14. ./build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:0: DB::threadFunction(DB::PullingAsyncPipelineExecutor::Data&, std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) @ 0x24646d43 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.112350 [ 437 ] <Fatal> BaseDaemon: 15. ./build_docker/../contrib/libcxx/include/type_traits:3648: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(fp)()) std::__1::__invoke_constexpr<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&) @ 0x24646ca2 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.126354 [ 437 ] <Fatal> BaseDaemon: 16.1. inlined from ./build_docker/../contrib/libcxx/include/tuple:0: operator()
[ip-172-31-12-180] 2022.04.07 10:21:18.126391 [ 437 ] <Fatal> BaseDaemon: 16. ../contrib/libcxx/include/type_traits:3640: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&) @ 0x24646b5b in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.136281 [ 437 ] <Fatal> BaseDaemon: 17.1. inlined from ./build_docker/../contrib/libcxx/include/__functional/function.h:1157: std::__1::function<void ()>::operator=(std::nullptr_t)
[ip-172-31-12-180] 2022.04.07 10:21:18.136302 [ 437 ] <Fatal> BaseDaemon: 17. ../src/Common/ThreadPool.cpp:280: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xfd56a7a in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.147799 [ 437 ] <Fatal> BaseDaemon: 18. ./build_docker/../src/Common/ThreadPool.cpp:0: void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) @ 0xfd59542 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:21:18.147823 [ 437 ] <Fatal> BaseDaemon: 19. ? @ 0x7f932f16d609 in ?
[ip-172-31-12-180] 2022.04.07 10:21:18.147866 [ 437 ] <Fatal> BaseDaemon: 20. clone @ 0x7f932f092163 in ?
[ip-172-31-12-180] 2022.04.07 10:21:18.428414 [ 437 ] <Fatal> BaseDaemon: Calculated checksum of the binary: C34E905A8E4FE5772658A5C8EA41FC89. There is no information about the reference checksum.
Timeout exceeded while receiving data from server. Waited for 10 seconds, timeout is 10 seconds.
Error on processing query 'SELECT (-2147483649 % NULL) % NULL, inter + NULL AS inter_p FROM (SELECT toFloat32(number % 65537) AS n, concat(inter, 'inte\0'), NULL, '' AS source, number AS inter FROM numbers(255) WHERE (number % 1.1920928955078125e-7) = '0.01') ORDER BY 2147483648 ASC NULLS FIRST, n ASC NULLS FIRST WITH FILL FROM 0 TO 11.51 STEP 0.5 INTERPOLATE ( inter_p AS inter_p + 1 )': Code: 210. DB::NetException: Connection reset by peer, while reading from socket (127.0.0.1:9000): while receiving packet from localhost:9000. (NETWORK_ERROR), Stack trace (when copying this message, always include the lines below):

@KochetovNicolai
Copy link
Member

Another one with logical error

ip-172-31-12-180] 2022.04.07 10:01:00.884572 [ 484 ] {def8468a-d866-416a-a4da-5904385a04cc} <Fatal> : Logical error: 'Bad cast from type DB::ColumnConst to DB::ColumnNullable'.
[ip-172-31-12-180] 2022.04.07 10:02:06.874394 [ 501 ] <Fatal> BaseDaemon: ########################################
[ip-172-31-12-180] 2022.04.07 10:02:06.874754 [ 501 ] <Fatal> BaseDaemon: (version 22.4.1.1471, build id: 6E36BAE4AD96732B) (from thread 484) (query_id: def8468a-d866-416a-a4da-5904385a04cc) (query: SELECT n, source, inter + NULL AS inter_p FROM (SELECT toFloat32(number % 65535) AS n, '' AS source, number AS inter FROM numbers(100) WHERE (number % 1024) = 1024) ORDER BY inter_p + NULL DESC NULLS LAST, '-2147483648' DESC, n ASC NULLS LAST WITH FILL FROM 0 TO 11.51 STEP 0.5 INTERPOLATE ( inter_p AS inter_p + 1 )) Received signal Aborted (6)
[ip-172-31-12-180] 2022.04.07 10:02:06.875046 [ 501 ] <Fatal> BaseDaemon: 
[ip-172-31-12-180] 2022.04.07 10:02:06.875353 [ 501 ] <Fatal> BaseDaemon: Stack trace: 0x7f44451a403b 0x7f4445183859 0x17ab1a74 0x17ab1b82 0x17d531a3 0x2724f045 0x284d428e 0x284be3b9 0x223c5b82 0x27fccb1e 0x28009dd9 0x28009cd5 0x27feda01 0x27fedcd7 0x27feceeb 0x27fec3d8 0x28010886 0x28010760 0x280106f5 0x280106a1 0x280105b2 0x2801049b 0x28010375 0x2801033d 0x28010315 0x280102e0 0x17b13f66 0x17b10455 0x17bbedaf 0x17bc57a4 0x17bc5735 0x17bc5665 0x17bc4fa2 0x7f444535b609 0x7f4445280163
[ip-172-31-12-180] 2022.04.07 10:02:06.875656 [ 501 ] <Fatal> BaseDaemon: 4. gsignal @ 0x7f44451a403b in ?
[ip-172-31-12-180] 2022.04.07 10:02:06.875843 [ 501 ] <Fatal> BaseDaemon: 5. abort @ 0x7f4445183859 in ?
[ip-172-31-12-180] 2022.04.07 10:02:07.036781 [ 501 ] <Fatal> BaseDaemon: 6. /build/build_docker/../src/Common/Exception.cpp:52: DB::handle_error_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool, std::__1::vector<void*, std::__1::allocator<void*> > const&) @ 0x17ab1a74 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:07.126370 [ 501 ] <Fatal> BaseDaemon: 7. /build/build_docker/../src/Common/Exception.cpp:59: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0x17ab1b82 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:07.380624 [ 501 ] <Fatal> BaseDaemon: 8. /build/build_docker/../src/Common/assert_cast.h:47: DB::ColumnNullable const& assert_cast<DB::ColumnNullable const&, DB::IColumn const&>(DB::IColumn const&) @ 0x17d531a3 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:07.499776 [ 501 ] <Fatal> BaseDaemon: 9. /build/build_docker/../src/Columns/ColumnNullable.cpp:188: DB::ColumnNullable::insertFrom(DB::IColumn const&, unsigned long) @ 0x2724f045 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:07.747170 [ 501 ] <Fatal> BaseDaemon: 10. /build/build_docker/../src/Interpreters/FillingRow.cpp:125: DB::insertFromFillingRow(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::FillingRow const&, DB::Block const&) @ 0x284d428e in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.033336 [ 501 ] <Fatal> BaseDaemon: 11. /build/build_docker/../src/Processors/Transforms/FillingTransform.cpp:306: DB::FillingTransform::transform(DB::Chunk&) @ 0x284be3b9 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.180908 [ 501 ] <Fatal> BaseDaemon: 12. /build/build_docker/../src/Processors/ISimpleTransform.h:38: DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) @ 0x223c5b82 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.305718 [ 501 ] <Fatal> BaseDaemon: 13. /build/build_docker/../src/Processors/ISimpleTransform.cpp:89: DB::ISimpleTransform::work() @ 0x27fccb1e in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.398481 [ 501 ] <Fatal> BaseDaemon: 14. /build/build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:45: DB::executeJob(DB::IProcessor*) @ 0x28009dd9 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.487451 [ 501 ] <Fatal> BaseDaemon: 15. /build/build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:63: DB::ExecutionThreadContext::executeTask() @ 0x28009cd5 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.646712 [ 501 ] <Fatal> BaseDaemon: 16. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:213: DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) @ 0x27feda01 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.806164 [ 501 ] <Fatal> BaseDaemon: 17. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:178: DB::PipelineExecutor::executeSingleThread(unsigned long) @ 0x27fedcd7 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:08.943539 [ 501 ] <Fatal> BaseDaemon: 18. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:324: DB::PipelineExecutor::executeImpl(unsigned long) @ 0x27feceeb in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:09.101547 [ 501 ] <Fatal> BaseDaemon: 19. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:84: DB::PipelineExecutor::execute(unsigned long) @ 0x27fec3d8 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:09.254883 [ 501 ] <Fatal> BaseDaemon: 20. /build/build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:78: DB::threadFunction(DB::PullingAsyncPipelineExecutor::Data&, std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) @ 0x28010886 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:09.407153 [ 501 ] <Fatal> BaseDaemon: 21. /build/build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:106: DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0::operator()() const @ 0x28010760 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:09.562849 [ 501 ] <Fatal> BaseDaemon: 22. /build/build_docker/../contrib/libcxx/include/type_traits:3648: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(fp)()) std::__1::__invoke_constexpr<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&) @ 0x280106f5 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:09.716437 [ 501 ] <Fatal> BaseDaemon: 23. /build/build_docker/../contrib/libcxx/include/tuple:1595: decltype(auto) std::__1::__apply_tuple_impl<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&, std::__1::__tuple_indices<>) @ 0x280106a1 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:09.870602 [ 501 ] <Fatal> BaseDaemon: 24. /build/build_docker/../contrib/libcxx/include/tuple:1604: decltype(auto) std::__1::apply<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&) @ 0x280105b2 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.004134 [ 501 ] <Fatal> BaseDaemon: 25. /build/build_docker/../src/Common/ThreadPool.h:188: ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()::operator()() @ 0x2801049b in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.157147 [ 501 ] <Fatal> BaseDaemon: 26. /build/build_docker/../contrib/libcxx/include/type_traits:3640: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&) @ 0x28010375 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.308953 [ 501 ] <Fatal> BaseDaemon: 27. /build/build_docker/../contrib/libcxx/include/__functional/invoke.h:62: void std::__1::__invoke_void_return_wrapper<void, true>::__call<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&) @ 0x2801033d in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.460927 [ 501 ] <Fatal> BaseDaemon: 28. /build/build_docker/../contrib/libcxx/include/__functional/function.h:230: std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()>::operator()() @ 0x28010315 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.612520 [ 501 ] <Fatal> BaseDaemon: 29. /build/build_docker/../contrib/libcxx/include/__functional/function.h:711: void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'(), void ()> >(std::__1::__function::__policy_storage const*) @ 0x280102e0 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.679884 [ 501 ] <Fatal> BaseDaemon: 30. /build/build_docker/../contrib/libcxx/include/__functional/function.h:843: std::__1::__function::__policy_func<void ()>::operator()() const @ 0x17b13f66 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.740114 [ 501 ] <Fatal> BaseDaemon: 31. /build/build_docker/../contrib/libcxx/include/__functional/function.h:1184: std::__1::function<void ()>::operator()() const @ 0x17b10455 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.811414 [ 501 ] <Fatal> BaseDaemon: 32. /build/build_docker/../src/Common/ThreadPool.cpp:277: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x17bbedaf in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.900301 [ 501 ] <Fatal> BaseDaemon: 33. /build/build_docker/../src/Common/ThreadPool.cpp:142: void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const @ 0x17bc57a4 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:10.993985 [ 501 ] <Fatal> BaseDaemon: 34. /build/build_docker/../contrib/libcxx/include/type_traits:3640: decltype(static_cast<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&) @ 0x17bc5735 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:11.087598 [ 501 ] <Fatal> BaseDaemon: 35. /build/build_docker/../contrib/libcxx/include/thread:283: void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>&, std::__1::__tuple_indices<>) @ 0x17bc5665 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:11.181725 [ 501 ] <Fatal> BaseDaemon: 36. /build/build_docker/../contrib/libcxx/include/thread:293: void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) @ 0x17bc4fa2 in /workspace/clickhouse
[ip-172-31-12-180] 2022.04.07 10:02:11.181959 [ 501 ] <Fatal> BaseDaemon: 37. ? @ 0x7f444535b609 in ?
[ip-172-31-12-180] 2022.04.07 10:02:11.182133 [ 501 ] <Fatal> BaseDaemon: 38. clone @ 0x7f4445280163 in ?
[ip-172-31-12-180] 2022.04.07 10:02:12.448866 [ 501 ] <Fatal> BaseDaemon: Calculated checksum of the binary: 9BA42FA17A9A5DC90D82F51FB3BD8630. There is no information about the reference checksum.
Error on processing query 'SELECT n, source, inter + NULL AS inter_p FROM (SELECT toFloat32(number % 65535) AS n, '' AS source, number AS inter FROM numbers(100) WHERE (number % 1024) = 1024) ORDER BY inter_p + NULL DESC NULLS LAST, '-2147483648' DESC, n ASC NULLS LAST WITH FILL FROM 0 TO 11.51 STEP 0.5 INTERPOLATE ( inter_p AS inter_p + 1 )': Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000. (ATTEMPT_TO_READ_AFTER_EOF), Stack trace (when copying this message, always include the lines below):

@yakov-olkhovskiy yakov-olkhovskiy added the do not test disable testing on pull request label Apr 7, 2022
@yakov-olkhovskiy
Copy link
Member Author

conversion for nullable column is not fixed yet...

@yakov-olkhovskiy yakov-olkhovskiy removed the do not test disable testing on pull request label Apr 8, 2022
@@ -134,7 +135,7 @@ void QueryNormalizer::visit(ASTTablesInSelectQueryElement & node, const ASTPtr &

static bool needVisitChild(const ASTPtr & child)
{
return !(child->as<ASTSelectQuery>() || child->as<ASTTableExpression>());
return !(child->as<ASTSelectQuery>() || child->as<ASTTableExpression>() || child->as<ASTInterpolateElement>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment why do we skip interpolate.

Comment on lines 1344 to 1360
auto find_columns = [&step, &select](IAST * function)
{
auto f_impl = [&step, &select](IAST * fn, auto fi)
{
if (auto * ident = fn->as<ASTIdentifier>())
{
if (select.count(ident->getColumnName()) == 0)
step.addRequiredOutput(ident->getColumnName());
return;
}
if (fn->as<ASTFunction>() || fn->as<ASTExpressionList>())
for (const auto & ch : fn->children)
fi(ch.get(), fi);
return;
};
f_impl(function, f_impl);
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can add a small comment here as well

@LukeHarrimanHQ
Copy link

+1 for adding PARTITION BY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature Pull request with new product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ORDER BY WITH FILL with last values
5 participants