You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@predictionio.apache.org by Hasan Can Saral <ha...@gmail.com> on 2016/09/27 11:44:16 UTC

HTTP Post to events.json with eventId key

Hi all,

I have a question regarding the RowKey generation in eventToPut in
HBEventsUtil. If that is the wrong place to ask, please correct me.

I started browsing the source code to see if I can implement updating of
events with HTTP put requests in EventServer.

So basically in HBLEvents, eventsToPut in HBEventsUtil is called an within
eventsToPut, which generates a unique RowKey object if it is None.

But when the event.eventId.map is there, it simply proceeds with
RowKey(id). Then regarding this <http://stackoverflow.com/a/13685752>, the
value should be updated.

Hence, if I include "eventId" key in the JSON I post to events.json, I
understand that the document/value in HBase should be updated.

However, I am receiving a new document/value with a different key than the
one I post, which means I am missing something. I would appreciate if you
could help me with it.

Thanks,
Hasan

-- 

Hasan Can Saral
hasancansaral@gmail.com

Re: HTTP Post to events.json with eventId key

Posted by Hasan Can Saral <ha...@gmail.com>.
Hi Kenneth,

I am testing inserting through HTTP API. I will write a small program to
test it with LEvent to make sure it works. Will post here once I am ready.
Thanks for the input for now :)

Hasan

On Thu, Sep 29, 2016 at 11:54 PM, Kenneth Chan <ke...@apache.org> wrote:

> not sure why.
>
> - are you testing with HTTP API?
> - did you try using LEvent client to insert event to make sure it works
> first before using HTTP?
>
> to debug, you can use the LEvent client to test out insert same event in a
> pio-shell or write a small test program and see what happen:
>
> https://github.com/apache/incubator-predictionio/blob/
> develop/data/src/main/scala/org/apache/predictionio/data/
> storage/hbase/HBLEvents.scala#L99
>
> example tests:
> https://github.com/apache/incubator-predictionio/blob/
> develop/data/src/test/scala/org/apache/predictionio/data/
> storage/LEventsSpec.scala
>
> Kenneth
>
>
> On Thu, Sep 29, 2016 at 1:34 PM, Hasan Can Saral <ha...@gmail.com>
> wrote:
>
> > Yes, I am using the exact time stamp, yet I am creating an event with a
> > brand new eventId. Any thoughts?
> >
> > On Wed, Sep 28, 2016 at 5:15 AM, Kenneth Chan <ke...@apache.org>
> wrote:
> >
> > > when you update event with the same eventId, does the new event have
> the
> > > same eventTime?
> > >
> > > the eventTime is also used as Hbase's cell timestamp (versions)
> > > https://github.com/apache/incubator-predictionio/blob/
> > > develop/data/src/main/scala/org/apache/predictionio/data/
> > > storage/hbase/HBEventsUtil.scala#L164
> > >
> > >
> > > On Tue, Sep 27, 2016 at 4:44 AM, Hasan Can Saral <
> > hasancansaral@gmail.com>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I have a question regarding the RowKey generation in eventToPut in
> > > > HBEventsUtil. If that is the wrong place to ask, please correct me.
> > > >
> > > > I started browsing the source code to see if I can implement updating
> > of
> > > > events with HTTP put requests in EventServer.
> > > >
> > > > So basically in HBLEvents, eventsToPut in HBEventsUtil is called an
> > > within
> > > > eventsToPut, which generates a unique RowKey object if it is None.
> > > >
> > > > But when the event.eventId.map is there, it simply proceeds with
> > > > RowKey(id). Then regarding this <http://stackoverflow.com/a/13685752
> >,
> > > the
> > > > value should be updated.
> > > >
> > > > Hence, if I include "eventId" key in the JSON I post to events.json,
> I
> > > > understand that the document/value in HBase should be updated.
> > > >
> > > > However, I am receiving a new document/value with a different key
> than
> > > the
> > > > one I post, which means I am missing something. I would appreciate if
> > you
> > > > could help me with it.
> > > >
> > > > Thanks,
> > > > Hasan
> > > >
> > > > --
> > > >
> > > > Hasan Can Saral
> > > > hasancansaral@gmail.com
> > > >
> > >
> >
> >
> >
> > --
> >
> > Hasan Can Saral
> > hasancansaral@gmail.com
> >
>



-- 

Hasan Can Saral
hasancansaral@gmail.com

Re: HTTP Post to events.json with eventId key

Posted by Kenneth Chan <ke...@apache.org>.
not sure why.

- are you testing with HTTP API?
- did you try using LEvent client to insert event to make sure it works
first before using HTTP?

to debug, you can use the LEvent client to test out insert same event in a
pio-shell or write a small test program and see what happen:

https://github.com/apache/incubator-predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/hbase/HBLEvents.scala#L99

example tests:
https://github.com/apache/incubator-predictionio/blob/develop/data/src/test/scala/org/apache/predictionio/data/storage/LEventsSpec.scala

Kenneth


On Thu, Sep 29, 2016 at 1:34 PM, Hasan Can Saral <ha...@gmail.com>
wrote:

