Skip to content

Cell

A single value in a table.

You only need to interact with this class in callbacks passed to higher-order functions. Most operations are grouped into namespaces, which are accessed through the following attributes:

  • dt: Operations on datetime/date/time values
  • dur: Operations on durations
  • math: Mathematical operations on numbers
  • str: Operations on strings

This class only has methods that are not specific to a data type (e.g. cast), methods with corresponding operators (e.g. add for +), and static methods to create new cells.

Type parameters:

Name Upper Bound Description Default
T Any? - Any?
Stub code in Cell.sdsstub

 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
class Cell<out T = Any?> {
    /**
     * Namespace for operations on datetime/date/time values.
     */
    attr dt: DatetimeOperations
    /**
     * Namespace for operations on durations.
     */
    attr dur: DurationOperations
    /**
     * Namespace for mathematical operations.
     */
    attr math: MathOperations
    /**
     * Namespace for operations on strings.
     */
    attr str: StringOperations

    /**
     * Create a cell with a constant value.
     *
     * @param value The value to create the cell from.
     * @param type The type of the cell. If null, the type is inferred from the value.
     *
     * @result cell The created cell.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> Cell.constant(3));
     * }
     */
    @Pure
    static fun constant(
        value: AnyLiteral?,
        type: ColumnType? = null
    ) -> cell: Cell<Any>

    /**
     * Create a cell with a date.
     *
     * Invalid dates are converted to missing values (`null`).
     *
     * @param year The year.
     * @param month The month. Must be between 1 and 12.
     * @param day The day. Must be between 1 and 31.
     *
     * @result cell The created cell.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> Cell.date(2025, 1, 15));
     *     out column.transform((cell) -> Cell.date(2025, cell, 15));
     * }
     */
    @Pure
    static fun date(
        year: ConvertibleToIntCell,
        month: ConvertibleToIntCell,
        day: ConvertibleToIntCell
    ) -> cell: Cell<Date?>

    /**
     * Create a cell with a datetime.
     *
     * Invalid datetimes are converted to missing values (`null`).
     *
     * @param year The year.
     * @param month The month. Must be between 1 and 12.
     * @param day The day. Must be between 1 and 31.
     * @param hour The hour. Must be between 0 and 23.
     * @param minute The minute. Must be between 0 and 59.
     * @param second The second. Must be between 0 and 59.
     * @param microsecond The microsecond. Must be between 0 and 999,999.
     * @param timeZone The time zone. If null, values are assumed to be in local time. This is different from setting the time zone
     * to `"UTC"`. Any TZ identifier defined in the
     * [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) is valid.
     *
     * @result cell The created cell.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> Cell.datetime(2025, 1, 15, hour = 12));
     *     out column.transform((cell) -> Cell.datetime(2025, 1, 15, hour = cell));
     * }
     */
    @Pure
    static fun datetime(
        year: ConvertibleToIntCell,
        month: ConvertibleToIntCell,
        day: ConvertibleToIntCell,
        hour: ConvertibleToIntCell = 0,
        minute: ConvertibleToIntCell = 0,
        second: ConvertibleToIntCell = 0,
        microsecond: ConvertibleToIntCell = 0,
        @PythonName("time_zone") timeZone: String? = null
    ) -> cell: Cell<Datetime?>

    /**
     * Create a cell with a duration.
     *
     * Invalid durations are converted to missing values (`null`).
     *
     * @param weeks The number of weeks.
     * @param days The number of days.
     * @param hours The number of hours.
     * @param minutes The number of minutes.
     * @param seconds The number of seconds.
     * @param milliseconds The number of milliseconds.
     * @param microseconds The number of microseconds.
     *
     * @result cell The created cell.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> Cell.duration(hours = 1));
     *     out column.transform((cell) -> Cell.duration(hours = cell));
     * }
     */
    @Pure
    static fun duration(
        weeks: ConvertibleToIntCell = 0,
        days: ConvertibleToIntCell = 0,
        hours: ConvertibleToIntCell = 0,
        minutes: ConvertibleToIntCell = 0,
        seconds: ConvertibleToIntCell = 0,
        milliseconds: ConvertibleToIntCell = 0,
        microseconds: ConvertibleToIntCell = 0
    ) -> cell: Cell<Duration?>

