From 4c9e100eff2fe92085860fe6f253e97429a43983 Mon Sep 17 00:00:00 2001 From: Michael Linsinbigler Date: Thu, 25 Jul 2024 10:05:25 -0400 Subject: [PATCH] GEOMESA-3362 Adds optional flattened arrow output (#55) --- .../org/geomesa/gs/wfs/output/ArrowOutputFormat.scala | 9 +++++++-- pom.xml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/geomesa-gs-wfs/src/main/scala/org/geomesa/gs/wfs/output/ArrowOutputFormat.scala b/geomesa-gs-wfs/src/main/scala/org/geomesa/gs/wfs/output/ArrowOutputFormat.scala index c1301c9..7dfea67 100644 --- a/geomesa-gs-wfs/src/main/scala/org/geomesa/gs/wfs/output/ArrowOutputFormat.scala +++ b/geomesa-gs-wfs/src/main/scala/org/geomesa/gs/wfs/output/ArrowOutputFormat.scala @@ -37,7 +37,7 @@ import scala.collection.JavaConverters._ * Optional flags: * format_options=includeFids:;proxyFids:;dictionaryFields:,; * useCachedDictionaries:;sortField:;sortReverse:; - * batchSize:;doublePass:;formatVersion: + * batchSize:;doublePass:;formatVersion:;flattenStruct:; * * @param geoServer geoserver */ @@ -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 { @@ -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) @@ -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)) + } } } @@ -155,5 +159,6 @@ object ArrowOutputFormat extends LazyLogging { val SortReverse = "SORTREVERSE" val BatchSize = "BATCHSIZE" val ProcessDeltas = "PROCESSDELTAS" + val FlattenStruct = "FLATTENSTRUCT" } } diff --git a/pom.xml b/pom.xml index 5000674..7bbbc3f 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ - 5.0.0 + 5.1.0-SNAPSHOT UTF-8