pathwaycom/pathway · error · ValueError
Universes of all arguments of Table.from_columns() have to b
Error message
Universes of all arguments of Table.from_columns() have to be equal. Consider using Table.promise_universes_are_equal() to assert it. (However, untrue assertion might result in runtime errors.)
What it means
from_columns selects all passed columns from the universe of the first argument's table, so every argument must share the same universe (same set of row ids). The code takes the first column's table and compares universes with each other argument via Universe.is_equal_to; any mismatch raises ValueError with guidance to use Table.promise_universes_are_equal().
Source
Thrown at python/pathway/internals/table.py:306
>>> import pathway as pw
>>> t1 = pw.Table.empty(age=float, pet=float)
>>> t2 = pw.Table.empty(foo=float, bar=float).with_universe_of(t1)
>>> t3 = pw.Table.from_columns(t1.pet, qux=t2.foo)
>>> pw.debug.compute_and_print(t3, include_id=False)
pet | qux
"""
all_args = cast(
dict[str, expr.ColumnReference], combine_args_kwargs(args, kwargs)
)
if not all_args:
raise ValueError("Table.from_columns() cannot have empty arguments list")
else:
arg = next(iter(all_args.values()))
table: Table = arg.table
for arg in all_args.values():
if not table._universe.is_equal_to(arg.table._universe):
raise ValueError(
"Universes of all arguments of Table.from_columns() have to be equal.\n"
+ "Consider using Table.promise_universes_are_equal() to assert it.\n"
+ "(However, untrue assertion might result in runtime errors.)"
)
return table.select(*args, **kwargs)
@trace_user_frame
@check_arg_types
def concat_reindex(self, *tables: Table) -> Table:
"""Concatenate contents of several tables.
This is similar to PySpark union. All tables must have the same schema. Each row is reindexed.
Args:
tables: List of tables to concatenate. All tables must have the same schema.
Returns:
Table: The concatenated table. It will have new, synthetic ids.View on GitHub (pinned to fa2f74a464)
Solutions
- Align universes explicitly with with_universe_of(): t2 = t2.with_universe_of(t1) before combining
- If you can guarantee the ids are truly identical, assert it with pw.Table.promise_universes_are_equal(t1, t2) (runtime errors if the promise is false)
- Re-derive both tables from a common source so universes match by construction
Example fix
# before t = pw.Table.from_columns(t1.a, qux=t2.b) # universes differ -> ValueError # after t2_aligned = t2.with_universe_of(t1) t = pw.Table.from_columns(t1.a, qux=t2_aligned.b)
Defensive patterns
Strategy: validation
Validate before calling
def same_universe(t1, t2) -> bool:
return t1._universe.is_equal_to(t2._universe) Type guard
import pathway as pw
def tables_share_universe(t1: pw.Table, t2: pw.Table) -> bool:
return t1._universe.is_equal_to(t2._universe) Prevention
- Align universes with with_universe_of before combining columns
- Derive combined tables from a single common base table
When it happens
Trigger: pw.Table.from_columns(t1.a, t2.b) where t1 and t2 have different row-id sets — e.g. one was filtered, joined, or reindexed; combining columns from tables produced by different connectors or sources.
Common situations: Assembling wide tables from independently computed intermediate results; after a filter/restrict on one table but not the other; tables from different inputs that merely happen to have the same row count.
Related errors
- You cannot use {dep.to_column_expression()} in this context.
- Join received extra kwargs. You probably want to use TableLi
- synchronization_group can only be set once
- Duplicate expression value given for {name}
- Cannot use expression as boolean.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/e4566bb32d7ce9cb.
Report an issue: GitHub.