kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [1/3] kudu git commit: Fix to KUDU-1642 patch
Date Thu, 02 Feb 2017 00:23:30 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 86714152d -> 8993716d7


Fix to KUDU-1642 patch

This is a quick fix to the MakePredicate code. It had an unnecessary
Schema argument that can be dropped by making it non-static.

Change-Id: I5120368476991bdcdbf58df72931bb72d5116ab8
Reviewed-on: http://gerrit.cloudera.org:8080/5856
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/8d9fd9c4
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/8d9fd9c4
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/8d9fd9c4

Branch: refs/heads/master
Commit: 8d9fd9c4b31599667deab0544e6a26742b9aa0aa
Parents: 8671415
Author: Will Berkeley <wdberkeley@gmail.com>
Authored: Wed Feb 1 16:11:29 2017 -0500
Committer: Will Berkeley <wdberkeley@gmail.com>
Committed: Wed Feb 1 21:45:10 2017 +0000

----------------------------------------------------------------------
 src/kudu/client/client.cc        | 12 ++++--------
 src/kudu/client/table-internal.h |  9 ++++-----
 2 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/8d9fd9c4/src/kudu/client/client.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client.cc b/src/kudu/client/client.cc
index d060852..533e0af 100644
--- a/src/kudu/client/client.cc
+++ b/src/kudu/client/client.cc
@@ -717,8 +717,7 @@ KuduPredicate* KuduTable::NewComparisonPredicate(const Slice& col_name,
   auto cleanup = MakeScopedCleanup([&]() {
     delete value;
   });
-  const Schema& schema = *data_->schema_.schema_;
-  return data_->MakePredicate(col_name, schema, [&](const ColumnSchema& col_schema)
{
+  return data_->MakePredicate(col_name, [&](const ColumnSchema& col_schema) {
     // Ownership of value is passed to the valid returned predicate.
     cleanup.cancel();
     return new KuduPredicate(new ComparisonPredicateData(col_schema, op, value));
@@ -731,8 +730,7 @@ KuduPredicate* KuduTable::NewInListPredicate(const Slice& col_name,
   auto cleanup = MakeScopedCleanup([&]() {
     STLDeleteElements(values);
   });
-  const Schema& schema = *data_->schema_.schema_;
-  return data_->MakePredicate(col_name, schema, [&](const ColumnSchema& col_schema)
{
+  return data_->MakePredicate(col_name, [&](const ColumnSchema& col_schema) {
     // Ownership of values is passed to the valid returned predicate.
     cleanup.cancel();
     return new KuduPredicate(new InListPredicateData(col_schema, values));
@@ -740,15 +738,13 @@ KuduPredicate* KuduTable::NewInListPredicate(const Slice& col_name,
 }
 
 KuduPredicate* KuduTable::NewIsNotNullPredicate(const Slice& col_name) {
-  const Schema& schema = *data_->schema_.schema_;
-  return data_->MakePredicate(col_name, schema, [&](const ColumnSchema& col_schema)
{
+  return data_->MakePredicate(col_name, [&](const ColumnSchema& col_schema) {
     return new KuduPredicate(new IsNotNullPredicateData(col_schema));
   });
 }
 
 KuduPredicate* KuduTable::NewIsNullPredicate(const Slice& col_name) {
-  const Schema& schema = *data_->schema_.schema_;
-  return data_->MakePredicate(col_name, schema, [&](const ColumnSchema& col_schema)
{
+  return data_->MakePredicate(col_name, [&](const ColumnSchema& col_schema) {
     return new KuduPredicate(new IsNullPredicateData(col_schema));
   });
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/8d9fd9c4/src/kudu/client/table-internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/table-internal.h b/src/kudu/client/table-internal.h
index 748a220..b9d78df 100644
--- a/src/kudu/client/table-internal.h
+++ b/src/kudu/client/table-internal.h
@@ -38,11 +38,10 @@ class KuduTable::Data {
   ~Data();
 
   template<class PredicateMakerFunc>
-  static KuduPredicate* MakePredicate(const Slice& col_name,
-                                      const Schema& schema,
-                                      const PredicateMakerFunc& f) {
+  KuduPredicate* MakePredicate(const Slice& col_name,
+                               const PredicateMakerFunc& f) {
     StringPiece name_sp(reinterpret_cast<const char*>(col_name.data()), col_name.size());
-    int col_idx = schema.find_column(name_sp);
+    int col_idx = schema_.schema_->find_column(name_sp);
     if (col_idx == Schema::kColumnNotFound) {
       // Since the new predicate functions don't return errors, instead we create a special
       // predicate that just returns the errors when we add it to the scanner.
@@ -51,7 +50,7 @@ class KuduTable::Data {
       return new KuduPredicate(new ErrorPredicateData(
           Status::NotFound("column not found", col_name)));
     }
-    return f(schema.column(col_idx));
+    return f(schema_.schema_->column(col_idx));
   }
 
   sp::shared_ptr<KuduClient> client_;


Mime
View raw message