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

Backport #50056 to 23.3: JIT compilation not equals NaN fix #50120

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Functions/FunctionsComparison.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ template <> struct CompileOp<NotEqualsOp>
{
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * x, llvm::Value * y, bool /*is_signed*/)
{
return x->getType()->isIntegerTy() ? b.CreateICmpNE(x, y) : b.CreateFCmpONE(x, y);
return x->getType()->isIntegerTy() ? b.CreateICmpNE(x, y) : b.CreateFCmpUNE(x, y);
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--
0
0
0
0
0
0
25 changes: 25 additions & 0 deletions tests/queries/0_stateless/02763_jit_compare_functions_nan.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SET compile_expressions = 1;
SET min_count_to_compile_expression = 0;

DROP TABLE IF EXISTS test_table_1;
DROP TABLE IF EXISTS test_table_2;

CREATE TABLE test_table_1 (id UInt32) ENGINE = MergeTree ORDER BY (id);
create table test_table_2 (id UInt32) ENGINE = MergeTree ORDER BY (id);
INSERT INTO test_table_1 VALUES (2);
INSERT INTO test_table_2 VALUES (2);

select t1.id, t2.id FROM test_table_1 AS t1 RIGHT JOIN test_table_2 AS t2 ON (t1.id = t2.id)
WHERE (acos(t2.id) <> atan(t1.id)) and (not (acos(t2.id) <> atan(t1.id)));

DROP TABLE test_table_1;
DROP TABLE test_table_2;

SELECT '--';

SELECT (acos(a) <> atan(b)) and (not (acos(a) <> atan(b))) r FROM (SELECT 2 a, 2 b);
SELECT (acos(a) <> atan(b)) and (not (acos(a) <> atan(b))) r FROM (SELECT 2 a, 2 b);
SELECT (acos(a) <> atan(b)) and (not (acos(a) <> atan(b))) r FROM (SELECT 2 a, 2 b);
SELECT (acos(a) <> atan(b)) and (not (acos(a) <> atan(b))) r FROM (SELECT 2 a, 2 b);
SELECT (acos(a) <> atan(b)) and (not (acos(a) <> atan(b))) r FROM (SELECT 2 a, 2 b);
SELECT (acos(a) <> atan(b)) and (not (acos(a) <> atan(b))) r FROM (SELECT 2 a, 2 b);