Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 63E61200BEC for ; Thu, 29 Dec 2016 16:29:19 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 627FF160B2D; Thu, 29 Dec 2016 15:29:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B243A160B15 for ; Thu, 29 Dec 2016 16:29:18 +0100 (CET) Received: (qmail 2649 invoked by uid 500); 29 Dec 2016 15:29:17 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 2637 invoked by uid 99); 29 Dec 2016 15:29:17 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2016 15:29:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9769A180297 for ; Thu, 29 Dec 2016 15:29:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.679 X-Spam-Level: * X-Spam-Status: No, score=1.679 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=googlemail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Uo-W1vIULfMy for ; Thu, 29 Dec 2016 15:29:13 +0000 (UTC) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id BCA5F5F474 for ; Thu, 29 Dec 2016 15:29:12 +0000 (UTC) Received: by mail-it0-f51.google.com with SMTP id 75so57455836ite.1 for ; Thu, 29 Dec 2016 07:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=QVriCxDzkLEL8mVyirF0xk6wG9bc3Umjqj+WxK03mBs=; b=d2F15zCQHzablwXoz0HOVW2zqCiTnWzO7KjYeABwMVKDoBT2yyiUKPP7by6lNx5Cow nDmmBwDFYVNBIWGRUWD+Eg1W0+U2ijDJNvDbHudGJszkHfRPIKmV/gdKYoh9EwJjCuuZ G29/uAuIG3j+kOtvPURlWxCdy5vU8jhS05NwqOW6H8h31zmzaM6TxhkJaCtWOyhcrgLh MwMv+YfhxIceQHbwImXvN96huZA6dnP+drLJMdTY5bpRuUcKGEk6vA+TolwVVHCnpZ/q YWVZXm7nCCNYgaxvrsF78XAqIpVXRPRcbC492/LAC8BEH759nhPo+nBUcUr7S6p+F5O2 YuNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=QVriCxDzkLEL8mVyirF0xk6wG9bc3Umjqj+WxK03mBs=; b=qCss1IHY6cvKvdz6LyPzAsgVYCbItNk1P8RnpeFdpJpgzLm2c9d0RcivGKt0Msfm2g GTSYaO5I+ayln4W/nD/oZnq3jsoz6zeKYxt4ZV/bPix2fzd9wwIPdAAwhMnaSMilRRSi G+i7rHtZ6ZgZTNZ1iGRphGvkeYa590v6QuzRe2tl0MwBQwWsLUEFgNyHu/tEv8YvZNSr 68eeYGbNCgDw9/HPeGiLH9jOo2Lqg48zr54Cf30WImayj7NlbkDCk0EjDMAhXJ74EaWW v7ZJcRV7Zz/IdM0ADzfrHOaN/GWM11rtrkDeT2wiHVfSaZFtrwzf9lKq/oIleL0RTVZl hiwg== X-Gm-Message-State: AIkVDXKtEkeozts0XSsZgfad6d266J2myPzEoNswVPirDuQHm5n0M9s19c90vc7bLwhkWydBWVNnBW92VXaflg== X-Received: by 10.36.104.146 with SMTP id v140mr34090342itb.65.1483025341736; Thu, 29 Dec 2016 07:29:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.53.201 with HTTP; Thu, 29 Dec 2016 07:29:01 -0800 (PST) In-Reply-To: References: From: Nkechi Achara Date: Thu, 29 Dec 2016 16:29:01 +0100 Message-ID: Subject: Re: Reading specific column family and columns in Hbase table through spark To: user@hbase.apache.org Content-Type: multipart/alternative; boundary=001a1143ff7aafef570544cdbea3 archived-at: Thu, 29 Dec 2016 15:29:19 -0000 --001a1143ff7aafef570544cdbea3 Content-Type: text/plain; charset=UTF-8 Hey Mich, Are you setting the column family / qualifier values in the config? e.g. config.set(TableInputFormat.SCAN_COLUMN_FAMILY, "cf") // column family config.set(TableInputFormat.SCAN_COLUMNS, "cf1:cq1 cf1:cq2") // column qualifier As you already have the results when you use newAPIHadoopRDD then you can cast it to a conversion function too, like: val r: Result r.getValue(, ) this will either retrieve the value in Bytes or null if it does not exist. Thanks, K On 29 December 2016 at 13:10, Mich Talebzadeh wrote: > Hi, > > I have a routine in Spark that iterates through Hbase rows and tries to > read columns. > > My question is how can I read the correct ordering of columns? > > example > > val hBaseRDD = sc.newAPIHadoopRDD(conf, classOf[TableInputFormat], > classOf[org.apache.hadoop.hbase.io.ImmutableBytesWritable], > classOf[org.apache.hadoop.hbase.client.Result]) > > val parsed = hBaseRDD.map{ case(b, a) => val iter = a.list().iterator(); > ( Bytes.toString(a.getRow()).toString, > Bytes.toString( iter.next().getValue()).toString, > Bytes.toString( iter.next().getValue()).toString, > Bytes.toString( iter.next().getValue()).toString, > Bytes.toString(iter.next().getValue()) > )} > > The above reads the column family columns sequentially. How can I force it > to read specific columns only? > > > Thanks > > > Dr Mich Talebzadeh > > > > LinkedIn * https://www.linkedin.com/profile/view?id= > AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw > OABUrV8Pw>* > > > > http://talebzadehmich.wordpress.com > > > *Disclaimer:* Use it at your own risk. Any and all responsibility for any > loss, damage or destruction of data or any other property which may arise > from relying on this email's technical content is explicitly disclaimed. > The author will in no case be liable for any monetary damages arising from > such loss, damage or destruction. > --001a1143ff7aafef570544cdbea3--