-
Notifications
You must be signed in to change notification settings - Fork 369
[AMORO-3914] Support get statistics from Paimon #3915
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
Open
xuzifu666
wants to merge
5
commits into
apache:master
Choose a base branch
from
xuzifu666:statics_add
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2680cbc
[Improvement]: Support get statistics from Paimon
xuzifu666 128207d
style changed
xuzifu666 6b20ae4
Merge branch 'master' into statics_add
xuzifu666 1d8ac4b
Merge branch 'master' into statics_add
huyuanfeng2018 46e5d55
Merge branch 'master' into statics_add
huyuanfeng2018 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
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
72 changes: 72 additions & 0 deletions
72
amoro-common/src/main/java/org/apache/amoro/table/descriptor/StatisticsBaseInfo.java
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 |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.amoro.table.descriptor; | ||
|
|
||
| public class StatisticsBaseInfo { | ||
|
|
||
| private Long snapshotId; | ||
|
|
||
| private Long schemaId; | ||
|
|
||
| private Long mergedRecordCount; | ||
|
|
||
| private Long mergedRecordSize; | ||
|
|
||
| public StatisticsBaseInfo() {} | ||
|
|
||
| public StatisticsBaseInfo( | ||
| Long snapshotId, Long schemaId, Long mergedRecordCount, Long mergedRecordSize) { | ||
| this.snapshotId = snapshotId; | ||
| this.schemaId = schemaId; | ||
| this.mergedRecordCount = mergedRecordCount; | ||
| this.mergedRecordSize = mergedRecordSize; | ||
| } | ||
|
|
||
| public long getSnapshotId() { | ||
| return snapshotId; | ||
| } | ||
|
|
||
| public void setSnapshotId(Long snapshotId) { | ||
| this.snapshotId = snapshotId; | ||
| } | ||
|
|
||
| public long getSchemaId() { | ||
| return schemaId; | ||
| } | ||
|
|
||
| public void setSchemaId(Long schemaId) { | ||
| this.schemaId = schemaId; | ||
| } | ||
|
|
||
| public Long getMergedRecordCount() { | ||
| return mergedRecordCount; | ||
| } | ||
|
|
||
| public void setMergedRecordCount(Long mergedRecordCount) { | ||
| this.mergedRecordCount = mergedRecordCount; | ||
| } | ||
|
|
||
| public Long getMergedRecordSize() { | ||
| return mergedRecordSize; | ||
| } | ||
|
|
||
| public void setMergedRecordSize(Long mergedRecordSize) { | ||
| this.mergedRecordSize = mergedRecordSize; | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| import org.apache.amoro.AmoroTable; | ||
| import org.apache.amoro.TableFormat; | ||
| import org.apache.amoro.api.CommitMetaProducer; | ||
| import org.apache.amoro.formats.paimon.info.PaimonStatisticInfo; | ||
| import org.apache.amoro.process.ProcessStatus; | ||
| import org.apache.amoro.shade.guava32.com.google.common.collect.Lists; | ||
| import org.apache.amoro.shade.guava32.com.google.common.collect.Maps; | ||
|
|
@@ -42,6 +43,7 @@ | |
| import org.apache.amoro.table.descriptor.PartitionBaseInfo; | ||
| import org.apache.amoro.table.descriptor.PartitionFileBaseInfo; | ||
| import org.apache.amoro.table.descriptor.ServerTableMeta; | ||
| import org.apache.amoro.table.descriptor.StatisticsBaseInfo; | ||
| import org.apache.amoro.table.descriptor.TableSummary; | ||
| import org.apache.amoro.table.descriptor.TagOrBranchInfo; | ||
| import org.apache.amoro.utils.CommonUtil; | ||
|
|
@@ -58,6 +60,7 @@ | |
| import org.apache.paimon.manifest.ManifestFile; | ||
| import org.apache.paimon.manifest.ManifestFileMeta; | ||
| import org.apache.paimon.manifest.ManifestList; | ||
| import org.apache.paimon.stats.Statistics; | ||
| import org.apache.paimon.table.DataTable; | ||
| import org.apache.paimon.table.FileStoreTable; | ||
| import org.apache.paimon.utils.BranchManager; | ||
|
|
@@ -579,6 +582,21 @@ public List<ConsumerInfo> getTableConsumerInfos(AmoroTable<?> amoroTable) { | |
| return consumerInfos; | ||
| } | ||
|
|
||
| @Override | ||
| public StatisticsBaseInfo getTableStatistics(AmoroTable<?> amoroTable) { | ||
| FileStoreTable table = getTable(amoroTable); | ||
| if (!table.statistics().isPresent()) { | ||
| return new PaimonStatisticInfo(); | ||
| } | ||
| Statistics statistics = table.statistics().get(); | ||
| return new PaimonStatisticInfo( | ||
| statistics.snapshotId(), | ||
| statistics.schemaId(), | ||
| statistics.mergedRecordCount().getAsLong(), | ||
| statistics.mergedRecordSize().getAsLong(), | ||
| Collections.emptyMap()); | ||
|
Contributor
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. What's about colStats info ? |
||
| } | ||
|
|
||
| private AmoroSnapshotsOfTable manifestListInfo( | ||
| FileStore<?> store, | ||
| Snapshot snapshot, | ||
|
|
||
40 changes: 40 additions & 0 deletions
40
...format-paimon/src/main/java/org/apache/amoro/formats/paimon/info/PaimonStatisticInfo.java
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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.amoro.formats.paimon.info; | ||
|
|
||
| import org.apache.amoro.table.descriptor.StatisticsBaseInfo; | ||
| import org.apache.paimon.stats.ColStats; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| public class PaimonStatisticInfo extends StatisticsBaseInfo { | ||
| private Map<String, ColStats<?>> colStas; | ||
|
|
||
| public PaimonStatisticInfo() {} | ||
|
|
||
| public PaimonStatisticInfo( | ||
| Long snapshotId, | ||
| Long schemaId, | ||
| Long mergedRecordCount, | ||
| Long mergedRecordSize, | ||
| Map<String, ColStats<?>> colStas) { | ||
| super(snapshotId, schemaId, mergedRecordCount, mergedRecordSize); | ||
| this.colStas = colStas; | ||
| } | ||
| } |
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.
The default implementation we can make in the interface is:
throw new UnsupportedOperationException