fixes #1874 adding a substring extraction function, tests, and documentation#1986
fixes #1874 adding a substring extraction function, tests, and documentation#1986himanshug merged 1 commit intoapache:masterfrom
Conversation
|
I was looking at the CACHE_TYPE_ID values and saw that TimeFormatExtractionFn.java and LookupExtractionFn.java both define it to 5. |
There was a problem hiding this comment.
Is this check required ? At this point length will be greater than 0 as we will return null if the length is 0 at line 62 Strings.isNullOrEmpty(dimValue)
There was a problem hiding this comment.
sorry I confused length with len - ignore the comment
|
@clintropolis can we fix merge conflicts? I think this is almost ready to go |
|
Yep, will do this evening, along with other suggestions. |
8d7f385 to
aad2714
Compare
Bouncing for travis |
There was a problem hiding this comment.
thought @drcrallen want to have at lease one UT for getCacheKey ?
aad2714 to
d4ccf25
Compare
|
@clintropolis can we finish this off? |
|
|
|
@fjy I think it should be good to go now |
There was a problem hiding this comment.
this should be true when index == 0 to allow optimizations for this particular case.
d4ccf25 to
0067628
Compare
There was a problem hiding this comment.
is length == 0 allowed? then it is expected to be "non-negative" not "positive"
There was a problem hiding this comment.
actually, from the code below it appears that length being 0 is not allowed.
There was a problem hiding this comment.
I probably should not allow a length of 0, since it just returns null across the board. I can change the check.
There was a problem hiding this comment.
@himanshug @clintropolis "positive" means >= 0 "strictly positive" means > 0. If we don't allow 0, it should be say strictly positive to be clear.
There was a problem hiding this comment.
sure, will change message since I don't think having a length of 0 is very useful.
0067628 to
5a11426
Compare
5a11426 to
68ef5f4
Compare
|
👍 @himanshug @drcrallen i think this is ready to go |
|
👍 |
fixes #1874 adding a substring extraction function, tests, and documentation
SQL style substring extraction function, which takes an index and optionally a length, returning a substring of the dimension value starting from the index of size length, or the remainder of the string if it is shorter than length or length is not supplied. If the starting index is greater than the length of the dimension value, null is returned.
{ "type" : "substring", "index" : 3, "length" : 4 }{ "type" : "substring", "index" : 3 }