> Yes, I am using the exact time stamp, yet I am creating an event with a
> brand new eventId. Any thoughts?
>
> On Wed, Sep 28, 2016 at 5:15 AM, Kenneth Chan <ke...@apache.org> wrote:
>
> > when you update event with the same eventId, does the new event have the
> > same eventTime?
> >
> > the eventTime is also used as Hbase's cell timestamp (versions)
> > https://github.com/apache/incubator-predictionio/blob/
> > develop/data/src/main/scala/org/apache/predictionio/data/
> > storage/hbase/HBEventsUtil.scala#L164
> >
> >
> > On Tue, Sep 27, 2016 at 4:44 AM, Hasan Can Saral <
> hasancansaral@gmail.com>
> > wrote:
> >
> > > Hi all,
> > >
> > > I have a question regarding the RowKey generation in eventToPut in
> > > HBEventsUtil. If that is the wrong place to ask, please correct me.
> > >
> > > I started browsing the source code to see if I can implement updating
> of
> > > events with HTTP put requests in EventServer.
> > >
> > > So basically in HBLEvents, eventsToPut in HBEventsUtil is called an
> > within
> > > eventsToPut, which generates a unique RowKey object if it is None.
> > >
> > > But when the event.eventId.map is there, it simply proceeds with
> > > RowKey(id). Then regarding this <http://stackoverflow.com/a/13685752>,
> > the
> > > value should be updated.
> > >
> > > Hence, if I include "eventId" key in the JSON I post to events.json, I
> > > understand that the document/value in HBase should be updated.
> > >
> > > However, I am receiving a new document/value with a different key than
> > the
> > > one I post, which means I am missing something. I would appreciate if
> you
> > > could help me with it.
> > >
> > > Thanks,
> > > Hasan
> > >
> > > --
> > >
> > > Hasan Can Saral
> > > hasancansaral@gmail.com
> > >
> >
>
>
>
> --
>
> Hasan Can Saral
> hasancansaral@gmail.com
>

Re: HTTP Post to events.json with eventId key

Posted by Hasan Can Saral <ha...@gmail.com>.
Yes, I am using the exact time stamp, yet I am creating an event with a
brand new eventId. Any thoughts?

On Wed, Sep 28, 2016 at 5:15 AM, Kenneth Chan <ke...@apache.org> wrote:

> when you update event with the same eventId, does the new event have the
> same eventTime?
>
> the eventTime is also used as Hbase's cell timestamp (versions)
> https://github.com/apache/incubator-predictionio/blob/
> develop/data/src/main/scala/org/apache/predictionio/data/
> storage/hbase/HBEventsUtil.scala#L164
>
>
> On Tue, Sep 27, 2016 at 4:44 AM, Hasan Can Saral <ha...@gmail.com>
> wrote:
>
> > Hi all,
> >
> > I have a question regarding the RowKey generation in eventToPut in
> > HBEventsUtil. If that is the wrong place to ask, please correct me.
> >
> > I started browsing the source code to see if I can implement updating of
> > events with HTTP put requests in EventServer.
> >
> > So basically in HBLEvents, eventsToPut in HBEventsUtil is called an
> within
> > eventsToPut, which generates a unique RowKey object if it is None.
> >
> > But when the event.eventId.map is there, it simply proceeds with
> > RowKey(id). Then regarding this <http://stackoverflow.com/a/13685752>,
> the
> > value should be updated.
> >
> > Hence, if I include "eventId" key in the JSON I post to events.json, I
> > understand that the document/value in HBase should be updated.
> >
> > However, I am receiving a new document/value with a different key than
> the
> > one I post, which means I am missing something. I would appreciate if you
> > could help me with it.
> >
> > Thanks,
> > Hasan
> >
> > --
> >
> > Hasan Can Saral
> > hasancansaral@gmail.com
> >
>



-- 

Hasan Can Saral
hasancansaral@gmail.com

Re: HTTP Post to events.json with eventId key

Posted by Kenneth Chan <ke...@apache.org>.
when you update event with the same eventId, does the new event have the
same eventTime?

the eventTime is also used as Hbase's cell timestamp (versions)
https://github.com/apache/incubator-predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/hbase/HBEventsUtil.scala#L164


On Tue, Sep 27, 2016 at 4:44 AM, Hasan Can Saral <ha...@gmail.com>
wrote:

> Hi all,
>
> I have a question regarding the RowKey generation in eventToPut in
> HBEventsUtil. If that is the wrong place to ask, please correct me.
>
> I started browsing the source code to see if I can implement updating of
> events with HTTP put requests in EventServer.
>
> So basically in HBLEvents, eventsToPut in HBEventsUtil is called an within
> eventsToPut, which generates a unique RowKey object if it is None.
>
> But when the event.eventId.map is there, it simply proceeds with
> RowKey(id). Then regarding this <http://stackoverflow.com/a/13685752>, the
> value should be updated.
>
> Hence, if I include "eventId" key in the JSON I post to events.json, I
> understand that the document/value in HBase should be updated.
>
> However, I am receiving a new document/value with a different key than the
> one I post, which means I am missing something. I would appreciate if you
> could help me with it.
>
> Thanks,
> Hasan
>
> --
>
> Hasan Can Saral
> hasancansaral@gmail.com
>