Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Jan 14, 2025
1 parent bf001d1 commit 293a483
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
23 changes: 18 additions & 5 deletions processing/src/main/java/org/apache/druid/query/DataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,27 @@ public interface DataSource
*/
boolean isConcrete();

static class SegmentMapConfig {

private Query query;
private AtomicLong cpuTimeAcc;

public SegmentMapConfig(Query query, AtomicLong cpuTimeAcc)
{
this.query = query;
this.cpuTimeAcc = cpuTimeAcc;
}

static SegmentMapConfig of(Query query, AtomicLong cpuTimeAcc)
{
return new SegmentMapConfig(query,cpuTimeAcc);
}
}

/**
* Returns a segment function on to how to segment should be modified.
*
* @param query the input query
* @param cpuTimeAcc the cpu time accumulator
* @return the segment function
*/
Function<SegmentReference, SegmentReference> createSegmentMapFunction(Query query, AtomicLong cpuTimeAcc);
Function<SegmentReference, SegmentReference> createSegmentMapFunction(SegmentMapConfig req);

/**
* Returns an updated datasource based on the specified new source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,10 @@ public boolean isConcrete()
}

@Override
public Function<SegmentReference, SegmentReference> createSegmentMapFunction(
Query query,
AtomicLong cpuTimeAccumulator
)
public Function<SegmentReference, SegmentReference> createSegmentMapFunction(SegmentMapConfig req)
{
final Function<SegmentReference, SegmentReference> segmentMapFn = base.createSegmentMapFunction(
query,
cpuTimeAccumulator
req
);
return JvmUtils.safeAccumulateThreadCpuTime(
cpuTimeAccumulator,
Expand Down

0 comments on commit 293a483

Please sign in to comment.