    /**
     * Create a cell with a time.
     *
     * Invalid times are converted to missing values (`null`).
     *
     * @param hour The hour. Must be between 0 and 23.
     * @param minute The minute. Must be between 0 and 59.
     * @param second The second. Must be between 0 and 59.
     * @param microsecond The microsecond. Must be between 0 and 999,999.
     *
     * @result cell The created cell.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> Cell.time(12, 0, 0));
     *     out column.transform((cell) -> Cell.time(12, cell, 0, microsecond = 1));
     * }
     */
    @Pure
    static fun time(
        hour: ConvertibleToIntCell,
        minute: ConvertibleToIntCell,
        second: ConvertibleToIntCell,
        microsecond: ConvertibleToIntCell = 0
    ) -> cell: Cell<Time?>

    /**
     * Return the first cell that is not null or null if all cells are null.
     *
     * @param cells The list of cells to be checked.
     *
     * @result cell The first cell that is not null or null if all cells are null.
     */
    @Pure
    @PythonName("first_not_none")
    static fun firstNotNull<P>(
        cells: List<Cell<P>>
    ) -> cell: Cell<P?>

    /**
     * Negate a Boolean. This is equivalent to the `not` operator.
     *
     * @result cell The result of the Boolean negation.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [true, false, null]);
     *     out column.transform((cell) -> cell.^not());
     *     out column.transform((cell) -> not cell);
     * }
     */
    @Pure
    @PythonName("not_")
    fun ^not() -> cell: Cell<Boolean?>

    /**
     * Perform a Boolean AND operation. This is equivalent to the `and` operator.
     *
     * @param other The right operand.
     *
     * @result cell The result of the conjunction.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [true, false, null]);
     *     out column.transform((cell) -> cell.^and(true));
     *     out column.transform((cell) -> cell and true);
     * }
     */
    @Pure
    @PythonName("and_")
    fun ^and(
        other: ConvertibleToBooleanCell
    ) -> cell: Cell<Boolean?>

    /**
     * Perform a Boolean OR operation. This is equivalent to the `or` operator.
     *
     * @param other The right operand.
     *
     * @result cell The result of the disjunction.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [true, false, null]);
     *     out column.transform((cell) -> cell.^or(false));
     *     out column.transform((cell) -> cell or false);
     * }
     */
    @Pure
    @PythonName("or_")
    fun ^or(
        other: ConvertibleToBooleanCell
    ) -> cell: Cell<Boolean?>

    /**
     * Perform a Boolean XOR operation.
     *
     * @param other The right operand.
     *
     * @result cell The result of the exclusive or.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [true, false, null]);
     *     out column.transform((cell) -> cell.xor(true));
     * }
     */
    @Pure
    fun xor(
        other: ConvertibleToBooleanCell
    ) -> cell: Cell<Boolean?>

    /**
     * Negate the value. This is equivalent to the unary `-` operator.
     *
     * @result cell The negated value.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, -2, null]);
     *     out column.transform((cell) -> cell.neg());
     *     out column.transform((cell) -> -cell);
     * }
     */
    @Pure
    fun neg() -> cell: Cell<Any>

    /**
     * Add a value. This is equivalent to the `+` operator.
     *
     * @param other The right operand.
     *
     * @result cell The result of the addition.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.add(3));
     *     out column.transform((cell) -> cell + 3);
     * }
     */
    @Pure
    fun add(
        other: ConvertibleToCell
    ) -> cell: Cell<Any>

    /**
     * Divide by a value. This is equivalent to the `/` operator.
     *
     * @param other The right operand.
     *
     * @result cell The result of the division.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [6, 8, null]);
     *     out column.transform((cell) -> cell.div(2));
     *     out column.transform((cell) -> cell / 2);
     * }
     */
    @Pure
    fun div(
        other: ConvertibleToCell
    ) -> cell: Cell<Any>

