Skip to content

Commit 0ba1c08

Browse files
authored
Fix presto query config kQueryTraceTaskRegExp (prestodb#25702)
Summary: Current implemntation could match x.fregmentId.y.z.a.b.c.shardId.other The fix would restrict there is no y.z.a.b.c in between but only y ``` == NO RELEASE NOTE == ```
1 parent bc7c50b commit 0ba1c08

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

presto-native-execution/presto_cpp/main/QueryContextManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,12 @@ QueryContextManager::toVeloxConfigs(
264264

265265
// Construct query tracing regex and pass to Velox config.
266266
// It replaces the given native_query_trace_task_reg_exp if also set.
267+
// Normal format is {queryId}.{fragmentId}.{stageExecutionId}.{shardId}.{attemptId}
268+
// Implementation details is in PrestoTaskId.h
267269
if (traceFragmentId.has_value() || traceShardId.has_value()) {
268270
configs.emplace(
269271
velox::core::QueryConfig::kQueryTraceTaskRegExp,
270-
".*\\." + traceFragmentId.value_or(".*") + "\\..*\\." +
272+
".*\\." + traceFragmentId.value_or(".*") + "\\.[^.]*\\." +
271273
traceShardId.value_or(".*") + "\\..*");
272274
}
273275

presto-native-execution/presto_cpp/main/types/PrestoTaskId.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ class PrestoTaskId {
6666

6767
private:
6868
std::string queryId_;
69+
// Also known as fregment id.
6970
int32_t stageId_{0};
7071
int32_t stageExecutionId_{0};
72+
// Also known as shard id.
7173
int32_t id_{0};
7274
int32_t attemptNumber_{0};
7375
};

0 commit comments

Comments
 (0)