Skip to content

Commit

Permalink
GEOMESA-3362 Adds optional flattened arrow output (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
malinsinbigler authored Jul 25, 2024
1 parent 05895d7 commit 4c9e100
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import scala.collection.JavaConverters._
* Optional flags:
* format_options=includeFids:<Boolean>;proxyFids:<Boolean>;dictionaryFields:<field_to_encode>,<field_to_encode>;
* useCachedDictionaries:<Boolean>;sortField:<sort_field>;sortReverse:<Boolean>;
* batchSize:<Integer>;doublePass:<Boolean>;formatVersion:<String>
* batchSize:<Integer>;doublePass:<Boolean>;formatVersion:<String>;flattenStruct:<Boolean>;
*
* @param geoServer geoserver
*/
Expand Down Expand Up @@ -86,6 +86,7 @@ class ArrowOutputFormat(geoServer: GeoServer)
val sortField = hints.getArrowSort.map(_._1)
val sortReverse = hints.getArrowSort.map(_._2)
val batchSize = hints.getArrowBatchSize.getOrElse(ArrowProperties.BatchSize.get.toInt)
val flattenStruct = hints.isArrowFlatten

val preSorted = for (field <- sortField; reverse <- sortReverse.orElse(Some(false))) yield {
request.getQueries.get(i).getSortBy match {
Expand All @@ -99,7 +100,7 @@ class ArrowOutputFormat(geoServer: GeoServer)

val visitor =
new ArrowVisitor(fc.getSchema.asInstanceOf[SimpleFeatureType], encoding, version,
dictionaries, sortField, sortReverse, preSorted.getOrElse(false), batchSize)
dictionaries, sortField, sortReverse, preSorted.getOrElse(false), batchSize, flattenStruct)

iter.foreach(visitor.visit)

Expand Down Expand Up @@ -137,6 +138,9 @@ class ArrowOutputFormat(geoServer: GeoServer)
Option(options.get(Fields.ProcessDeltas)).foreach { option =>
hints.put(ARROW_PROCESS_DELTAS, java.lang.Boolean.valueOf(option.toString))
}
Option(options.get(Fields.FlattenStruct)).foreach { option =>
hints.put(ARROW_FLATTEN_STRUCT, java.lang.Boolean.valueOf(option.toString))
}
}
}

Expand All @@ -155,5 +159,6 @@ object ArrowOutputFormat extends LazyLogging {
val SortReverse = "SORTREVERSE"
val BatchSize = "BATCHSIZE"
val ProcessDeltas = "PROCESSDELTAS"
val FlattenStruct = "FLATTENSTRUCT"
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</modules>

<properties>
<geomesa.version>5.0.0</geomesa.version>
<geomesa.version>5.1.0-SNAPSHOT</geomesa.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Expand Down

0 comments on commit 4c9e100

Please sign in to comment.