    /**
     * Perform a modulo operation. This is equivalent to the `%` operator.
     *
     * @param other The right operand.
     *
     * @result cell The result of the modulo operation.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [5, 6, -1, null]);
     *     out column.transform((cell) -> cell.mod(3));
     *     out column.transform((cell) -> cell % 3);
     * }
     */
    @Pure
    fun mod(
        other: ConvertibleToCell
    ) -> cell: Cell<Any>

    /**
     * Multiply by a value. This is equivalent to the `*` operator.
     *
     * @param other The right operand.
     *
     * @result cell The result of the multiplication.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [2, 3, null]);
     *     out column.transform((cell) -> cell.mul(4));
     *     out column.transform((cell) -> cell * 4);
     * }
     */
    @Pure
    fun mul(
        other: ConvertibleToCell
    ) -> cell: Cell<Any>

    /**
     * Raise to a power.
     *
     * @param other The right operand.
     *
     * @result cell The result of the exponentiation.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [2, 3, null]);
     *     out column.transform((cell) -> cell.pow(3));
     * }
     */
    @Pure
    fun pow(
        other: ConvertibleToCell
    ) -> cell: Cell<Any>

    /**
     * Subtract a value. This is equivalent to the binary `-` operator.
     *
     * @param other The right operand.
     *
     * @result cell The result of the subtraction.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [5, 6, null]);
     *     out column.transform((cell) -> cell.^sub(3));
     *     out column.transform((cell) -> cell - 3);
     * }
     */
    @Pure
    fun ^sub(
        other: ConvertibleToCell
    ) -> cell: Cell<Any>

    /**
     * Check if equal to a value. The default behavior is equivalent to the `==` operator.
     *
     * Missing values (indicated by `null`) are handled as follows:
     *
     * - If `propagateMissingValues` is `true` (default), the result will be a missing value if either the cell or
     *   the other value is a missing value. Here, `null == null` is `null`. The intuition is that we do not know the
     *   result of the comparison if we do not know the values, which is consistent with the other cell operations.
     * - If `propagateMissingValues` is `false`, `null` will be treated as a regular value. Here, `null == null`
     *   is `true`. This behavior is useful, if you want to work with missing values, e.g. to filter them out.
     *
     * @param other The value to compare to.
     * @param propagateMissingValues Whether to propagate missing values.
     *
     * @result cell The result of the comparison.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.eq(2));
     *     out column.transform((cell) -> cell == 2);
     *     out column.transform((cell) -> cell.eq(2, propagateMissingValues = false));
     * }
     */
    @Pure
    fun eq(
        other: ConvertibleToCell,
        @PythonName("propagate_missing_values") propagateMissingValues: Boolean = true
    ) -> cell: Cell<Boolean?>

    /**
     * Check if not equal to a value. The default behavior is equivalent to the `!=` operator.
     *
     * Missing values (indicated by `null`) are handled as follows:
     *
     * - If `propagateMissingValues` is `true` (default), the result will be a missing value if either the cell or
     *   the other value is a missing value. Here, `null != null` is `null`. The intuition is that we do not know the
     *   result of the comparison if we do not know the values, which is consistent with the other cell operations.
     * - If `propagateMissingValues` is `false`, `null` will be treated as a regular value. Here, `null != null`
     *   is `false`. This behavior is useful, if you want to work with missing values, e.g. to filter them out.
     *
     * @param other The value to compare to.
     * @param propagateMissingValues Whether to propagate missing values.
     *
     * @result cell The result of the comparison.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.neq(2));
     *     out column.transform((cell) -> cell != 2);
     *     out column.transform((cell) -> cell.neq(2, propagateMissingValues = false));
     * }
     */
    @Pure
    fun neq(
        other: ConvertibleToCell,
        @PythonName("propagate_missing_values") propagateMissingValues: Boolean = true
    ) -> cell: Cell<Boolean?>

    /**
     * Check if greater than or equal to a value. This is equivalent to the `>=` operator.
     *
     * @param other The value to compare to.
     *
     * @result cell The result of the comparison.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.ge(2));
     *     out column.transform((cell) -> cell >= 2);
     * }
     */
    @Pure
    fun ge(
        other: ConvertibleToCell
    ) -> cell: Cell<Boolean?>

