From e1a347ac632f0f2602e41a7761800b80bfcdbe2c Mon Sep 17 00:00:00 2001 From: obdev Date: Mon, 12 Jul 2021 16:47:17 +0800 Subject: [PATCH] fix bug for virtual table in __all_virtaul_proxy_partition_info --- .../ob_all_virtual_proxy_partition_info.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/observer/virtual_table/ob_all_virtual_proxy_partition_info.cpp b/src/observer/virtual_table/ob_all_virtual_proxy_partition_info.cpp index 60280806b1..cc952ec466 100644 --- a/src/observer/virtual_table/ob_all_virtual_proxy_partition_info.cpp +++ b/src/observer/virtual_table/ob_all_virtual_proxy_partition_info.cpp @@ -337,12 +337,14 @@ int ObAllVirtualProxyPartitionInfo::fill_cells(const ObTableSchema& table_schema break; case SPARE2: { int64_t idx = -1; - const ObRowkeyInfo& info = table_schema.get_rowkey_info(); + const ObRowkeyInfo &info = table_schema.get_rowkey_info(); if (OB_FAIL(info.get_index(column_id, idx))) { - // The generated column of the primary key table can also be used as the partition key, - // not necessarily in the rowkey info - if (OB_LIKELY(OB_ENTRY_NOT_EXIST == ret && !table_schema.is_no_pk_table() && - column_schema->is_generated_column())) { + // In the following scenarios, the partition key does not need to be included in the primary key + // 1、The generated column of the primary key table can also be used as the partition key + // 2、virtual table + if (OB_LIKELY(OB_ENTRY_NOT_EXIST == ret && + ((!table_schema.is_no_pk_table() && column_schema->is_generated_column()) + || table_schema.is_vir_table()))) { idx = info.get_size() + next_part_key_idx_; ret = OB_SUCCESS; } else { -- GitLab