Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I use IntervalMatch function in my script to match discrets values witch buckets (0-10; 11-20...).
That's build a synthetic key all the time. Do you know a way to do the samething without synthetic key (My supervisor isn't agree to have them)?
thanks a lot
Eva
I don't think that the synthetic key is a problem here, but's if that's what would keep you from pass, you could probably join the two tables after the match:
Ranges:
LOAD *, rowno() as RangeID INLINE [
Rangestart, Rangeend
1,10
11, 15,
16, 20
];
Numbers:
LOAD *, rowno() as NumberID INLINE [
Test
3
11
15
3
17
];
inner join Intervalmatch (Test) LOAD Rangestart, Rangeend resident Ranges;
join (Ranges) LOAD * Resident Numbers;
drop table Numbers;
I don't think that the synthetic key is a problem here, but's if that's what would keep you from pass, you could probably join the two tables after the match:
Ranges:
LOAD *, rowno() as RangeID INLINE [
Rangestart, Rangeend
1,10
11, 15,
16, 20
];
Numbers:
LOAD *, rowno() as NumberID INLINE [
Test
3
11
15
3
17
];
inner join Intervalmatch (Test) LOAD Rangestart, Rangeend resident Ranges;
join (Ranges) LOAD * Resident Numbers;
drop table Numbers;
Thanks a
do you know shy the interval match is better than add a column with ranges inside the Numbers table?
with a if(value <0, 'under 0',if(value >=0 and value <=10, '0 - 10',...))
Is it optimization reason?
Well, if it's just to classify some numbers into few well defined buckets, I probably won't use interval match at all (but some if() statements like you said, class() function, mapping table ...)
I think interval match is really powerful if you're buckets / ranges are defined in another table, there are a lot of buckets and you may need to take care of other key fields to select the right bucket (look into the extended version of the interval match for that).
As always, there might not be the optimal solution for all cases, so it all depends on your setting and needs.
thanks a lot!