How do I implement a join with a between in Hive?
I have a Hive table with the numeric version of an IP address. I have
another table with start, end, location where start and end define a range
of numeric IPs associated with a location.
Example
Numeric: 29
start | end | location
----------------------
1 | 11 | 666
12 | 30 | 777
31 | 40 | 888
Output: 29 - 777
I need to use the IP from table 1 to lookup the location from table 2. I'm
new to Hive and have discovered that I can't use BETWEEN or < > in join
statements. I've been trying to figure out some way of making this happen
using Hive SQL and can't figure it out. Is there a way? I'm somewhat
familiar with UDFs as well if one of those is needed. I'm open to the idea
that this isn't possible in Hive and I need to do with Pig or a Java
Map/Reduce job, I just don't know enough about things at this point to
say.
Any help is appreciated. Thanks.
No comments:
Post a Comment