Skip to content

[Bug](function) fix function in get wrong result when input const column#19791

Merged
BiteTheDDDDt merged 7 commits intoapache:masterfrom
BiteTheDDDDt:fix_0518
May 22, 2023
Merged

[Bug](function) fix function in get wrong result when input const column#19791
BiteTheDDDDt merged 7 commits intoapache:masterfrom
BiteTheDDDDt:fix_0518

Conversation

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor

@BiteTheDDDDt BiteTheDDDDt commented May 18, 2023

Proposed changes

  1. fix function in get wrong result when input const column
mysql [test]>SELECT  (abs(1)=1) IN (null) FROM t0;
+------------------------+
| (abs(1) = 1) IN (NULL) |
+------------------------+
|                   NULL |
|                      1 |
|                      1 |
+------------------------+
3 rows in set (0.12 sec)

introduced by: #18310

  1. fix all_arguments_are_constant not match with is_constant
  2. null_type need treated like boolean_type
SELECT CASE (TIMESTAMP '1970-12-04 03:51:34' NOT BETWEEN TIMESTAMP '1970-11-11 16:41:26' AND TIMESTAMP 'CURRENT_TIMESTAMP')  WHEN (0.7532032132148743 BETWEEN 0.7817240953445435 AND CAST('.' AS FLOAT) ) THEN (- (- 2093562249))  WHEN CAST((true IN (false)) AS BOOLEAN)  THEN (+ 1351956476) END  FROM t1 WHERE (NULL IN (CASE CAST('-658171195' AS BOOLEAN)   WHEN ((TIMESTAMP '1970-02-25 22:11:59') IS NOT NULL) THEN NULL  WHEN ((true) IS NULL) THEN NULL END )) GROUP BY t1.c0 ORDER BY 1;
 0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, siginfo_t*, void*) at /home/zcp/repo_center/doris_master/doris/be/src/common/signal_handler.h:413
 1# 0x00007FC6501FF2B7 in /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so
 2# JVM_handle_linux_signal in /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so
 3# 0x00007FC6501F80AC in /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so
 4# 0x00007FC654EB30C0 in /lib/x86_64-linux-gnu/libc.so.6
 5# doris::vectorized::FunctionIn<false>::execute_impl(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long) in /mnt/hdd01/PERFORMANCE_DORIS_MASTER_DEFAULT_ENV/be/lib/doris_be
 6# doris::vectorized::DefaultExecutable::execute_impl(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long) at /home/zcp/repo_center/doris_master/doris/be/src/vec/functions/function.h:480
 7# doris::vectorized::PreparedFunctionImpl::execute_without_low_cardinality_columns(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long, bool) at /home/zcp/repo_center/doris_master/doris/be/src/vec/functions/function.cpp:271
 8# doris::vectorized::PreparedFunctionImpl::execute(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long, bool) at /home/zcp/repo_center/doris_master/doris/be/src/vec/functions/function.cpp:277
 9# doris::vectorized::IFunctionBase::execute(doris::FunctionContext*, doris::vectorized::Block&, std::vector<unsigned long, std::allocator<unsigned long> > const&, unsigned long, unsigned long, bool) at /home/zcp/repo_center/doris_master/doris/be/src/vec/functions/function.h:171
10# doris::vectorized::VInPredicate::execute(doris::vectorized::VExprContext*, doris::vectorized::Block*, int*) at /home/zcp/repo_center/doris_master/doris/be/src/vec/exprs/vin_predicate.cpp:104
11# doris::vectorized::VExpr::get_const_col(doris::vectorized::VExprContext*, std::shared_ptr<doris::ColumnPtrWrapper>*) at /home/zcp/repo_center/doris_master/doris/be/src/vec/exprs/vexpr.cpp:404
12# doris::vectorized::VScanNode::_eval_const_conjuncts(doris::vectorized::VExpr*, doris::vectorized::VExprContext*, doris::vectorized::VScanNode::PushDownType*) at /home/zcp/repo_center/doris_master/doris/be/src/vec/exec/scan/vscan_node.cpp:787
13# doris::vectorized::VScanNode::_normalize_predicate(doris::vectorized::VExpr*, doris::vectorized::VExpr**) at /home/zcp/repo_center/doris_master/doris/be/src/vec/exec/scan/vscan_node.cpp:606
14# doris::vectorized::VScanNode::_normalize_conjuncts() at /home/zcp/repo_center/doris_master/doris/be/src/vec/exec/scan/vscan_node.cpp:542
15# doris::vectorized::NewOlapScanNode::_process_conjuncts() at /home/zcp/repo_center/doris_master/doris/be/src/vec/exec/scan/new_olap_scan_node.cpp:248
16# doris::vectorized::VScanNode::alloc_resource(doris::RuntimeState*) at /home/zcp/repo_center/doris_master/doris/be/src/vec/exec/scan/vscan_node.cpp:173
17# doris::ExecNode::open(doris::RuntimeState*) at /home/zcp/repo_center/doris_master/doris/be/src/exec/exec_node.cpp:155
18# doris::vectorized::VScanNode::open(doris::RuntimeState*) at /home/zcp/repo_center/doris_master/doris/be/src/vec/exec/scan/vscan_node.cpp:161
19# doris::vectorized::AggregationNode::open(doris::RuntimeState*) at /home/zcp/repo_center/doris_master/doris/be/src/vec/exec/vaggregation_node.cpp:517
20# doris::PlanFragmentExecutor::open_vectorized_internal() in /mnt/hdd01/PERFORMANCE_DORIS_MASTER_DEFAULT_ENV/be/lib/doris_be
21# doris::PlanFragmentExecutor::open() at /home/zcp/repo_center/doris_master/doris/be/src/runtime/plan_fragment_executor.cpp:264
22# doris::FragmentExecState::execute() at /home/zcp/repo_center/doris_master/doris/be/src/runtime/fragment_mgr.cpp:263
23# doris::FragmentMgr::_exec_actual(std::shared_ptr<doris::FragmentExecState>, std::function<void (doris::RuntimeState*, doris::Status*)> const&) at /home/zcp/repo_center/doris_master/doris/be/src/runtime/fragment_mgr.cpp:533
24# std::_Function_handler<void (), doris::FragmentMgr::exec_plan_fragment(doris::TExecPlanFragmentParams const&, std::function<void (doris::RuntimeState*, doris::Status*)> const&)::$_3>::_M_invoke(std::_Any_data const&) at /var/local/ldb_toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:291
25# doris::ThreadPool::dispatch_thread() in /mnt/hdd01/PERFORMANCE_DORIS_MASTER_DEFAULT_ENV/be/lib/doris_be
26# doris::Thread::supervise_thread(void*) at /home/zcp/repo_center/doris_master/doris/be/src/util/thread.cpp:466
27# start_thread at /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:478
28# __clone in /lib/x86_64-linux-gnu/libc.so.6

Problem summary

Describe your changes.

Checklist(Required)

  • Does it affect the original behavior
  • Has unit tests been added
  • Has document been added or modified
  • Does it need to update dependencies
  • Is this PR support rollback (If NO, please explain WHY)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions github-actions bot added area/sql/function Issues or PRs related to the SQL functions area/vectorization kind/test labels May 18, 2023
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@BiteTheDDDDt
Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label May 22, 2023
@github-actions
Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@BiteTheDDDDt BiteTheDDDDt merged commit d64be95 into apache:master May 22, 2023
@BiteTheDDDDt BiteTheDDDDt deleted the fix_0518 branch January 20, 2025 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/sql/function Issues or PRs related to the SQL functions area/vectorization kind/test reviewed sqlancer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants