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

[GLUTEN-3934][CH]Bug fix log function diff #3935

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

KevinyhZou
Copy link
Contributor

What changes were proposed in this pull request?

(Please fill in changes proposed in this fix)

(Fixes: #3934)

How was this patch tested?

(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)

TEST BY UT

Copy link

github-actions bot commented Dec 5, 2023

#3934

Copy link

github-actions bot commented Dec 5, 2023

Run Gluten Clickhouse CI

3 similar comments
Copy link

github-actions bot commented Dec 5, 2023

Run Gluten Clickhouse CI

Copy link

github-actions bot commented Dec 5, 2023

Run Gluten Clickhouse CI

Copy link

github-actions bot commented Dec 6, 2023

Run Gluten Clickhouse CI

Copy link

github-actions bot commented Dec 6, 2023

Run Gluten Clickhouse CI

auto nullable_result_type = makeNullable(result_type);

const auto * null_const_node = addColumnToActionsDAG(actions_dag, nullable_result_type, Field());
const auto * nullable_log_node = ActionsDAGUtil::convertNodeType(actions_dag, log_node, nullable_result_type->getName(), log_node->result_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

没必要强转。if函数会处理。

throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} requires exactly one arguments", getName());

const auto * arg_node = parsed_args[0];
const std::string function_name = getName();
Copy link
Contributor

Choose a reason for hiding this comment

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

getName()返回的是substrait function name, 不是ch function name。这里不能混为一谈

const auto * log_node = toFunctionNode(actions_dag, function_name, {arg_node});

auto result_type = log_node->result_type;
auto nullable_result_type = makeNullable(result_type);
Copy link
Contributor

Choose a reason for hiding this comment

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

可以合并了,auto nullable_result_type = makeNullable(log_node->result_type);

const auto * null_const_node = addColumnToActionsDAG(actions_dag, nullable_result_type, Field());
const auto * nullable_log_node = ActionsDAGUtil::convertNodeType(actions_dag, log_node, nullable_result_type->getName(), log_node->result_name);
const DB::Float64 lowerBound = getParameterLowerBoundValue();
const auto * le_node = toFunctionNode(actions_dag, "lessOrEquals", {arg_node, addColumnToActionsDAG(actions_dag, result_type, lowerBound)});
Copy link
Contributor

Choose a reason for hiding this comment

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

lowerBound类型错了,应该是 arg_node的类型。

if (x <= c)
null
else
log(c)
Copy link
Contributor

Choose a reason for hiding this comment

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

这里应该是 x <= 0, log(x) ?

Copy link

Run Gluten Clickhouse CI

@KevinyhZou
Copy link
Contributor Author

Fixed done.

Copy link

Run Gluten Clickhouse CI

Copy link

Run Gluten Clickhouse CI

Copy link
Contributor

@liuneng1994 liuneng1994 left a comment

Choose a reason for hiding this comment

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

LGTM

@liuneng1994 liuneng1994 merged commit bf42fd7 into apache:main Dec 13, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CH] Result diff in ln(0), log2(0), log10(0)
4 participants