phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sumit Nigam <sumit_o...@yahoo.com>
Subject Re: Help with LIMIT clause
Date Thu, 10 Dec 2015 16:58:59 GMT
In thinking a bit more about it, this should be a bug in Phoenix. This is because even with
LIMIT clause I have a order by timestamp DESC, which means that column values MUST have been
sorted prior to applying LIMIT clause. The LIMIT should then give a MAX value in such a case.
Also, surprisingly this only seems to be failing in cases where there are huge number of records.
Like, in my case I have 200K + records.
Any help will be appreciated.
Thanks,Sumit
      From: Sumit Nigam <sumit_only@yahoo.com>
 To: Users Mail List Phoenix <user@phoenix.apache.org> 
 Sent: Thursday, December 10, 2015 8:05 PM
 Subject: Help with LIMIT clause
   
Hi,
The link for salted tables https://phoenix.apache.org/salted.html mentions "Since salting
table would not store the data sequentially, a strict sequential scan would not return all
the data in the natural sorted fashion. Clauses that currently would force a sequential scan,
for example, clauses with LIMIT, would likely to return items that are different from a normal
table"
So, would a simple query such as SELECT CURRENT_TIMESTAMP FROM TBL ORDER BY CURRENT_TIMESTAMP DESC
LIMIT 1; not really return the MAX(CURRENT_TIMESTAMP) ?
PK is on 2 columns with CURRENT_TIMESTAMP as the leading one. I am noticing this issue:
select current_timestamp from TBL order by current_timestamp desc limit 1;+------------------------------------------+|
           CURRENT_TIMESTAMP             |+------------------------------------------+|
1448815328556                            |+------------------------------------------+

select max(current_timestamp) from TBL;+------------------------------------------+|    
    MAX("CURRENT_TIMESTAMP")         |+------------------------------------------+|
1449732792090                            |+------------------------------------------+
The results are different. MAX is of course, returning the right record.
If this is the case, then what should be done where LIMIT is really to be used? What can I
replace it with to get the desired behavior?
Is this also correct that when there is a WHERE clause limiting the number of projected records,
then LIMIT seems to work fine? I seem to be noticing that also.
This is with hbase 0.98.14 and phoenix 4.5.x
Thanks,Sumit

 
Mime
View raw message