Return-Path: X-Original-To: apmail-impala-dev-archive@minotaur.apache.org Delivered-To: apmail-impala-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6571219426 for ; Fri, 1 Apr 2016 06:42:21 +0000 (UTC) Received: (qmail 66938 invoked by uid 500); 1 Apr 2016 06:42:21 -0000 Delivered-To: apmail-impala-dev-archive@impala.apache.org Received: (qmail 66898 invoked by uid 500); 1 Apr 2016 06:42:21 -0000 Mailing-List: contact dev-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@impala.incubator.apache.org Delivered-To: mailing list dev@impala.incubator.apache.org Received: (qmail 66887 invoked by uid 99); 1 Apr 2016 06:42:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Apr 2016 06:42:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9C833C28B1 for ; Fri, 1 Apr 2016 06:42:20 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.362 X-Spam-Level: X-Spam-Status: No, score=0.362 tagged_above=-999 required=6.31 tests=[RDNS_DYNAMIC=0.363, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id YTRvTp8UhsSd for ; Fri, 1 Apr 2016 06:42:18 +0000 (UTC) Received: from ip-10-146-233-104.ec2.internal (ec2-75-101-130-251.compute-1.amazonaws.com [75.101.130.251]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 1EF3A5F573 for ; Fri, 1 Apr 2016 06:42:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ip-10-146-233-104.ec2.internal (8.14.4/8.14.4) with ESMTP id u316gHpk018605; Fri, 1 Apr 2016 06:42:17 GMT Message-Id: <201604010642.u316gHpk018605@ip-10-146-233-104.ec2.internal> Date: Fri, 1 Apr 2016 06:42:16 +0000 From: "Wes McKinney (Code Review)" To: Thomas Tauber-Marshall , impala-cr@cloudera.com, dev@impala.incubator.apache.org CC: Matthew Jacobs , Marcel Kornacker Reply-To: wes@cloudera.com X-Gerrit-MessageType: comment Subject: =?UTF-8?Q?[hs2client-CR]_Initial_structure_for_the_C++_hiveserver2_client.=0A?= X-Gerrit-Change-Id: I7be82d5897ad6093116915b17924674c4ae508a0 X-Gerrit-ChangeURL: X-Gerrit-Commit: d74651419987e0e2d3b8492e108561bbd9f6c6ae In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.10-rc0 Wes McKinney has posted comments on this change. Change subject: Initial structure for the C++ hiveserver2 client. ...................................................................... Patch Set 4: (28 comments) http://gerrit.cloudera.org:8080/#/c/2645/4/src/hs2client/columnar-row-set.h File src/hs2client/columnar-row-set.h: Line 27: const void* nulls; `const uint8_t*` here Line 30: char c = (*((std::string*)nulls))[i / 8]; if you use `const uint8_t*` above, this is not needed. I don't think it's a good idea to use std::string in this manner anyhow (you may accidentally invoke constructor calls in some cases) http://gerrit.cloudera.org:8080/#/c/2645/4/src/hs2client/hs2client.cc File src/hs2client/hs2client.cc: Line 49: using apache::hive::service::cli::thrift::TStatusCode; You could instead use a namespace alias: namespace hs2 = apache::hive::service::cli::thrift; Line 58: using namespace std; Better to use qualified names Line 103: TFetchOrientation::type FetchOrientationToTFetchOrientation( Methods that are not exported should be static Line 132: unique_ptr* out) { Need an HS2 protocol argument. We will eventually need to support non-columnar protocols (pre-V6). If the user passes < V6 protocol, return error Status Line 180: } It may be worth creating a macro like RETURN_NOT_OK but that captures and translates Thrift errors to hs2client::Status Line 194: TProtocolVersion hs2_protocol_version_; Struct data members do not have trailing underscores (https://google.github.io/styleguide/cppguide.html#Variable_Names). You may make this a class in the interest of readability Line 198: : impl_(new HS2SessionImpl()), rpc_(move(rpc)), open_(false) {} std::move is not necessary with std::shared_ptr Line 208: rpc_->client_->CloseSession(resp, req); Can this fail? Line 218: rpc_->client_->OpenSession(resp, req); Can this fail? Line 220: Status status = TStatusToStatus(resp.status); RETURN_NOT_OK(TStatusToStatus(resp.status)); Line 231: ExecuteStatementOperation(shared_ptr rpc) : Operation(move(rpc)) {} const std::shared_ptr&, and no std::move Line 233: Status Open(TSessionHandle sessionHandle, const string& statement, session_handle Line 241: rpc_->client_->ExecuteStatement(resp, req); failure possible? Line 255: const HS2ClientConfig& confOverlay, shared_ptr* out) { conf_overlay Line 263: GetTablesOperation(shared_ptr rpc) : Operation(move(rpc)) {} const sp<...>& and no std::move also Line 266: const std::string& tableName) { Please use Google C++ naming conventions Line 273: rpc_->client_->GetTables(resp, req); can this fail? Line 306: rpc_->client_->CancelOperation(resp, req); handle exception thrown Line 314: rpc_->client_->CloseOperation(resp, req); may throw exception Line 330: rpc_->client_->FetchResults(resp, req); may throw exception Line 331: Status status = TStatusToStatus(resp.status); RETURN_NOT_OK(...) ? Line 348: impl->column_ = row_set->columns[i]; I believe this performs a copy of the column in the row set, which must be avoided at all costs http://gerrit.cloudera.org:8080/#/c/2645/4/src/hs2client/hs2session.h File src/hs2client/hs2session.h: Line 61: Status GetFunctions(const std::string& schemaName, std::shared_ptr* out); May prefer C++-style variable naming in this methods. Can you add documentation to explain what `schema name` means (i.e. schemas are databases here)? http://gerrit.cloudera.org:8080/#/c/2645/4/src/hs2client/operation.h File src/hs2client/operation.h: Line 46: static const int DEFAULT_MAX_ROWS; Is this intended to be configurable? If yes, state if the user is expected to modify Operation::DEFAULT_MAX_ROWS directly. If no, only declare this in the compilation unit. Line 52: Operation& operator=(Operation const&) = delete; You may want to pull in the gutil DISALLOW_COPY_AND_ASSIGN https://github.com/apache/arrow/blob/master/cpp/src/arrow/util/macros.h#L22 (and put this in private: ) http://gerrit.cloudera.org:8080/#/c/2645/4/src/hs2client/sample-usage.cc File src/hs2client/sample-usage.cc: Line 103: service->Close(); Is there concern about "zombie sessions"? We might be able to apply RAII-style to automatically close sessions in the event of exceptions / errors -- To view, visit http://gerrit.cloudera.org:8080/2645 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7be82d5897ad6093116915b17924674c4ae508a0 Gerrit-PatchSet: 4 Gerrit-Project: hs2client Gerrit-Branch: master Gerrit-Owner: Thomas Tauber-Marshall Gerrit-Reviewer: Marcel Kornacker Gerrit-Reviewer: Matthew Jacobs Gerrit-Reviewer: Thomas Tauber-Marshall Gerrit-Reviewer: Wes McKinney Gerrit-HasComments: Yes