    /**
     * Check if greater than a value. This is equivalent to the `>` operator.
     *
     * @param other The value to compare to.
     *
     * @result cell The result of the comparison.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.gt(2));
     *     out column.transform((cell) -> cell > 2);
     * }
     */
    @Pure
    fun gt(
        other: ConvertibleToCell
    ) -> cell: Cell<Boolean?>

    /**
     * Check if less than or equal to a value. This is equivalent to the `<=` operator.
     *
     * @param other The value to compare to.
     *
     * @result cell The result of the comparison.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.le(2));
     *     out column.transform((cell) -> cell <= 2);
     * }
     */
    @Pure
    fun le(
        other: ConvertibleToCell
    ) -> cell: Cell<Boolean?>

    /**
     * Check if less than a value. This is equivalent to the `<` operator.
     *
     * @param other The value to compare to.
     *
     * @result cell The result of the comparison.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.lt(2));
     *     out column.transform((cell) -> cell < 2);
     * }
     */
    @Pure
    fun lt(
        other: ConvertibleToCell
    ) -> cell: Cell<Boolean?>

    /**
     * Cast the cell to a different type.
     *
     * @param type The type to cast to.
     *
     * @result cell The cast cell.
     *
     * @example
     * pipeline example {
     *     val column = Column("a", [1, 2, null]);
     *     out column.transform((cell) -> cell.cast(ColumnType.string()));
     * }
     */
    @Pure
    fun cast(
        type: ColumnType
    ) -> cell: Cell<Any>
}

dt

Namespace for operations on datetime/date/time values.

Type: DatetimeOperations

dur

Namespace for operations on durations.

Type: DurationOperations

math

Namespace for mathematical operations.

Type: MathOperations

str

Namespace for operations on strings.

Type: StringOperations

add

Add a value. This is equivalent to the + operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Any> The result of the addition.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.add(3));
    out column.transform((cell) -> cell + 3);
}
Stub code in Cell.sdsstub

@Pure
fun add(
    other: ConvertibleToCell
) -> cell: Cell<Any>

and

Perform a Boolean AND operation. This is equivalent to the and operator.

Parameters:

Name Type Description Default
other union<Boolean, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Boolean?> The result of the conjunction.

Examples:

pipeline example {
    val column = Column("a", [true, false, null]);
    out column.transform((cell) -> cell.^and(true));
    out column.transform((cell) -> cell and true);
}
Stub code in Cell.sdsstub

@Pure
@PythonName("and_")
fun ^and(
    other: ConvertibleToBooleanCell
) -> cell: Cell<Boolean?>

cast

Cast the cell to a different type.

Parameters:

Name Type Description Default
type ColumnType The type to cast to. -

Results:

Name Type Description
cell Cell<Any> The cast cell.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.cast(ColumnType.string()));
}
Stub code in Cell.sdsstub

@Pure
fun cast(
    type: ColumnType
) -> cell: Cell<Any>

div

Divide by a value. This is equivalent to the / operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Any> The result of the division.

Examples:

pipeline example {
    val column = Column("a", [6, 8, null]);
    out column.transform((cell) -> cell.div(2));
    out column.transform((cell) -> cell / 2);
}
Stub code in Cell.sdsstub

@Pure
fun div(
    other: ConvertibleToCell
) -> cell: Cell<Any>

eq

Check if equal to a value. The default behavior is equivalent to the == operator.

Missing values (indicated by null) are handled as follows:

  • If propagateMissingValues is true (default), the result will be a missing value if either the cell or the other value is a missing value. Here, null == null is null. The intuition is that we do not know the result of the comparison if we do not know the values, which is consistent with the other cell operations.
  • If propagateMissingValues is false, null will be treated as a regular value. Here, null == null is true. This behavior is useful, if you want to work with missing values, e.g. to filter them out.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The value to compare to. -
propagateMissingValues Boolean Whether to propagate missing values. true

Results:

