diff --git a/geomesa-fs/geomesa-fs-storage/geomesa-fs-storage-common/src/main/scala/org/locationtech/geomesa/fs/storage/common/partitions/AttributeScheme.scala b/geomesa-fs/geomesa-fs-storage/geomesa-fs-storage-common/src/main/scala/org/locationtech/geomesa/fs/storage/common/partitions/AttributeScheme.scala index eb83a1c55f5..ee068348713 100644 --- a/geomesa-fs/geomesa-fs-storage/geomesa-fs-storage-common/src/main/scala/org/locationtech/geomesa/fs/storage/common/partitions/AttributeScheme.scala +++ b/geomesa-fs/geomesa-fs-storage/geomesa-fs-storage-common/src/main/scala/org/locationtech/geomesa/fs/storage/common/partitions/AttributeScheme.scala @@ -36,17 +36,15 @@ case class AttributeScheme(attribute: String, index: Int, binding: Class[_], def override def getPartitionName(feature: SimpleFeature): String = { val value = feature.getAttribute(index) - if (value == null) { - defaultPartition - } else if (allowedValues.nonEmpty) { - if (allowedValues.contains(value)) { - AttributeIndexKey.typeEncode(value) - } else { - defaultPartition - } - } else { - AttributeIndexKey.typeEncode(value) + if (value == null) + return defaultPartition + val encodedValue = AttributeIndexKey.typeEncode(value) + if (allowedValues.nonEmpty) { + if (allowedValues.contains(value)) + return encodedValue + return defaultPartition } + encodedValue } override def getSimplifiedFilters(filter: Filter, partition: Option[String]): Option[Seq[SimplifiedFilter]] = { @@ -115,8 +113,8 @@ object AttributeScheme { val binding = sft.getDescriptor(index).getType.getBinding require(AttributeIndexKey.encodable(binding), s"Invalid type binding '${binding.getName}' of attribute '$attribute'") - val allowedValues: Seq[String] = config.options.get(Config.AllowedListOpt).map(_.split(',').toSeq).getOrElse(Seq.empty) - val defaultPartition = config.options.getOrElse(Config.DefaultPartitionOpt, if (allowedValues.nonEmpty) allowedValues.head else "") + val allowedValues: Seq[String] = config.options.get(Config.AllowedListOpt).map(_.split(',').toSeq).getOrElse(Seq.empty).map(AttributeIndexKey.encodeForQuery(_,binding)) + val defaultPartition = config.options.getOrElse(Config.DefaultPartitionOpt, AttributeIndexKey.encodeForQuery(if (allowedValues.nonEmpty) allowedValues.head else "", binding)) Some(AttributeScheme(attribute, index, binding, defaultPartition, allowedValues)) } }