kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [2/5] incubator-kudu git commit: [c++ client] - Allow to get the projection schema from the scanner
Date Thu, 04 Feb 2016 05:33:45 GMT
[c++ client] - Allow to get the projection schema from the scanner

This is the c++ equivalent of KUDU-1269, i.e. it just allows to get
the schema being scanned from the scanner.

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


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

Branch: refs/heads/master
Commit: b6fb4498c012323dfe5b041737a6e06f89550219
Parents: 403f9da
Author: David Alves <david.alves@cloudera.com>
Authored: Wed Feb 3 16:14:20 2016 -0800
Committer: David Ribeiro Alves <david.alves@cloudera.com>
Committed: Thu Feb 4 04:11:48 2016 +0000

----------------------------------------------------------------------
 src/kudu/client/client-test.cc | 3 +++
 src/kudu/client/client.cc      | 4 ++++
 src/kudu/client/client.h       | 3 +++
 3 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/b6fb4498/src/kudu/client/client-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index c02b6a9..15d4266 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -721,6 +721,7 @@ TEST_F(ClientTest, TestScanEmptyProjection) {
                                          FLAGS_test_scan_num_rows));
   KuduScanner scanner(client_table_.get());
   ASSERT_OK(scanner.SetProjectedColumns(vector<string>()));
+  ASSERT_EQ(scanner.GetProjectionSchema().num_columns(), 0);
   LOG_TIMING(INFO, "Scanning with no projected columns") {
     ASSERT_OK(scanner.Open());
 
@@ -755,6 +756,8 @@ TEST_F(ClientTest, TestScanPredicateKeyColNotProjected) {
                                          FLAGS_test_scan_num_rows));
   KuduScanner scanner(client_table_.get());
   ASSERT_OK(scanner.SetProjectedColumns({ "int_val" }));
+  ASSERT_EQ(scanner.GetProjectionSchema().num_columns(), 1);
+  ASSERT_EQ(scanner.GetProjectionSchema().Column(0).type(), KuduColumnSchema::INT32);
   ASSERT_OK(scanner.AddConjunctPredicate(
                 client_table_->NewComparisonPredicate("key", KuduPredicate::GREATER_EQUAL,
                                                       KuduValue::FromInt(5))));

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/b6fb4498/src/kudu/client/client.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client.cc b/src/kudu/client/client.cc
index 2e3b059..f2c8894 100644
--- a/src/kudu/client/client.cc
+++ b/src/kudu/client/client.cc
@@ -1014,6 +1014,10 @@ Status KuduScanner::SetCacheBlocks(bool cache_blocks) {
   return Status::OK();
 }
 
+KuduSchema KuduScanner::GetProjectionSchema() const {
+  return data_->client_projection_;
+}
+
 namespace {
 // Callback for the RPC sent by Close().
 // We can't use the KuduScanner response and RPC controller members for this

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/b6fb4498/src/kudu/client/client.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/client.h b/src/kudu/client/client.h
index d6493d5..4246340 100644
--- a/src/kudu/client/client.h
+++ b/src/kudu/client/client.h
@@ -1025,6 +1025,9 @@ class KUDU_EXPORT KuduScanner {
   // Sets the maximum time that Open() and NextBatch() are allowed to take.
   Status SetTimeoutMillis(int millis);
 
+  // Returns the schema of the projection being scanned.
+  KuduSchema GetProjectionSchema() const;
+
   // Returns a string representation of this scan.
   std::string ToString() const;
  private:


Mime
View raw message