One Star

tIntervalMatch and lexicographical matching

In working with the tIntervalMatch component, it appears that it prefers strings for the Lookup Column(min), Lookup Column (max), and Search Column values. And also that it matches based on lexicographical rules via use of the Java String.compareTo() method.
Is there any way to get it to accept integers for the min, max, and search column values and, thus, use integral-based comparisons? The schema seems to allow you to specify integers, but we are getting compilation errors when specifying integers. We're trying to improve the performance wrt the tIntervalMatch portions of a job and thought that using integers rather than strings should be faster in terms of the interval-based lookups.
Also, from the generated code it looks like a binary search is employed by the tIntervalMatch component, is that correct?
Finally, assuming that integer values cannot be used with the existing tIntervalMatch component, how hard would it be to create a custom version of that component that does allow integer values?
Thanks, SteveR

public String getLookup(testFlowStruct row_Main) {
    int lowerBound = 0;
    int upperBound = array_tIntervalMatch_2.length - 1;
    while (true) {
            int currentIndex = (lowerBound + upperBound) / 2;
            String tmpMain = row_Main.batchId;
            String tmpMin = array_tIntervalMatch_2.startIpNum;
            String tmpMax = array_tIntervalMatch_2.endIpNum;
            if (tmpMain == null) {
                    return null;
            }
            if ((tmpMin == null && tmpMax != null && tmpMain
                            .compareTo(tmpMax) <= 0)
                            || (tmpMin != null
                                            && tmpMax == null && tmpMain
                                            .compareTo(tmpMin) >= 0)
                            || (tmpMin != null
                                            && tmpMax != null
                                            && tmpMain
                                                            .compareTo(tmpMin) >= 0 && tmpMain
                                            .compareTo(tmpMax) <= 0)) {
                    return array_tIntervalMatch_2.rest;
            } else if (lowerBound > upperBound) {
                    return null;
            } else {
                    if (tmpMin != null
                                    && tmpMain.compareTo(tmpMin) < 0) {
                            upperBound = currentIndex - 1;
                    } else if (tmpMin != null
                                    && tmpMain.compareTo(tmpMin) > 0) {
                            lowerBound = currentIndex + 1;
                    } else {
                            upperBound = currentIndex - 1;
                    }
            }
    }
}
1 REPLY
Community Manager

Re: tIntervalMatch and lexicographical matching

Hi
I would suggest you to report this kind of question in our bugtracker and discuss directly with our developers.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business