I have two buckets that needs to be joined. For one of them document keys look like part1/part2/part3 and the second bucket records have field matching to the part3. How can I run joins using part of the document key?
select * from bucket2
join bucket1 on keys bucket1.part3
How should I modify my query to succeed ? Is it possible to do so?
The problem is that I don’t know how to put a expression. Because prefix can have any value following ‘/’ separated pattern. maybe there is a way to put a regex instead of
JOIN bucket1 ON KEYS “MTPC/2016-11-18/” || bucket2.transaction-id
?
As I understand I can use LIKE operator expression to make a join with key? I just don’t know how to put that like into the right place to make it work.
The following doesn’t work
on KEYS like ‘%’ || (TO_STRING(av.mediabuy-id))
I also want to try to use STRING functions like POSITION and SUBSTR to get the part of the string that I want. But I don’t know how to apply it to the document key not the field.
Where keys are marked as bold. We are interested only in document1’s keys. document2.transaction-id field matches part of the key of the first document. Though I understand that I can apply an expression but in the JOIN statement we use document2.transaction_id and I don’t know how to apply expression on document1’s key itself.