Assuming click stream type of data I want to get the search terms from the first search request, and return the product id that was eventually viewed and the number of clicks to the product. So something like this
select search_terms, productid, clicks_to_product from npath ( on clicks distributed by sessionid sort by timestamp arg1('SEARCH.PRODUCT'), arg2('SEARCH'), arg3(page = 'SEARCH'), arg4('PRODUCT'), arg5([age = 'PRODUCT'), arg6('first_value(search_terms) as search_terms, last_value(productid) as productid, (size(tpath)-1) as clicks_to_product') ); >From what I have seen, I will get the search terms from the first search without the first_value, however it would be nice to be able to use first_value to guarantee that. I cannot get the productid from the last tpath object using this. I did try and get the last_value(tpath.productid) in the outer query, however that returned the productid ( and all nulls leading up to the product viewed page) in the very tpath value for the very last row returned from the inner npath select, eg not the last value for the productid for that row. I can use tpath.productid in place of productid in the outer query and it returns the nulls for each row in the current tpath, upto the final product view. Hope this makes sense. Thanks Justin On Wed, Aug 21, 2013 at 12:42 PM, Harish Butani <hbut...@hortonworks.com>wrote: > Can you provide details on what you want to do. > You maybe able to express this by stacking queries: execute npath in a > SubQuery in the from clause and then do windowing in an outer select. > Also you get the 'path' object back from npath, so you can apply array > indexing on it. > > regards, > Harish. > > On Aug 20, 2013, at 10:43 PM, Justin Workman <justinjwork...@gmail.com> > wrote: > > > When is it expect to support lead/lag/first_value/last_value in the > > npath result statement? > > > > Thanks > > > > > > Sent from my iPhone > > > -- > CONFIDENTIALITY NOTICE > NOTICE: This message is intended for the use of the individual or entity to > which it is addressed and may contain information that is confidential, > privileged and exempt from disclosure under applicable law. If the reader > of this message is not the intended recipient, you are hereby notified that > any printing, copying, dissemination, distribution, disclosure or > forwarding of this communication is strictly prohibited. If you have > received this communication in error, please contact the sender immediately > and delete it from your system. Thank You. >