-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Multi stage stats #12704
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
Merged
Merged
Multi stage stats #12704
Changes from all commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
c1ed6bb
Make V2 operators use their own logger
gortiz c907f04
Merge branch 'master' into multi-stage-stats
gortiz 10e7be4
Merge remote-tracking branch 'origin/master' into multi-stage-stats
gortiz d39ef00
Create StatMaps and use it in V2
gortiz bb72e72
Merge remote-tracking branch 'origin/master' into multi-stage-stats
gortiz 5db3bb8
Deep modification on multi-stage stats to:
gortiz 724d337
Several changes, still not tested
gortiz 12dcada
rename a variable/attribute
gortiz e96ac58
Fix checkstyle
gortiz 355732f
Modify MultiStageQueryStats to ignore errors while merging stats
gortiz 298d6f7
Rollback changes in SortOperator
gortiz a09f6a3
Remove TransferableBlockUtils.getEndOfStreamTransferableBlock() to al…
gortiz 983bfb0
Merge branch 'master' into multi-stage-stats
gortiz 3a36837
Fix some tests
gortiz bd3727c
Rollback to EOS without stats
gortiz 204398c
fix metadata backward compatibility issue
gortiz 0ab2f02
Add and fix some tests
gortiz dc7dda8
Keep NUM_GROUPS_LIMIT_REACHED in V1
gortiz adf22b1
StatMap without boxing
gortiz 1236b1c
Serialize StatMaps as older stats
gortiz 84e8aae
Simplify StatMap by storing data in an EnumMap
gortiz ce46a3e
Create a stat enum for leaf operator
gortiz d729651
Do not keep default values in StatMap
gortiz d21f97f
Fix QueryLoggerTest
gortiz ccf8294
Fix issue in StatMap.merge(K key, int value)
gortiz 6c979c2
Simplify MultiStageOperator.Type.deserializeStats
gortiz 14ec9c0
Serialize stage stats in the same way StatMap is serialized
gortiz 85dc213
Move custom updateEosBlock from MailboxReceiveOperator to BaseMailbox…
gortiz e83c197
Improve error detection and report format
gortiz dec1e22
Fix test
gortiz 14bc3af
Simplify stat relation between MultiStageOperator and BaseMailboxRece…
gortiz e172555
Fix SortedMailboxReceiveOperator not filling EOS when no row was found
gortiz 3e17e70
Add one stat class per multi-stage operator
gortiz 9c89a23
Fix some errors when multi stage stats were converted into trees
gortiz 8b09a7b
Remove MultiStageOperator.BaseStatKeys
gortiz 09fb937
Merge branch 'master' into multi-stage-stats
gortiz d6d344c
Fix MIN_CONSUMING_FRESHNESS_TIME_MS merge function
gortiz 5083ec5
Create functions for generic key merges
gortiz 821237f
Fix stats on union
gortiz 115c9d6
Fix QueryLoggerTest
gortiz c4b9988
concat stats from the current stage in set operations
gortiz ddb32cc
Merge remote-tracking branch 'master' into multi-stage-stats
gortiz f34112d
Remove unused import
gortiz d8ab892
Remove unused line
gortiz ec11bae
Report THREAD_CPU_TIME_NS and SYSTEM_ACTIVITIES_CPU_TIME_NS in V2
gortiz 0e38d4d
Add new receive, send and join stats
gortiz 4bc476e
Make some stats visible by default in JSON format
gortiz 4a2500a
Change metadata to be stored in metadata section
gortiz 69d6844
Merge remote-tracking branch 'origin/master' into multi-stage-stats
gortiz 974fae2
fix syntactic error.
gortiz 974fccb
fix a test compile issue
gortiz f166ef2
Fix issue in metadata deserialization
gortiz 2a61f5c
FIx MetadataBlockTest.emptyMetadataBlock
gortiz 8ed9b03
Keep buffer in the expected position when deserializing
gortiz a089b2b
Add v1 deserialization tests
gortiz bf2b554
add license headers
gortiz dcb197c
Fix checkstyle
gortiz 4755cba
Fix tests mocking new required methods
gortiz ba3a1ce
Fix concurrency issue
gortiz 9c54f4d
remove unused DataBlock.toDataOnlyDataTable
gortiz caaaf59
Increase protocol version of ColumnarDataBlock and RowDataBlock
gortiz 2b5b827
Add some javadoc
gortiz 131b956
Improve code style
gortiz 09f9a21
Small changes in code style
gortiz d719a3f
Rename `addStageStat` to `addStageStats`
gortiz 9329a8a
Remove TODO
gortiz 4349d3b
Add javadoc
gortiz a582c8a
Remove OperatorStats
gortiz f91e263
Remove generic from MultiStageOperator
gortiz 8cde598
Rename method
gortiz 4131f10
Remove blank line
gortiz 550329b
Remove test
gortiz da15044
Update testQueryTestCasesWithMetadata test
gortiz ebc24f3
Merge remote-tracking branch 'origin/master' into multi-stage-stats
gortiz 8afef13
Add comments in recursive case
gortiz 600a547
Modify recursiveCase to do not throw even if there is a mismatch in t…
gortiz 3bdcedb
Remove nullable annotation in TransferableBlock constructor
gortiz 66bd9ba
Remove assertion trick in MultiStageQueryStats
gortiz 2d55d24
Make BrokerResponseNativeV2 do not extends BrokerResponseNative
gortiz 47ae138
Merge remote-tracking branch 'master' into multi-stage-stats
gortiz 8327156
add comment
gortiz a3d44d2
Properly serialize exceptions in BrokerResponseNativeV2
gortiz bc58f63
Fix some json issues in BrokerResponseNative and v2
gortiz bd7afc1
Merge remote-tracking branch 'master' into multi-stage-stats
gortiz b1bef34
Change stageStats to be a tree instead of an array
gortiz dc4db11
Remove `shouldCollectStats` on V2 operators
gortiz 39ac9eb
Show `maxRowsInOperator` in Pinot UI
gortiz 0193a0d
Make `maxRowsInOperator` read only in Jackson
gortiz 2d96491
remove isPartialResult
gortiz c229fbf
Remove StatMap.Type.STRING and make MetadataKey do not implement Stat…
gortiz 12059aa
Add StatMap.Type.STRING again
gortiz 746fe2d
Fix bug that reported hash stats in the inverse order
gortiz c8468e1
Fix children array in json stats being listed in inverse order
gortiz 02ef0b2
Remove getMaxRowsInOperator in BrokerResponse and Pinot UI
gortiz 8bebbfc
Merge remote-tracking branch master into multi-stage-stats
gortiz b8334a9
Add more backward compatibility tests
gortiz fae4984
do not include metadata type in the serialization.
gortiz 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -93,7 +93,6 @@ public abstract class BaseDataBlock implements DataBlock { | |
protected ByteBuffer _fixedSizeData; | ||
protected byte[] _variableSizeDataBytes; | ||
protected ByteBuffer _variableSizeData; | ||
protected Map<String, String> _metadata; | ||
|
||
/** | ||
* construct a base data block. | ||
|
@@ -114,7 +113,6 @@ public BaseDataBlock(int numRows, @Nullable DataSchema dataSchema, String[] stri | |
_fixedSizeData = ByteBuffer.wrap(fixedSizeDataBytes); | ||
_variableSizeDataBytes = variableSizeDataBytes; | ||
_variableSizeData = ByteBuffer.wrap(variableSizeDataBytes); | ||
_metadata = new HashMap<>(); | ||
_errCodeToExceptionMap = new HashMap<>(); | ||
} | ||
|
||
|
@@ -131,7 +129,6 @@ public BaseDataBlock() { | |
_fixedSizeData = null; | ||
_variableSizeDataBytes = null; | ||
_variableSizeData = null; | ||
_metadata = new HashMap<>(); | ||
_errCodeToExceptionMap = new HashMap<>(); | ||
} | ||
|
||
|
@@ -195,10 +192,7 @@ public BaseDataBlock(ByteBuffer byteBuffer) | |
_variableSizeData = ByteBuffer.wrap(_variableSizeDataBytes); | ||
|
||
// Read metadata. | ||
int metadataLength = byteBuffer.getInt(); | ||
if (metadataLength != 0) { | ||
_metadata = deserializeMetadata(byteBuffer); | ||
} | ||
deserializeMetadata(byteBuffer); | ||
} | ||
|
||
@Override | ||
|
@@ -232,7 +226,7 @@ public int getVersion() { | |
|
||
@Override | ||
public Map<String, String> getMetadata() { | ||
return _metadata; | ||
return Collections.emptyMap(); | ||
} | ||
|
||
@Override | ||
|
@@ -432,6 +426,11 @@ public Map<Integer, String> getExceptions() { | |
return _errCodeToExceptionMap; | ||
} | ||
|
||
/** | ||
* Serialize this data block to a byte array. | ||
* <p> | ||
* In order to deserialize it, {@link DataBlockUtils#getDataBlock(ByteBuffer)} should be used. | ||
*/ | ||
@Override | ||
public byte[] toBytes() | ||
throws IOException { | ||
|
@@ -444,9 +443,7 @@ public byte[] toBytes() | |
// Write metadata: length followed by actual metadata bytes. | ||
// NOTE: We ignore metadata serialization time in "responseSerializationCpuTimeNs" as it's negligible while | ||
// considering it will bring a lot code complexity. | ||
byte[] metadataBytes = serializeMetadata(); | ||
dataOutputStream.writeInt(metadataBytes.length); | ||
dataOutputStream.write(metadataBytes); | ||
serializeMetadata(dataOutputStream); | ||
|
||
return byteArrayOutputStream.toByteArray(); | ||
} | ||
|
@@ -525,14 +522,30 @@ private void writeLeadingSections(DataOutputStream dataOutputStream) | |
} | ||
} | ||
|
||
private byte[] serializeMetadata() | ||
/** | ||
* Writes the metadata section to the given data output stream. | ||
*/ | ||
protected void serializeMetadata(DataOutputStream dataOutputStream) | ||
throws IOException { | ||
return new byte[0]; | ||
dataOutputStream.writeInt(0); | ||
} | ||
|
||
private Map<String, String> deserializeMetadata(ByteBuffer buffer) | ||
/** | ||
* Deserializes the metadata section from the given byte buffer. | ||
* <p> | ||
* This is the counterpart of {@link #serializeMetadata(DataOutputStream)} and it is guaranteed that the buffer will | ||
* be positioned at the start of the metadata section when this method is called. | ||
* <p> | ||
* <strong>Important:</strong> It is mandatory for implementations to leave the cursor at the end of the metadata, in | ||
* the exact same position as it was when {@link #serializeMetadata(DataOutputStream)} was called. | ||
* <p> | ||
* <strong>Important:</strong> This method will be called at the end of the BaseDataConstructor constructor to read | ||
* the metadata section. This means that it will be called <strong>before</strong> the subclass have been constructor | ||
* have been called. Therefore it is not possible to use any subclass fields in this method. | ||
*/ | ||
protected void deserializeMetadata(ByteBuffer buffer) | ||
throws IOException { | ||
return Collections.emptyMap(); | ||
buffer.getInt(); | ||
} | ||
|
||
private byte[] serializeExceptions() | ||
|
@@ -572,14 +585,9 @@ private Map<Integer, String> deserializeExceptions(ByteBuffer buffer) | |
@Override | ||
public String toString() { | ||
if (_dataSchema == null) { | ||
return _metadata.toString(); | ||
return "{}"; | ||
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. We don't have the ability to decode what is in metadata now. |
||
} else { | ||
StringBuilder stringBuilder = new StringBuilder(); | ||
stringBuilder.append("resultSchema:").append('\n'); | ||
stringBuilder.append(_dataSchema).append('\n'); | ||
stringBuilder.append("numRows: ").append(_numRows).append('\n'); | ||
stringBuilder.append("metadata: ").append(_metadata.toString()).append('\n'); | ||
return stringBuilder.toString(); | ||
return "resultSchema:" + '\n' + _dataSchema + '\n' + "numRows: " + _numRows + '\n'; | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.