MCPcopy Index your code
hub / github.com/pathwaycom/pathway / __add__

Method __add__

python/pathway/internals/table.py:431–472  ·  view source on GitHub ↗

Build a union of `self` with `other`. Semantics: Returns a table C, such that - C.columns == self.columns + other.columns - C.id == self.id == other.id Args: other: The other table. `self.id` must be equal `other.id` and `self.columns

(self, other: Table)

Source from the content-addressed store, hash-verified

429
430 @trace_user_frame
431 def __add__(self, other: Table) -> Table:
432 """Build a union of `self` with `other`.
433
434 Semantics: Returns a table C, such that
435 - C.columns == self.columns + other.columns
436 - C.id == self.id == other.id
437
438 Args:
439 other: The other table. `self.id` must be equal `other.id` and
440 `self.columns` and `other.columns` must be disjoint (or overlapping names
441 are THE SAME COLUMN)
442
443 Returns:
444 Table: Created table.
445
446
447 Example:
448
449 >>> import pathway as pw
450 >>> t1 = pw.debug.table_from_markdown('''
451 ... pet
452 ... 1 Dog
453 ... 7 Cat
454 ... ''')
455 >>> t2 = pw.debug.table_from_markdown('''
456 ... age
457 ... 1 10
458 ... 7 3
459 ... ''')
460 >>> t3 = t1 + t2
461 >>> pw.debug.compute_and_print(t3, include_id=False)
462 pet | age
463 Cat | 3
464 Dog | 10
465 """
466 if not self._universe.is_equal_to(other._universe):
467 raise ValueError(
468 "Universes of all arguments of Table.__add__() have to be equal.\n"
469 + "Consider using Table.promise_universes_are_equal() to assert it.\n"
470 + "(However, untrue assertion might result in runtime errors.)"
471 )
472 return self.select(*self, *other)
473
474 @property
475 def slice(self) -> TableSlice:

Callers

nothing calls this directly

Calls 2

selectMethod · 0.95
is_equal_toMethod · 0.80

Tested by

no test coverage detected