-
Notifications
You must be signed in to change notification settings - Fork 411
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
Throw DB Exception when AggregateFunctionNullUnary handles unexpected column #1493
Conversation
const ColumnNullable * column = static_cast<const ColumnNullable *>(columns[0]); | ||
if (!column->isNullAt(row_num)) | ||
const IColumn * column = columns[0]; | ||
const auto * maybe_nullable_column = dynamic_cast<const ColumnNullable *>(column); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the input is a nullable type, and it can not be converted to ColumnNullable
, I guess that it is a ColumnConst
, so I think its better to
organize the code as follows:
if (const auto * column_nullable= dynamic_cast<const ColumnNullable *>(column))
{}
else if (const auto * column_const = dynamic_cast<const ColumnConst *>(column))
{}
eles
{
// throw error
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After throw custom exception it is revealed that the actual column type of issue SQL is Int64
a.k.a ColumnVector<Int64>
, not ColumnConst
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as we discussed offline, this is because the type passed by TiDB is not correct, we should fix the TiDB bug and to see what happens here.
Should add some tests to verify the fix. |
/run-all-tests |
/run-all-tests |
…column Signed-off-by: tison <[email protected]>
/run-all-tests |
What problem does this PR solve?
Issue Number: close #1492
Follow up for #481
Problem Summary:
What is changed and how it works?
Properly handle nonnull column case when
empty_input_as_null
istrue
to get the correct semantic and avoid nullptr.Related changes
Check List
It is an obvious fix but we can add the original SQL as an integrated test.
Release note
N/A