mirror of https://github.com/apache/druid.git
Merge pull request #943 from mrijke/partialdimextractfn-nullpointer
Fix NullPointerException in PartialDimExtractionFn
This commit is contained in:
commit
be507b8cb4
|
@ -58,6 +58,7 @@ public class PartialDimExtractionFn implements DimExtractionFn
|
||||||
@Override
|
@Override
|
||||||
public String apply(String dimValue)
|
public String apply(String dimValue)
|
||||||
{
|
{
|
||||||
|
dimValue = (dimValue == null) ? "" : dimValue;
|
||||||
Matcher matcher = pattern.matcher(dimValue);
|
Matcher matcher = pattern.matcher(dimValue);
|
||||||
return matcher.find() ? dimValue : null;
|
return matcher.find() ? dimValue : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class PartialDimExtractionFnTest
|
||||||
"Vancouver",
|
"Vancouver",
|
||||||
"Pretoria",
|
"Pretoria",
|
||||||
"Wellington",
|
"Wellington",
|
||||||
|
null,
|
||||||
"Ontario"
|
"Ontario"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue