geomesa / geomesa-geoserver

A GeoMesa community project for GeoServer-GeoMesa modules.
GNU General Public License v2.0
20 stars 17 forks source link

Empty dictionaryFields results in ArrayIndexOutOfBoundsException: -1 when used w/ Arrow converter #29

Closed crenshaw-dev closed 4 years ago

crenshaw-dev commented 4 years ago

If an empty string is passed as "dictionary fields," ComplexArrowManualVisitor.results will throw a relatively unhelpful ArrayIndexOutOfBoundsException. It seems to be caused by this line:

val dictionaries = hints.get(ARROW_DICTIONARY_FIELDS).map(_.asInstanceOf[String].split(",").toSeq).getOrElse(Seq.empty)

(To my surprise) "".split(",") == Array(""). So when ComplexArrowManualVisitor.results gets the SimpleFeatureType index of attribute "", it gets -1. And then when it uses that index to get the attribute, getAttribute throws an ArrayIndexOutOfBoundsException.

It seems reasonable that, in this context, an empty string passed for "dictionary fields" should be interpreted as an empty array.

elahrvivaz commented 4 years ago

I created a ticket in JIRA to track the issue: https://geomesa.atlassian.net/browse/GEOMESA-2779