diff --git a/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java b/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java index f289bcb0..83ecb1e8 100644 --- a/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java +++ b/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java @@ -1640,8 +1640,7 @@ private ObPair getTable(String tableName, Object[] rowKey, TableEntry tableEntry = getOrRefreshTableEntry(tableName, refresh, waitForRefresh, needFetchAll); Row row = new Row(); - if (tableEntry.isPartitionTable() - && tableEntry.getPartitionInfo().getLevel() != ObPartitionLevel.LEVEL_ZERO) { + if (tableEntry.isPartitionTable()) { List curTableRowKeyNames = new ArrayList(); Map tableRowKeyEle = getRowKeyElement(tableName); if (tableRowKeyEle != null) { @@ -2052,8 +2051,7 @@ public List> getTables(String tableName, ObTableQuery Row startRow = new Row(); Row endRow = new Row(); // ensure the format of column names and values if the current table is a table with partition - if (tableEntry.isPartitionTable() - && tableEntry.getPartitionInfo().getLevel() != ObPartitionLevel.LEVEL_ZERO) { + if (tableEntry.isPartitionTable()) { // scanRangeColumn may be longer than start/end in prefix scanning situation if (scanRangeColumns == null || scanRangeColumns.size() < start.length) { throw new IllegalArgumentException( diff --git a/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java b/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java index a78ea8c9..ecddcf9a 100644 --- a/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java +++ b/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java @@ -725,10 +725,10 @@ private static TableEntry getTableEntryFromRemote(Connection connection, TableEn if (null != tableEntry) { tableEntry.setTableEntryKey(key); // TODO: check capacity flag later + // fetch partition info + fetchPartitionInfo(connection, tableEntry); // fetch tablet ids when table is partition table if (tableEntry.isPartitionTable()) { - // fetch partition info - fetchPartitionInfo(connection, tableEntry); if (null != tableEntry.getPartitionInfo()) { // fetch first range part if (null != tableEntry.getPartitionInfo().getFirstPartDesc()) { diff --git a/src/main/java/com/alipay/oceanbase/rpc/location/model/TableEntry.java b/src/main/java/com/alipay/oceanbase/rpc/location/model/TableEntry.java index 260a067c..65df1702 100644 --- a/src/main/java/com/alipay/oceanbase/rpc/location/model/TableEntry.java +++ b/src/main/java/com/alipay/oceanbase/rpc/location/model/TableEntry.java @@ -105,7 +105,9 @@ public Long getReplicaNum() { * Is partition table. */ public boolean isPartitionTable() { - return this.partitionNum > 1; + return partitionNum > 1 || (partitionInfo != null && partitionInfo.getLevel() + .getIndex() > ObPartitionLevel.LEVEL_ZERO.getIndex() && partitionInfo.getLevel() + .getIndex() < ObPartitionLevel.UNKNOWN.getIndex()); } /*