You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@kudu.apache.org by Devender Yadav <de...@impetus.co.in> on 2017/02/15 10:44:25 UTC

Fetch row on the basis of composite primary key from table using Java API

Hi All,


I am using Kudu Java API.



I have a table metrics.

CREATE TABLE metrics (
    host STRING NOT NULL,
    metric STRING NOT NULL,
    time INT64 NOT NULL,
    value DOUBLE NOT NULL,
    PRIMARY KEY (host, metric, time),
);


I need to fetch row on the basis of primary key from metrics table.


Do I need to create 3 comparison? predicates for all the primary key columns  KuduPredicate.newComparisonPredicate?() ?




Regards,
Devender

________________________________






NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.

Re: Fetch row on the basis of composite primary key from table using Java API

Posted by Devender Yadav <de...@impetus.co.in>.
Thanks Todd for the prompt reply !?

________________________________
From: Todd Lipcon <to...@cloudera.com>
Sent: Wednesday, February 15, 2017 11:59 PM
To: user@kudu.apache.org
Subject: Re: Fetch row on the basis of composite primary key from table using Java API

Hi Devender,

Yes, that's right -- create an equality predicate for all three components of the key, and the Kudu client will be smart enough to fetch just that one row from the server that hosts it.

-Todd

On Wed, Feb 15, 2017 at 2:44 AM, Devender Yadav <de...@impetus.co.in>> wrote:

Hi All,


I am using Kudu Java API.



I have a table metrics.

CREATE TABLE metrics (
    host STRING NOT NULL,
    metric STRING NOT NULL,
    time INT64 NOT NULL,
    value DOUBLE NOT NULL,
    PRIMARY KEY (host, metric, time),
);


I need to fetch row on the basis of primary key from metrics table.


Do I need to create 3 comparison? predicates for all the primary key columns  KuduPredicate.newComparisonPredicate?() ?




Regards,
Devender

________________________________






NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.



--
Todd Lipcon
Software Engineer, Cloudera

________________________________






NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.

Re: Fetch row on the basis of composite primary key from table using Java API

Posted by Todd Lipcon <to...@cloudera.com>.
Hi Devender,

Yes, that's right -- create an equality predicate for all three components
of the key, and the Kudu client will be smart enough to fetch just that one
row from the server that hosts it.

-Todd

On Wed, Feb 15, 2017 at 2:44 AM, Devender Yadav <
devender.yadav@impetus.co.in> wrote:

> Hi All,
>
>
> I am using Kudu Java API.
>
>
>
> I have a table metrics.
>
> CREATE TABLE metrics (
>     host STRING NOT NULL,
>     metric STRING NOT NULL,
>     time INT64 NOT NULL,
>     value DOUBLE NOT NULL,
>     PRIMARY KEY (host, metric, time),
> );
>
>
> I need to fetch row on the basis of primary key from metrics table.
>
>
> Do I need to create 3 comparison​ predicates for all the primary key
> columns  KuduPredicate.newComparisonPredicate​() ?
>
>
>
>
> Regards,
> Devender
>
> ------------------------------
>
>
>
>
>
>
> NOTE: This message may contain information that is confidential,
> proprietary, privileged or otherwise protected by law. The message is
> intended solely for the named addressee. If received in error, please
> destroy and notify the sender. Any use of this email is prohibited when
> received in error. Impetus does not represent, warrant and/or guarantee,
> that the integrity of this communication has been maintained nor that the
> communication is free of errors, virus, interception or interference.
>



-- 
Todd Lipcon
Software Engineer, Cloudera