Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Query versions in phoenix?

Query versions in phoenix?

Super Guru

I have table which has versions enabled.

CREATE TABLE IF NOT EXISTS customer ( firstName CHAR(15), lastName CHAR(15), address char(100), ssn integer NOT NULL, effective_date DATE NOT NULL CONSTRAINT pk PRIMARY KEY (ssn, effective_date ROW_TIMESTAMP) ) VERSIONS=10000000;

I upserted the record 4 times. How do I query all the versions?

For example I use

select * from customer where EFFECTIVE_DATE < CURRENT_DATE();

I am expecting all the versions for that row. Please advise.


Re: Query versions in phoenix?

Phoenix does not (yet) expose multiple row versions. You'd have to use the HBase API directly to get access to other row versions.

Re: Query versions in phoenix?

You can check relevant discussion on PHOENIX-590 for your requirements.

Currently, Phoenix doesn't support getting all the versions at the same time, but it allows you to do point-in-time queries to see a version at that time. check below link

Re: Query versions in phoenix?

New Contributor

We get startKey, stopKey , PK from phoenix(very important) , then exe a hbase scan (scan.setMaxVersions()) to get all versions data

Don't have an account?
Coming from Hortonworks? Activate your account here