apache/beam · error · IllegalArgumentException
Attempted to get side input window for GlobalWindow from non
Error message
Attempted to get side input window for GlobalWindow from non-global WindowFn
What it means
PartitioningWindowFn assigns windows by partitioning time, so it has no meaningful mapping for GlobalWindow, which has no time domain. When a side input is requested with a main-input GlobalWindow but the side input uses a PartitioningWindowFn, getDefaultWindowMappingFn.getSideInputWindow throws IllegalArgumentException because the mapping is undefined.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/PartitioningWindowFn.java:47
* @param <W> window type
*/
public abstract class PartitioningWindowFn<T, W extends BoundedWindow>
extends NonMergingWindowFn<T, W> {
/** Returns the single window to which elements with this timestamp belong. */
public abstract W assignWindow(Instant timestamp);
@Override
public final Collection<W> assignWindows(AssignContext c) {
return Arrays.asList(assignWindow(c.timestamp()));
}
@Override
public WindowMappingFn<W> getDefaultWindowMappingFn() {
return new WindowMappingFn<W>() {
@Override
public W getSideInputWindow(BoundedWindow mainWindow) {
if (mainWindow instanceof GlobalWindow) {
throw new IllegalArgumentException(
"Attempted to get side input window for GlobalWindow from non-global WindowFn");
}
return assignWindow(mainWindow.maxTimestamp());
}
};
}
@Override
public final boolean assignsToOneWindow() {
return true;
}
}
View on GitHub (pinned to 12126d8942)
Solutions
- Window the main input with the same (compatible) WindowFn as the side input
- Use GlobalWindows for the side input if the main input is in the GlobalWindow
- Explicitly set a trigger/windowing on both sides so window mappings align
- Re-read the side input via a DoFn that materializes it without window mapping
Example fix
// before
PCollectionView<...> view = side.apply(Window.into(new PartitioningWindowFn<>()));
main.apply(ParDo.of(new DoFn<Object,Object>(){
@ProcessElement public void p(ProcessContext c){ c.sideInput(view); } // throws for GlobalWindow
}));
// after
PCollectionView<...> view = side.apply(Window.into(new GlobalWindows())); Defensive patterns
Strategy: validation
Validate before calling
if (mainWindow instanceof GlobalWindow && !(sideWindowFn instanceof GlobalWindows)) {
throw new IllegalArgumentException("GlobalWindow main input cannot map side input from " + sideWindowFn.getClass().getSimpleName());
} Type guard
boolean canMapSideInput(BoundedWindow w, WindowFn<?,?> fn) { return !(w instanceof GlobalWindow) || fn instanceof GlobalWindows; } Prevention
- Keep main input and side input windowing aligned by construction
- Assert windowing compatibility in pipeline-builder helper methods
- Avoid mixing unwindowed and windowed PCollections in one DoFn
- Document side-input windowing requirements on shared view factories
When it happens
Trigger: Calling getSideInputWindow(GlobalWindow.INSTANCE) on a WindowMappingFn returned by PartitioningWindowFn.getDefaultWindowMappingFn — typically when a global-window PCollection reads a side input windowed by a non-global WindowFn.
Common situations: Mixing windowed and unwindowed PCollections: a bounded (global window) main input doing View.asMap side-input lookups against a windowed side input; pipeline graph validation errors during translation.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Unable to create a side-input view from input
- Sessions is not allowed in side inputs
- Attempted to get side input window for GlobalWindow from non
- Distinct does not support merging windowing strategies, exce
- Only materializations of type %s supported, received %s
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/878aa88251a69dc2.
Report an issue: GitHub.