Class MapMergeFunctionIterator
java.lang.Object
org.rumbledb.runtime.plan.RuntimePlan<Item>
org.rumbledb.runtime.plan.ItemRuntimePlan
org.rumbledb.runtime.AbstractAtMostOneItemRuntimePlan
org.rumbledb.runtime.functions.maps.MapMergeFunctionIterator
- All Implemented Interfaces:
Serializable,AtMostOneLocalRuntimePlan<Item>,LocalRuntimePlan<Item>
W3C XPath/XQuery
map:merge:
Implements the FO 3.1 conceptual semantics:
let $duplicates-handler := map {
"use-first": function($a, $b) {$a},
"use-last": function($a, $b) {$b},
"combine": function($a, $b) {$a, $b},
"reject": function($a, $b) {fn:error($FOJS0003)},
"use-any": function($a, $b) { ... implementation-dependent ... }
},
$combine-maps := function($A as map(*), $B as map(*), $deduplicator as function(*)) {
fn:fold-left(map:keys($B), $A, function($z, $k){
if (map:contains($z, $k))
then map:put($z, $k, $deduplicator($z($k), $B($k)))
else map:put($z, $k, $B($k))
})
}
return fn:fold-left($MAPS, map{},
$combine-maps(?, ?, $duplicates-handler(($OPTIONS?duplicates, "use-first")[1])))
This implementation stays local-only and mirrors that behaviour using the existing MapItem
representation and MapAtomicSameKey key equality via MapItem.getSequenceByKey().
- See Also:
-
Field Summary
Fields inherited from class org.rumbledb.runtime.plan.RuntimePlan
staticContext -
Constructor Summary
ConstructorsConstructorDescriptionMapMergeFunctionIterator(List<ItemRuntimePlan> arguments, RuntimeStaticContext staticContext) -
Method Summary
Modifier and TypeMethodDescriptionevaluateAtMostOne(DynamicContext context) Evaluates the plan without allocating a cursor.Methods inherited from class org.rumbledb.runtime.AbstractAtMostOneItemRuntimePlan
createNativeCursorMethods inherited from class org.rumbledb.runtime.plan.ItemRuntimePlan
getChild, getChildren, getStaticType, getVariableDependencies, isSparkJobNeeded, printMethods inherited from class org.rumbledb.runtime.plan.RuntimePlan
getConfiguration, getCursor, getDataFrame, getMetadata, getRDD, getRuntimeStaticContext, materialize, materializeAtMost, materializeAtMostOne, materializeExactlyOne, materializeFirstOrNull
-
Constructor Details
-
MapMergeFunctionIterator
public MapMergeFunctionIterator(List<ItemRuntimePlan> arguments, RuntimeStaticContext staticContext)
-
-
Method Details
-
evaluateAtMostOne
Description copied from interface:AtMostOneLocalRuntimePlanEvaluates the plan without allocating a cursor.- Specified by:
evaluateAtMostOnein interfaceAtMostOneLocalRuntimePlan<Item>- Specified by:
evaluateAtMostOnein classAbstractAtMostOneItemRuntimePlan- Parameters:
context- the dynamic context for the evaluation- Returns:
- the value, or
nullfor the empty sequence
-