Serialize the logical plan of this LazyFrame
Description
Serialize the logical plan of this LazyFrame
Usage
<LazyFrame>$serialize(..., format = c("binary", "json"))
pl__deserialize_lf(data)
Arguments
…
|
These dots are for future extensions and must be empty. |
format
|
A character of the format in which to serialize. One of: |
data
|
A raw vector of serialized LazyFrame. |
Value
-
\returns raw or character, depending on the$serialize() formatargument. -
pl$deserialize_lf()returns a deserialized LazyFrame.
Examples
library("polars")
lf <- pl$LazyFrame(a = 1:3)$sum()
# Serialize the logical plan to a binary representation.
serialized <- lf$serialize()
serialized
#> [1] 44 53 4c 5f 56 45 52 53 49 4f 4e 18 00 00 00 36 32 38 36 62 61 64 37 62 35
#> [26] 39 63 36 64 66 66 62 61 62 63 62 37 65 64 61 30 64 33 61 31 63 33 38 36 63
#> [51] 63 36 35 31 61 64 38 62 32 34 37 39 62 32 65 34 65 34 36 38 36 31 39 39 65
#> [76] 30 34 65 31 83 a4 72 6f 6f 74 82 a3 69 64 78 02 a7 76 65 72 73 69 6f 6e 01
#> [101] aa 64 61 74 61 66 72 61 6d 65 73 92 82 a5 76 61 6c 75 65 c0 a7 76 65 72 73
#> [126] 69 6f 6e 00 82 a5 76 61 6c 75 65 c5 01 90 ff ff ff ff b8 00 00 00 04 00 00
#> [151] 00 f2 ff ff ff 14 00 00 00 04 00 01 00 00 00 0a 00 0b 00 08 00 0a 00 04 00
#> [176] f2 ff ff ff 48 00 00 00 10 00 00 00 00 00 0a 00 0c 00 00 00 04 00 08 00 01
#> [201] 00 00 00 04 00 00 00 f4 ff ff ff 18 00 00 00 0c 00 00 00 08 00 0c 00 04 00
#> [226] 08 00 03 00 00 00 5b 30 5d 00 09 00 00 00 5f 50 4c 5f 46 4c 41 47 53 00 00
#> [251] 00 01 00 00 00 04 00 00 00 ec ff ff ff 38 00 00 00 20 00 00 00 18 00 00 00
#> [276] 01 02 00 00 10 00 12 00 04 00 10 00 11 00 08 00 00 00 0c 00 00 00 00 00 f4
#> [301] ff ff ff 20 00 00 00 01 00 00 00 08 00 09 00 04 00 08 00 01 00 00 00 61 00
#> [326] 00 00 00 00 00 00 ff ff ff ff 80 00 00 00 04 00 00 00 ec ff ff ff 40 00 00
#> [351] 00 00 00 00 00 14 00 00 00 04 00 03 00 0c 00 13 00 10 00 12 00 0c 00 04 00
#> [376] ea ff ff ff 03 00 00 00 00 00 00 00 3c 00 00 00 10 00 00 00 00 00 0a 00 14
#> [401] 00 04 00 0c 00 10 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
#> [426] 00 00 00 00 00 00 00 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 01 00 00
#> [451] 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00
#> [476] 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
#> [501] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
#> [526] 00 00 00 00 00 00 ff ff ff ff 00 00 00 00 a7 76 65 72 73 69 6f 6e 01 a9 64
#> [551] 73 6c 5f 70 6c 61 6e 73 93 82 a5 76 61 6c 75 65 c0 a7 76 65 72 73 69 6f 6e
#> [576] 00 82 a5 76 61 6c 75 65 81 ad 44 61 74 61 46 72 61 6d 65 53 63 61 6e 82 a2
#> [601] 64 66 82 a3 69 64 78 01 a7 76 65 72 73 69 6f 6e 01 a6 73 63 68 65 6d 61 81
#> [626] a6 66 69 65 6c 64 73 81 a1 61 a5 49 6e 74 33 32 a7 76 65 72 73 69 6f 6e 01
#> [651] 82 a5 76 61 6c 75 65 81 ab 4d 61 70 46 75 6e 63 74 69 6f 6e 82 a5 69 6e 70
#> [676] 75 74 82 a3 69 64 78 01 a7 76 65 72 73 69 6f 6e 01 a8 66 75 6e 63 74 69 6f
#> [701] 6e 81 a5 53 74 61 74 73 a3 53 75 6d a7 76 65 72 73 69 6f 6e 01
# The bytes can later be deserialized back into a LazyFrame.
pl$deserialize_lf(serialized)$collect()
#> shape: (1, 1)
#> ┌─────┐
#> │ a │
#> │ --- │
#> │ i32 │
#> ╞═════╡
#> │ 6 │
#> └─────┘