Jibing-Li commented on code in PR #21207:
URL: https://github.com/apache/doris/pull/21207#discussion_r1246007116
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalTable.java:
##########
@@ -433,5 +467,83 @@ private void initPartitionColumns(List<Column> schema) {
LOG.debug("get {} partition columns for table: {}",
partitionColumns.size(), name);
}
+ private long getHiveRowCount() {
+ Map<String, String> parameters = remoteTable.getParameters();
+ if (parameters == null) {
+ return -1;
+ }
+ if (parameters.containsKey(NUM_ROWS)) {
+ return Long.parseLong(parameters.get(NUM_ROWS));
+ }
+ if (!parameters.containsKey(TOTAL_SIZE)) {
+ return -1;
+ }
+ long totalSize = Long.parseLong(parameters.get(TOTAL_SIZE));
+ long estimatedRowSize = 0;
+ for (Column column : getFullSchema()) {
+ estimatedRowSize += column.getDataType().getSlotSize();
+ }
+ if (estimatedRowSize == 0) {
+ return 1;
+ }
+ return totalSize / estimatedRowSize;
+ }
+
+ private long getIcebergRowCount() {
+ long rowCount = 0;
+ try {
+ Table icebergTable =
HiveMetaStoreClientHelper.getIcebergTable(this);
+ TableScan tableScan = icebergTable.newScan().includeColumnStats();
+ for (FileScanTask task : tableScan.planFiles()) {
+ rowCount += task.file().recordCount();
+ }
+ return rowCount;
+ } catch (Exception e) {
+ LOG.warn(String.format("Fail to collect row count for db %s table
%s", dbName, name), e);
+ }
+ return -1;
+ }
+
+ private long getRowCountFromFileList() {
Review Comment:
Using cache to avoid call this function every time, only call it once for
the first time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]