This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 47313d9ae42 [chore](be) remove some useless code and add some comments 
(#66731)
47313d9ae42 is described below

commit 47313d9ae42788a4f3ca8633e8ddd4fc79c4259e
Author: yiguolei <[email protected]>
AuthorDate: Fri Aug 14 11:30:40 2026 +0800

    [chore](be) remove some useless code and add some comments (#66731)
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/common/compiler_util.h               |  2 --
 be/src/exec/operator/operator.h             |  2 --
 be/src/exec/operator/scan_operator.cpp      |  5 -----
 be/src/exec/operator/scan_operator.h        |  3 ---
 be/src/storage/segment/segment_iterator.cpp |  7 +++++++
 be/src/util/jni-util.cpp                    | 10 +++++++++-
 6 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/be/src/common/compiler_util.h b/be/src/common/compiler_util.h
index 1d2a25b7742..fffb9a41d4e 100644
--- a/be/src/common/compiler_util.h
+++ b/be/src/common/compiler_util.h
@@ -50,8 +50,6 @@
 
 #define ALIGN_CACHE_LINE __attribute__((aligned(CACHE_LINE_SIZE)))
 
-#define PURE __attribute__((pure))
-
 #ifdef __clang__
 #define NO_SANITIZE_UNDEFINED __attribute__((__no_sanitize__("undefined")))
 #else
diff --git a/be/src/exec/operator/operator.h b/be/src/exec/operator/operator.h
index d60c8fe2320..bb5cab376e6 100644
--- a/be/src/exec/operator/operator.h
+++ b/be/src/exec/operator/operator.h
@@ -823,7 +823,6 @@ public:
               _node_id(tnode.node_id),
               _type(tnode.node_type),
               _pool(pool),
-              _tuple_ids(tnode.row_tuples),
               _row_descriptor(descs, tnode.row_tuples),
               _resource_profile(tnode.resource_profile),
               _limit(tnode.limit) {
@@ -992,7 +991,6 @@ protected:
     int _nereids_id = -1;
     TPlanNodeType::type _type;
     ObjectPool* _pool = nullptr;
-    std::vector<TupleId> _tuple_ids;
 
 private:
     // The expr of operator set to private permissions, as cannot be executed 
concurrently,
diff --git a/be/src/exec/operator/scan_operator.cpp 
b/be/src/exec/operator/scan_operator.cpp
index e1aff774e7a..0d51c2e3bfd 100644
--- a/be/src/exec/operator/scan_operator.cpp
+++ b/be/src/exec/operator/scan_operator.cpp
@@ -1032,10 +1032,6 @@ Status ScanLocalState<Derived>::_start_scanners(
     return Status::OK();
 }
 
-template <typename Derived>
-const TupleDescriptor* ScanLocalState<Derived>::input_tuple_desc() const {
-    return _parent->cast<typename Derived::Parent>()._input_tuple_desc;
-}
 template <typename Derived>
 const TupleDescriptor* ScanLocalState<Derived>::output_tuple_desc() const {
     return _parent->cast<typename Derived::Parent>()._output_tuple_desc;
@@ -1265,7 +1261,6 @@ Status ScanOperatorX<LocalStateType>::init(const 
TPlanNode& tnode, RuntimeState*
 
 template <typename LocalStateType>
 Status ScanOperatorX<LocalStateType>::prepare(RuntimeState* state) {
-    _input_tuple_desc = 
state->desc_tbl().get_tuple_descriptor(_input_tuple_id);
     _output_tuple_desc = 
state->desc_tbl().get_tuple_descriptor(_output_tuple_id);
     RETURN_IF_ERROR(OperatorX<LocalStateType>::prepare(state));
 
diff --git a/be/src/exec/operator/scan_operator.h 
b/be/src/exec/operator/scan_operator.h
index e11eb506a77..1bf161b6a93 100644
--- a/be/src/exec/operator/scan_operator.h
+++ b/be/src/exec/operator/scan_operator.h
@@ -66,7 +66,6 @@ public:
 
     virtual RuntimeProfile* scanner_profile() = 0;
 
-    [[nodiscard]] virtual const TupleDescriptor* input_tuple_desc() const = 0;
     [[nodiscard]] virtual const TupleDescriptor* output_tuple_desc() const = 0;
 
     virtual int64_t limit_per_scanner() = 0;
@@ -244,7 +243,6 @@ class ScanLocalState : public ScanLocalStateBase {
 
     RuntimeProfile* scanner_profile() override { return 
_scanner_profile.get(); }
 
-    [[nodiscard]] const TupleDescriptor* input_tuple_desc() const override;
     [[nodiscard]] const TupleDescriptor* output_tuple_desc() const override;
 
     int64_t limit_per_scanner() override;
@@ -432,7 +430,6 @@ protected:
     // For query scan node, there is only output_tuple_desc.
     TupleId _input_tuple_id = -1;
     TupleId _output_tuple_id = -1;
-    const TupleDescriptor* _input_tuple_desc = nullptr;
     const TupleDescriptor* _output_tuple_desc = nullptr;
 
     phmap::flat_hash_map<int, SlotDescriptor*> _slot_id_to_slot_desc;
diff --git a/be/src/storage/segment/segment_iterator.cpp 
b/be/src/storage/segment/segment_iterator.cpp
index 14a5fab34c5..e7bf0205360 100644
--- a/be/src/storage/segment/segment_iterator.cpp
+++ b/be/src/storage/segment/segment_iterator.cpp
@@ -3248,6 +3248,13 @@ void SegmentIterator::_output_index_result_column(const 
VExprContextSPtrs& expr_
     }
 }
 
+// Dictionary codes are initially assigned in dictionary insertion order, so 
their numeric order
+// does not necessarily match the order of the encoded values. For example, an 
initial dictionary
+// {0: "zebra", 1: "apple", 2: "mango"} is sorted into {0: "apple", 1: 
"mango", 2: "zebra"},
+// and row codes are remapped from {0, 2, 1} to {2, 1, 0}. Range predicates 
compare codes with <,
+// <=, >, or >= and therefore require this conversion. IN/NOT IN predicates do 
not: they build a
+// membership bitmap indexed by the existing dictionary codes. Bloom-filter 
predicates instead need
+// hash values initialized for dictionary entries.
 void SegmentIterator::_convert_dict_code_for_predicate_if_necessary() {
     for (auto predicate : _short_cir_eval_predicate) {
         _convert_dict_code_for_predicate_if_necessary_impl(predicate);
diff --git a/be/src/util/jni-util.cpp b/be/src/util/jni-util.cpp
index 64f223f75f5..a54a7bf2ad1 100644
--- a/be/src/util/jni-util.cpp
+++ b/be/src/util/jni-util.cpp
@@ -168,6 +168,12 @@ Status Env::GetJNIEnvSlowPath(JNIEnv** env) {
     DCHECK(!tls_env_) << "Call GetJNIEnv() fast path";
 
 #ifdef USE_LIBHDFS3
+    // libhdfs3 is a pure native HDFS client that does not manage any JVM 
lifecycle.
+    // However, Doris still relies on features such as Java UDFs, so it has to 
implement its own
+    // `FindOrCreateJavaVM()` logic. When encountering the `JNI_EDETACHED` 
error code, Doris is
+    // responsible for invoking `AttachCurrentThread()` on its own.
+    // This only used on MacOS, so even though there maybe memory leak 
(because we do not
+    // detach the thread), do not care about it.
     std::call_once(g_vm_once, FindOrCreateJavaVM);
     int rc = g_vm->GetEnv(reinterpret_cast<void**>(&tls_env_), 
JNI_VERSION_1_8);
     if (rc == JNI_EDETACHED) {
@@ -177,7 +183,9 @@ Status Env::GetJNIEnvSlowPath(JNIEnv** env) {
         return Status::JniError("Unable to get JVM: {}", rc);
     }
 #else
-    // the hadoop libhdfs will do all the stuff
+    // The `getJNIEnv()` function of Hadoop libhdfs creates a POSIX TLS 
`ThreadLocalState` for every
+    // native thread that invokes it, and registers a destructor with the TLS 
key.
+    // The pthread library automatically invokes this destructor upon thread 
exit.
     std::call_once(g_jvm_conf_once, SetEnvIfNecessary);
     tls_env_ = getJNIEnv();
 #endif


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to