-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to configure default analysis types in SegmentMetadataQuery #4259
Merged
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
ddb6565
Option to configure default analysis types
gkc2104 4103a6c
Updated Docs and renamed
gkc2104 9891b09
Added serde tests and Null handling
gkc2104 81e7464
Fixed Documentation
gkc2104 6c9cde2
Updated implementation
gkc2104 a756d4f
Merge branch 'master' of https://github.com/druid-io/druid into defau…
gkc2104 dfacab1
Updated implementation
gkc2104 98db5a7
Updated implementation
gkc2104 7313175
Added usingDefaultIntervals in Builder
gkc2104 6612a4a
Updated implementation
gkc2104 639661f
Updated implementation and added failing test
gkc2104 cb98ac3
filterSegments implementation updated
gkc2104 5529f6a
Merge branch 'master' of https://github.com/druid-io/druid into defau…
gkc2104 b544694
Updated imlementation
gkc2104 f68927e
Padding
leventov aee4da9
Merge remote-tracking branch 'upstream/master' into defaultAnalysisUp…
leventov 6e1a11c
Add missing Override
leventov bd2324f
Updated implementation
gkc2104 1871c92
Hmm
gkc2104 6433796
Fixed a naming bug
gkc2104 7096d9a
Fixed bug
gkc2104 8aecbde
Merge branch 'defaultAnalysisUpdate' of https://github.com/metamx/dru…
gkc2104 b7f586c
Removed comment
gkc2104 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ | |
import javax.annotation.Nullable; | ||
import java.nio.ByteBuffer; | ||
import java.util.Arrays; | ||
import java.util.EnumSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
@@ -188,7 +189,7 @@ public boolean isCacheable(SegmentMetadataQuery query, boolean willMergeRunners) | |
public byte[] computeCacheKey(SegmentMetadataQuery query) | ||
{ | ||
byte[] includerBytes = query.getToInclude().getCacheKey(); | ||
byte[] analysisTypesBytes = query.getAnalysisTypesCacheKey(); | ||
byte[] analysisTypesBytes = getAnalysisTypesCacheKey(query); | ||
return ByteBuffer.allocate(1 + includerBytes.length + analysisTypesBytes.length) | ||
.put(SEGMENT_METADATA_CACHE_PREFIX) | ||
.put(includerBytes) | ||
|
@@ -404,4 +405,39 @@ public static SegmentAnalysis finalizeAnalysis(SegmentAnalysis analysis) | |
analysis.isRollup() | ||
); | ||
} | ||
|
||
public EnumSet<SegmentMetadataQuery.AnalysisType> getAnalysisTypes(SegmentMetadataQuery query) | ||
{ | ||
if (query.getAnalysisTypes() == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggested |
||
return config != null ? config.getDefaultAnalysisType() : SegmentMetadataQueryConfig.DEFAULT_ANALYSIS_TYPES; | ||
} else { | ||
return query.getAnalysisTypes(); | ||
} | ||
} | ||
|
||
public SegmentAnalyzer getSegmentAnalyzer(SegmentMetadataQuery query) | ||
{ | ||
return new SegmentAnalyzer(getAnalysisTypes(query)); | ||
} | ||
|
||
private byte[] getAnalysisTypesCacheKey(SegmentMetadataQuery query) | ||
{ | ||
int size = 1; | ||
final EnumSet<SegmentMetadataQuery.AnalysisType> analysisTypes = getAnalysisTypes(query); | ||
|
||
final List<byte[]> typeBytesList = Lists.newArrayListWithExpectedSize(analysisTypes.size()); | ||
for (SegmentMetadataQuery.AnalysisType analysisType : analysisTypes) { | ||
final byte[] bytes = analysisType.getCacheKey(); | ||
typeBytesList.add(bytes); | ||
size += bytes.length; | ||
} | ||
|
||
final ByteBuffer bytes = ByteBuffer.allocate(size); | ||
bytes.put(SegmentMetadataQuery.ANALYSIS_TYPES_CACHE_PREFIX); | ||
for (byte[] typeBytes : typeBytesList) { | ||
bytes.put(typeBytes); | ||
} | ||
|
||
return bytes.array(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested defaultAnalysisTypes (update getter and setter names too)