Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Yulei-Yang committed Dec 25, 2024
1 parent 7b70bea commit b1644a4
Showing 1 changed file with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,23 @@ public int compare(Table t1, Table t2) {
}
});

boolean isAdmin = Env.getCurrentEnv().getAccessManager()
.checkGlobalPriv(ConnectContext.get(), PrivPredicate.ADMIN);
for (Table table : tables) {
if (!Env.getCurrentEnv().getAccessManager()
.checkTblPriv(ConnectContext.get(), InternalCatalog.INTERNAL_CATALOG_NAME, dbName,
table.getName(),
PrivPredicate.SHOW)) {
continue;
}
// admin users can see all temporary tables no matter they are created by which session
if (!isAdmin) {
// non admin user can only see temporary tables in current session
if (table.isTemporary() && Util.getTempTableSessionId(table.getName())
!= ConnectContext.get().getSessionId()) {
continue;
}
}
sortedTables.add(table);
}

Expand All @@ -244,16 +254,20 @@ public int compare(Table t1, Table t2) {
replicaCount = olapTable.getReplicaCount();
remoteSize = olapTable.getRemoteDataSize();

String tableShowName = olapTable.getType() == TableType.TEMP
? Util.getTempTableOuterName(tableName.getTbl()) : tableName.getTbl();
boolean useDisplayName = false;
if (!isAdmin && olapTable.isTemporary()) {
useDisplayName = true;
}
String tableName = useDisplayName
? Util.getTempTableDisplayName(olapTable.getName()) : olapTable.getName();
if (!detailed) {
totalRowsObject.add(Arrays.asList(tableShowName, tableSize, replicaCount, remoteSize));
totalRowsObject.add(Arrays.asList(tableName, tableSize, replicaCount, remoteSize));
} else {
long localIndexSize = olapTable.getLocalIndexFileSize();
long localSegmentSize = olapTable.getLocalSegmentSize();
long remoteIndexSize = olapTable.getRemoteIndexFileSize();
long remoteSegmentSize = olapTable.getRemoteSegmentSize();
totalRowsObject.add(Arrays.asList(tableShowName, tableSize, replicaCount, remoteSize,
totalRowsObject.add(Arrays.asList(tableName, tableSize, replicaCount, remoteSize,
localIndexSize, localSegmentSize, remoteIndexSize, remoteSegmentSize));
totalLocalInvertedSize += localIndexSize;
totalLocalSegmentSize += localSegmentSize;
Expand Down

0 comments on commit b1644a4

Please sign in to comment.