Yida Wu has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/24284 )

Change subject: IMPALA-14963: Query Profile AI Analysis Tool
......................................................................


Patch Set 16:

(2 comments)

http://gerrit.cloudera.org:8080/#/c/24284/16/be/src/exprs/expr-test.cc
File be/src/exprs/expr-test.cc:

http://gerrit.cloudera.org:8080/#/c/24284/16/be/src/exprs/expr-test.cc@11625
PS16, Line 11625:
I think we can add a test for the tool_calls error path here:
"
  string bad_type_response = R"({
    "choices": [
      {
        "message": {
          "role": "assistant",
          "content": null,
          "tool_calls": "A string, not an array"
        }
      }
    ]
  })";

  string bad_type_parsed = 
AiFunctions::AiGenerateTextParseOpenAiResponse(bad_type_response);
  EXPECT_EQ(bad_type_parsed, AiFunctions::AI_GENERATE_TXT_JSON_PARSE_ERROR);
"


http://gerrit.cloudera.org:8080/#/c/24284/16/be/src/service/query-profile-ai-analysis-test.cc
File be/src/service/query-profile-ai-analysis-test.cc:

http://gerrit.cloudera.org:8080/#/c/24284/16/be/src/service/query-profile-ai-analysis-test.cc@38
PS16, Line 38: TEST(QueryProfileAiAnalysisHelpersTest, 
ParseJsonObjectFromNoisyResponse) {
Thanks for adding the tests.
Maybe we can add one more case to test concurrency.
"
#include <thread>
#include <vector>
#include <atomic>

using std::atomic;
using std::vector;

TEST(QueryProfileAiAnalysisHelpersTest, MaxConcurrentSlotsMultithreaded) {
  const int max_runs = 3;
  const int num_threads = 10;
  atomic<int> successful_acquires(0);

  // Run multiple threads simultaneously, but only max_runs succeeded.
  vector<std::thread> threads;
  for (int i = 0; i < num_threads; ++i) {
    threads.emplace_back([&successful_acquires, max_runs]() {
      if (TryAcquireAiAnalysisSlot(max_runs)) {
        successful_acquires.fetch_add(1, std::memory_order_relaxed);
      }
    });
  }

  for (auto& t : threads) {
    t.join();
  }

  EXPECT_EQ(max_runs, successful_acquires.load());
  EXPECT_FALSE(TryAcquireAiAnalysisSlot(max_runs));
  for (int i = 0; i < max_runs; ++i) {
    ReleaseAiAnalysisSlot();
  }
}
"



--
To view, visit http://gerrit.cloudera.org:8080/24284
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia9376b8c56df75032f51abbb76b3ac6927f9107e
Gerrit-Change-Number: 24284
Gerrit-PatchSet: 16
Gerrit-Owner: Gokul Kolady <[email protected]>
Gerrit-Reviewer: Abhishek Rawat <[email protected]>
Gerrit-Reviewer: Gokul Kolady <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jason Fehr <[email protected]>
Gerrit-Reviewer: Kurt Deschler <[email protected]>
Gerrit-Reviewer: Yida Wu <[email protected]>
Gerrit-Comment-Date: Wed, 20 May 2026 02:53:41 +0000
Gerrit-HasComments: Yes

Reply via email to