Skip to content

Commit 48b6d89

Browse files
authored
Add serde to partiql-logical (#290)
Adds serde w/ Serialize and Deserialize traits to partiql-logical.
1 parent 5cbe79e commit 48b6d89

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Added
1212
- Adds some benchmarks for parsing, compiling, planning, & evaluation
1313
- Implements `PIVOT` operator in evaluator
14-
- `serde` feature to `partiql-value` with `Serialize` and `Deserialize` json serde.
14+
- `serde` feature to `partiql-value` and `partiql-logical` with `Serialize` and `Deserialize` traits.
1515

1616
### Fixes
1717

partiql-logical/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,11 @@ ordered-float = "3.*"
2626
itertools = "0.10.*"
2727
unicase = "2.*"
2828

29+
serde = { version = "1.*", features = ["derive"], optional = true }
2930

31+
[features]
32+
default = []
33+
serde = [
34+
"dep:serde",
35+
"ordered-float/serde"
36+
]

partiql-logical/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@
5151
use partiql_value::{BindingsName, Value};
5252
use std::collections::HashMap;
5353

54+
#[cfg(feature = "serde")]
55+
use serde::{Deserialize, Serialize};
56+
5457
/// Represents a PartiQL logical plan.
5558
#[derive(Debug, Clone, Eq, PartialEq, Default)]
59+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5660
pub struct LogicalPlan<T>
5761
where
5862
T: Default,
@@ -148,6 +152,7 @@ where
148152

149153
/// Represents an operator identifier in a [`LogicalPlan`]
150154
#[derive(Debug, Clone, Eq, PartialEq, Copy, Hash)]
155+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
151156
pub struct OpId(usize);
152157

153158
impl OpId {

0 commit comments

Comments
 (0)