Name Type Description
cell Cell<Boolean?> The result of the comparison.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.eq(2));
    out column.transform((cell) -> cell == 2);
    out column.transform((cell) -> cell.eq(2, propagateMissingValues = false));
}
Stub code in Cell.sdsstub

@Pure
fun eq(
    other: ConvertibleToCell,
    @PythonName("propagate_missing_values") propagateMissingValues: Boolean = true
) -> cell: Cell<Boolean?>

ge

Check if greater than or equal to a value. This is equivalent to the >= operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The value to compare to. -

Results:

Name Type Description
cell Cell<Boolean?> The result of the comparison.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.ge(2));
    out column.transform((cell) -> cell >= 2);
}
Stub code in Cell.sdsstub

@Pure
fun ge(
    other: ConvertibleToCell
) -> cell: Cell<Boolean?>

gt

Check if greater than a value. This is equivalent to the > operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The value to compare to. -

Results:

Name Type Description
cell Cell<Boolean?> The result of the comparison.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.gt(2));
    out column.transform((cell) -> cell > 2);
}
Stub code in Cell.sdsstub

@Pure
fun gt(
    other: ConvertibleToCell
) -> cell: Cell<Boolean?>

le

Check if less than or equal to a value. This is equivalent to the <= operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The value to compare to. -

Results:

Name Type Description
cell Cell<Boolean?> The result of the comparison.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.le(2));
    out column.transform((cell) -> cell <= 2);
}
Stub code in Cell.sdsstub

@Pure
fun le(
    other: ConvertibleToCell
) -> cell: Cell<Boolean?>

lt

Check if less than a value. This is equivalent to the < operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The value to compare to. -

Results:

Name Type Description
cell Cell<Boolean?> The result of the comparison.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.lt(2));
    out column.transform((cell) -> cell < 2);
}
Stub code in Cell.sdsstub

@Pure
fun lt(
    other: ConvertibleToCell
) -> cell: Cell<Boolean?>

mod

Perform a modulo operation. This is equivalent to the % operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Any> The result of the modulo operation.

Examples:

pipeline example {
    val column = Column("a", [5, 6, -1, null]);
    out column.transform((cell) -> cell.mod(3));
    out column.transform((cell) -> cell % 3);
}
Stub code in Cell.sdsstub

@Pure
fun mod(
    other: ConvertibleToCell
) -> cell: Cell<Any>

mul

Multiply by a value. This is equivalent to the * operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Any> The result of the multiplication.

Examples:

pipeline example {
    val column = Column("a", [2, 3, null]);
    out column.transform((cell) -> cell.mul(4));
    out column.transform((cell) -> cell * 4);
}
Stub code in Cell.sdsstub

@Pure
fun mul(
    other: ConvertibleToCell
) -> cell: Cell<Any>

neg

Negate the value. This is equivalent to the unary - operator.

Results:

Name Type Description
cell Cell<Any> The negated value.

Examples:

pipeline example {
    val column = Column("a", [1, -2, null]);
    out column.transform((cell) -> cell.neg());
    out column.transform((cell) -> -cell);
}
Stub code in Cell.sdsstub

@Pure
fun neg() -> cell: Cell<Any>

neq

Check if not equal to a value. The default behavior is equivalent to the != operator.

Missing values (indicated by null) are handled as follows:

  • If propagateMissingValues is true (default), the result will be a missing value if either the cell or the other value is a missing value. Here, null != null is null. The intuition is that we do not know the result of the comparison if we do not know the values, which is consistent with the other cell operations.
  • If propagateMissingValues is false, null will be treated as a regular value. Here, null != null is false. This behavior is useful, if you want to work with missing values, e.g. to filter them out.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The value to compare to. -
propagateMissingValues Boolean Whether to propagate missing values. true

Results:

Name Type Description
cell Cell<Boolean?> The result of the comparison.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> cell.neq(2));
    out column.transform((cell) -> cell != 2);
    out column.transform((cell) -> cell.neq(2, propagateMissingValues = false));
}
Stub code in Cell.sdsstub

