I think there are 2 things to do for this feature
1. extending the phoenix sql grammar
it's simple as I don't need know the detail of implementation of
phoenix. I will only modify the antlr file
2. do the real job
I need know the detail of this statement.
On Tue, Feb 11, 2014 at 10:23 AM, James Taylor <[email protected]> wrote:
> Might not be too bad. I'll comment on the JIRA for this one
> (https://issues.apache.org/jira/browse/PHOENIX-6) and you can take a look to
> see if you're interested in contributing it.
>
> Thanks,
> James
>
>
> On Mon, Feb 10, 2014 at 6:07 PM, Li Li <[email protected]> wrote:
>>
>> I'll try it. btw, when will "upsert into on duplicate key ignore"
>> statement supported? is it very complicated to implement or just only
>> a few modification of codes?
>> if it need very few change, could you tell me how to hack it or give
>> me a patch? I need this feature. Thank you.
>>
>> On Tue, Feb 11, 2014 at 9:45 AM, James Taylor <[email protected]>
>> wrote:
>> > I believe you're running into this issue:
>> > https://issues.apache.org/jira/browse/PHOENIX-20
>> >
>> > Would you mind trying on our release candidate build announced here [1]?
>> >
>> > Thanks,
>> > James
>> >
>> > [1]
>> >
>> > http://mail-archives.apache.org/mod_mbox/incubator-phoenix-dev/201402.mbox/%3CCAEF26GcOmg2VvkqbppUuJgi_gjjSvg5yYU0Az7nrWcrPNwx7OA%40mail.gmail.com%3E
>> >
>> >
>> > On Mon, Feb 10, 2014 at 5:23 PM, Li Li <[email protected]> wrote:
>> >>
>> >> here is the full printstack in log
>> >> 663 14-02-10 17:59:12,602 ERROR ActiveMQ Session Task-2
>> >> com.founder.extractor.ExtractWorker end index (1) must not be less
>> >> than start index (7)
>> >> 664 com.salesforce.phoenix.exception.PhoenixIOException: end index
>> >> (1) must not be less than start index (7)
>> >> 665 at
>> >>
>> >>
>> >> com.salesforce.phoenix.util.ServerUtil.parseServerException(ServerUtil.java:107)
>> >> 666 at
>> >>
>> >>
>> >> com.salesforce.phoenix.iterate.ParallelIterators.getIterators(ParallelIterators.java:217)
>> >> 667 at
>> >>
>> >>
>> >> com.salesforce.phoenix.iterate.MergeSortResultIterator.getIterators(MergeSortResultIterator.java:58)
>> >> 668 at
>> >>
>> >>
>> >> com.salesforce.phoenix.iterate.MergeSortResultIterator.minIterator(MergeSortResultIterator.java:73)
>> >> 669 at
>> >>
>> >>
>> >> com.salesforce.phoenix.iterate.MergeSortResultIterator.next(MergeSortResultIterator.java:100)
>> >> 670 at
>> >>
>> >>
>> >> com.salesforce.phoenix.jdbc.PhoenixResultSet.next(PhoenixResultSet.java:741)
>> >> 671 at com.founder.dbtool.DbTools.getHtml(DbTools.java:616)
>> >> 672 at
>> >> com.founder.extractor.ExtractWorker.doWork(ExtractWorker.java:153)
>> >> 673 at
>> >> com.founder.extractor.ExtractWorker.onMessage(ExtractWorker.java:246)
>> >> 674 at
>> >>
>> >>
>> >> org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1361)
>> >> 675 at
>> >>
>> >>
>> >> org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
>> >> 676 at
>> >>
>> >>
>> >> org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
>> >> 677 at
>> >>
>> >>
>> >> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
>> >> 678 at
>> >>
>> >>
>> >> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
>> >> 679 at
>> >>
>> >>
>> >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>> >> 680 at
>> >>
>> >>
>> >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>> >> 681 at java.lang.Thread.run(Thread.java:722)
>> >> 682 Caused by: java.lang.IndexOutOfBoundsException: end index (1)
>> >> must not be less than start index (7)
>> >> 683 at
>> >>
>> >>
>> >> com.google.common.base.Preconditions.checkPositionIndexes(Preconditions.java:388)
>> >> 684 at
>> >> com.google.common.collect.ImmutableList.subList(ImmutableList.java:362)
>> >> 685 at
>> >> com.google.common.collect.ImmutableList.subList(ImmutableList.java:62)
>> >> 686 at
>> >>
>> >>
>> >> com.salesforce.phoenix.filter.SkipScanFilter.intersect(SkipScanFilter.java:225)
>> >> 687 at
>> >>
>> >>
>> >> com.salesforce.phoenix.filter.SkipScanFilter.intersect(SkipScanFilter.java:153)
>> >> 688 at
>> >>
>> >> com.salesforce.phoenix.util.ScanUtil.intersectScanRange(ScanUtil.java:140)
>> >> 689 at
>> >>
>> >>
>> >> com.salesforce.phoenix.iterate.ParallelIterators.getIterators(ParallelIterators.java:172)
>> >> 690 ... 15 more
>> >>
>> >> On Tue, Feb 11, 2014 at 9:08 AM, Li Li <[email protected]> wrote:
>> >> > 1. DDL
>> >> > CREATE TABLE vc.webpage (
>> >> > host VARCHAR NOT NULL,
>> >> > url VARCHAR NOT NULL,
>> >> > url_type TINYINT,
>> >> > c.html VARCHAR,
>> >> > content VARCHAR,
>> >> > title VARCHAR,
>> >> > ext_title VARCHAR,
>> >> > author VARCHAR,
>> >> > pub_time DATE,
>> >> > crawl_time DATE,
>> >> > ext_time DATE
>> >> > CONSTRAINT pk PRIMARY KEY(host, url)
>> >> > )
>> >> > VERSION=1,
>> >> > c.VERSION=1,
>> >> > SALT_BUCKETS=8
>> >> > ;
>> >> > 2. Phoenix 2.2.2
>> >> > 3. HBase 0.94.11, r1513697
>> >> > 4. test case, I can't find because I haven't log the value of url. I
>> >> > think it's a concurrent problem because there are many threads read
>> >> > and write this table(each thread has its own PhoenixConnection)
>> >> >
>> >> > On Tue, Feb 11, 2014 at 12:44 AM, James Taylor
>> >> > <[email protected]>
>> >> > wrote:
>> >> >> Please include your DDL statement and Phoenix and HBase client and
>> >> >> server
>> >> >> version. Even better, if you can put together at end-to-end test
>> >> >> case,
>> >> >> that's the best way to get to the bottom of the issue quickly.
>> >> >> Thanks!
>> >> >> James
>> >> >>
>> >> >> Thanks,
>> >> >>
>> >> >>
>> >> >> On Monday, February 10, 2014, Li Li <[email protected]> wrote:
>> >> >>>
>> >> >>> what's wrong with it?
>> >> >>> exception stack:
>> >> >>> com.salesforce.phoenix.exception.PhoenixIOException: end index (1)
>> >> >>> must not be less than start index (7)
>> >> >>> at
>> >> >>>
>> >> >>>
>> >> >>> com.salesforce.phoenix.util.ServerUtil.parseServerException(ServerUtil.java:107)
>> >> >>> at
>> >> >>>
>> >> >>>
>> >> >>> com.salesforce.phoenix.iterate.ParallelIterators.getIterators(ParallelIterators.java:217)
>> >> >>> at
>> >> >>>
>> >> >>>
>> >> >>> com.salesforce.phoenix.iterate.MergeSortResultIterator.getIterators(MergeSortResultIterator.java:58)
>> >> >>> at
>> >> >>>
>> >> >>>
>> >> >>> com.salesforce.phoenix.iterate.MergeSortResultIterator.minIterator(MergeSortResultIterator.java:73)
>> >> >>> at
>> >> >>>
>> >> >>>
>> >> >>> com.salesforce.phoenix.iterate.MergeSortResultIterator.next(MergeSortResultIterator.java:100)
>> >> >>> at
>> >> >>>
>> >> >>>
>> >> >>> com.salesforce.phoenix.jdbc.PhoenixResultSet.next(PhoenixResultSet.java:741)
>> >> >>>
>> >> >>> my code:
>> >> >>> public static String getHtml(PhoenixConnection conn,String url)
>> >> >>> throws
>> >> >>> SQLException, MalformedURLException{
>> >> >>> PreparedStatement pstmt=null;
>> >> >>> ResultSet rs=null;
>> >> >>> try{
>> >> >>> String host=getReversedHostFromUrl(url);
>> >> >>> pstmt=conn.prepareStatement("SELECT html FROM vc.webpage where
>> >> >>> host=?
>> >> >>> and url=?");
>> >> >>> pstmt.setString(1, host);
>> >> >>> pstmt.setString(2, url);
>> >> >>> rs=pstmt.executeQuery();
>> >> >>> if(rs.next()) return rs.getString(1);
>> >> >>> else return null;
>> >> >>> }finally{
>> >> >>> DbTools.closeAll(null, pstmt, rs);
>> >> >>> }
>> >> >>> }
>> >
>> >
>
>