You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/05/28 04:54:38 UTC
[kudu] 01/02: KUDU-2802: C++ tableExists API optimizations
This is an automated email from the ASF dual-hosted git repository.
adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 68cddfdd4e83aabe7b6d7dd76368dbf7997d2444
Author: oclarms <oc...@gmail.com>
AuthorDate: Mon May 27 13:41:02 2019 +0800
KUDU-2802: C++ tableExists API optimizations
Change-Id: Ie3a7c325adf464d0932d84001de6753079f64ee6
Reviewed-on: http://gerrit.cloudera.org:8080/13443
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Adar Dembo <ad...@cloudera.com>
---
src/kudu/client/client.cc | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/kudu/client/client.cc b/src/kudu/client/client.cc
index 6d8239a..5078acb 100644
--- a/src/kudu/client/client.cc
+++ b/src/kudu/client/client.cc
@@ -491,16 +491,14 @@ Status KuduClient::ListTables(vector<string>* tables,
}
Status KuduClient::TableExists(const string& table_name, bool* exists) {
- vector<string> tables;
- RETURN_NOT_OK(ListTables(&tables, table_name));
- for (const string& table : tables) {
- if (table == table_name) {
- *exists = true;
- return Status::OK();
- }
- }
- *exists = false;
- return Status::OK();
+ auto s = GetTableSchema(table_name, nullptr);
+ if (s.ok()) {
+ *exists = true;
+ } else if (s.IsNotFound()) {
+ *exists = false;
+ s = Status::OK();
+ }
+ return s;
}
Status KuduClient::OpenTable(const string& table_name,