@Pure
fun neq(
    other: ConvertibleToCell,
    @PythonName("propagate_missing_values") propagateMissingValues: Boolean = true
) -> cell: Cell<Boolean?>

not

Negate a Boolean. This is equivalent to the not operator.

Results:

Name Type Description
cell Cell<Boolean?> The result of the Boolean negation.

Examples:

pipeline example {
    val column = Column("a", [true, false, null]);
    out column.transform((cell) -> cell.^not());
    out column.transform((cell) -> not cell);
}
Stub code in Cell.sdsstub

@Pure
@PythonName("not_")
fun ^not() -> cell: Cell<Boolean?>

or

Perform a Boolean OR operation. This is equivalent to the or operator.

Parameters:

Name Type Description Default
other union<Boolean, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Boolean?> The result of the disjunction.

Examples:

pipeline example {
    val column = Column("a", [true, false, null]);
    out column.transform((cell) -> cell.^or(false));
    out column.transform((cell) -> cell or false);
}
Stub code in Cell.sdsstub

@Pure
@PythonName("or_")
fun ^or(
    other: ConvertibleToBooleanCell
) -> cell: Cell<Boolean?>

pow

Raise to a power.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Any> The result of the exponentiation.

Examples:

pipeline example {
    val column = Column("a", [2, 3, null]);
    out column.transform((cell) -> cell.pow(3));
}
Stub code in Cell.sdsstub

@Pure
fun pow(
    other: ConvertibleToCell
) -> cell: Cell<Any>

sub

Subtract a value. This is equivalent to the binary - operator.

Parameters:

Name Type Description Default
other union<Float, Date, Datetime, Duration, Time, Boolean, String, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Any> The result of the subtraction.

Examples:

pipeline example {
    val column = Column("a", [5, 6, null]);
    out column.transform((cell) -> cell.^sub(3));
    out column.transform((cell) -> cell - 3);
}
Stub code in Cell.sdsstub

@Pure
fun ^sub(
    other: ConvertibleToCell
) -> cell: Cell<Any>

xor

Perform a Boolean XOR operation.

Parameters:

Name Type Description Default
other union<Boolean, Cell<Any?>?> The right operand. -

Results:

Name Type Description
cell Cell<Boolean?> The result of the exclusive or.

Examples:

pipeline example {
    val column = Column("a", [true, false, null]);
    out column.transform((cell) -> cell.xor(true));
}
Stub code in Cell.sdsstub

@Pure
fun xor(
    other: ConvertibleToBooleanCell
) -> cell: Cell<Boolean?>

constant

Create a cell with a constant value.

Parameters:

Name Type Description Default
value union<Float?, Date?, Datetime?, Duration?, Time?, Boolean?, String?> The value to create the cell from. -
type ColumnType? The type of the cell. If null, the type is inferred from the value. null

Results:

Name Type Description
cell Cell<Any> The created cell.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> Cell.constant(3));
}
Stub code in Cell.sdsstub

@Pure
static fun constant(
    value: AnyLiteral?,
    type: ColumnType? = null
) -> cell: Cell<Any>

date

Create a cell with a date.

Invalid dates are converted to missing values (null).

Parameters:

Name Type Description Default
year union<Int, Cell<Any?>?> The year. -
month union<Int, Cell<Any?>?> The month. Must be between 1 and 12. -
day union<Int, Cell<Any?>?> The day. Must be between 1 and 31. -

Results:

Name Type Description
cell Cell<Date?> The created cell.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> Cell.date(2025, 1, 15));
    out column.transform((cell) -> Cell.date(2025, cell, 15));
}
Stub code in Cell.sdsstub

@Pure
static fun date(
    year: ConvertibleToIntCell,
    month: ConvertibleToIntCell,
    day: ConvertibleToIntCell
) -> cell: Cell<Date?>

datetime

Create a cell with a datetime.

Invalid datetimes are converted to missing values (null).

Parameters:

Name Type Description Default
year union<Int, Cell<Any?>?> The year. -
month union<Int, Cell<Any?>?> The month. Must be between 1 and 12. -
day union<Int, Cell<Any?>?> The day. Must be between 1 and 31. -
hour union<Int, Cell<Any?>?> The hour. Must be between 0 and 23. 0
minute union<Int, Cell<Any?>?> The minute. Must be between 0 and 59. 0
second union<Int, Cell<Any?>?> The second. Must be between 0 and 59. 0
microsecond union<Int, Cell<Any?>?> The microsecond. Must be between 0 and 999,999. 0
timeZone String? The time zone. If null, values are assumed to be in local time. This is different from setting the time zone to "UTC". Any TZ identifier defined in the tz database is valid. null

Results:

Name Type Description
cell Cell<Datetime?> The created cell.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> Cell.datetime(2025, 1, 15, hour = 12));
    out column.transform((cell) -> Cell.datetime(2025, 1, 15, hour = cell));
}
Stub code in Cell.sdsstub

@Pure
static fun datetime(
    year: ConvertibleToIntCell,
    month: ConvertibleToIntCell,
    day: ConvertibleToIntCell,
    hour: ConvertibleToIntCell = 0,
    minute: ConvertibleToIntCell = 0,
    second: ConvertibleToIntCell = 0,
    microsecond: ConvertibleToIntCell = 0,
    @PythonName("time_zone") timeZone: String? = null
) -> cell: Cell<Datetime?>

duration

Create a cell with a duration.

Invalid durations are converted to missing values (null).

Parameters:

Name Type Description Default
weeks union<Int, Cell<Any?>?> The number of weeks. 0
days union<Int, Cell<Any?>?> The number of days. 0
hours union<Int, Cell<Any?>?> The number of hours. 0
minutes union<Int, Cell<Any?>?> The number of minutes. 0
seconds union<Int, Cell<Any?>?> The number of seconds. 0
milliseconds union<Int, Cell<Any?>?> The number of milliseconds. 0
microseconds union<Int, Cell<Any?>?> The number of microseconds. 0

Results:

Name Type Description
cell Cell<Duration?> The created cell.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> Cell.duration(hours = 1));
    out column.transform((cell) -> Cell.duration(hours = cell));
}
Stub code in Cell.sdsstub

@Pure
static fun duration(
    weeks: ConvertibleToIntCell = 0,
    days: ConvertibleToIntCell = 0,
    hours: ConvertibleToIntCell = 0,
    minutes: ConvertibleToIntCell = 0,
    seconds: ConvertibleToIntCell = 0,
    milliseconds: ConvertibleToIntCell = 0,
    microseconds: ConvertibleToIntCell = 0
) -> cell: Cell<Duration?>

firstNotNull

Return the first cell that is not null or null if all cells are null.

Parameters:

Name Type Description Default
cells List<Cell<P>> The list of cells to be checked. -

Results:

Name Type Description
cell Cell<P?> The first cell that is not null or null if all cells are null.

Type parameters:

Name Upper Bound Description Default
P Any? - -
Stub code in Cell.sdsstub

@Pure
@PythonName("first_not_none")
static fun firstNotNull<P>(
    cells: List<Cell<P>>
) -> cell: Cell<P?>

time

Create a cell with a time.

Invalid times are converted to missing values (null).

Parameters:

Name Type Description Default
hour union<Int, Cell<Any?>?> The hour. Must be between 0 and 23. -
minute union<Int, Cell<Any?>?> The minute. Must be between 0 and 59. -
second union<Int, Cell<Any?>?> The second. Must be between 0 and 59. -
microsecond union<Int, Cell<Any?>?> The microsecond. Must be between 0 and 999,999. 0

Results:

Name Type Description
cell Cell<Time?> The created cell.

Examples:

pipeline example {
    val column = Column("a", [1, 2, null]);
    out column.transform((cell) -> Cell.time(12, 0, 0));
    out column.transform((cell) -> Cell.time(12, cell, 0, microsecond = 1));
}
Stub code in Cell.sdsstub

@Pure
static fun time(
    hour: ConvertibleToIntCell,
    minute: ConvertibleToIntCell,
    second: ConvertibleToIntCell,
    microsecond: ConvertibleToIntCell = 0
) -> cell: Cell<Time?>