|
16 | 16 | // under the License.
|
17 | 17 |
|
18 | 18 | //! Serialization / Deserialization to Bytes
|
19 |
| -use crate::logical_plan::{AsLogicalPlan, LogicalExtensionCodec}; |
20 |
| -use crate::physical_plan::{AsExecutionPlan, PhysicalExtensionCodec}; |
21 |
| -use crate::{from_proto::parse_expr, protobuf}; |
22 |
| -use arrow::datatypes::SchemaRef; |
23 |
| -use datafusion::datasource::TableProvider; |
| 19 | +use crate::logical_plan::{ |
| 20 | + self, AsLogicalPlan, DefaultLogicalExtensionCodec, LogicalExtensionCodec, |
| 21 | +}; |
| 22 | +use crate::physical_plan::{ |
| 23 | + AsExecutionPlan, DefaultPhysicalExtensionCodec, PhysicalExtensionCodec, |
| 24 | +}; |
| 25 | +use crate::protobuf; |
24 | 26 | use datafusion::physical_plan::functions::make_scalar_function;
|
25 | 27 | use datafusion_common::{DataFusionError, Result};
|
26 |
| -use datafusion_expr::{ |
27 |
| - create_udaf, create_udf, Expr, Extension, LogicalPlan, Volatility, |
28 |
| -}; |
| 28 | +use datafusion_expr::{create_udaf, create_udf, Expr, LogicalPlan, Volatility}; |
29 | 29 | use prost::{
|
30 | 30 | bytes::{Bytes, BytesMut},
|
31 | 31 | Message,
|
@@ -137,7 +137,7 @@ impl Serializeable for Expr {
|
137 | 137 | DataFusionError::Plan(format!("Error decoding expr as protobuf: {}", e))
|
138 | 138 | })?;
|
139 | 139 |
|
140 |
| - parse_expr(&protobuf, registry).map_err(|e| { |
| 140 | + logical_plan::from_proto::parse_expr(&protobuf, registry).map_err(|e| { |
141 | 141 | DataFusionError::Plan(format!("Error parsing protobuf into Expr: {}", e))
|
142 | 142 | })
|
143 | 143 | }
|
@@ -272,75 +272,6 @@ pub fn physical_plan_from_bytes_with_extension_codec(
|
272 | 272 | protobuf.try_into_physical_plan(ctx, &ctx.runtime_env(), extension_codec)
|
273 | 273 | }
|
274 | 274 |
|
275 |
| -#[derive(Debug)] |
276 |
| -struct DefaultLogicalExtensionCodec {} |
277 |
| - |
278 |
| -impl LogicalExtensionCodec for DefaultLogicalExtensionCodec { |
279 |
| - fn try_decode( |
280 |
| - &self, |
281 |
| - _buf: &[u8], |
282 |
| - _inputs: &[LogicalPlan], |
283 |
| - _ctx: &SessionContext, |
284 |
| - ) -> Result<Extension> { |
285 |
| - Err(DataFusionError::NotImplemented( |
286 |
| - "No extension codec provided".to_string(), |
287 |
| - )) |
288 |
| - } |
289 |
| - |
290 |
| - fn try_encode(&self, _node: &Extension, _buf: &mut Vec<u8>) -> Result<()> { |
291 |
| - Err(DataFusionError::NotImplemented( |
292 |
| - "No extension codec provided".to_string(), |
293 |
| - )) |
294 |
| - } |
295 |
| - |
296 |
| - fn try_decode_table_provider( |
297 |
| - &self, |
298 |
| - _buf: &[u8], |
299 |
| - _schema: SchemaRef, |
300 |
| - _ctx: &SessionContext, |
301 |
| - ) -> std::result::Result<Arc<dyn TableProvider>, DataFusionError> { |
302 |
| - Err(DataFusionError::NotImplemented( |
303 |
| - "No codec provided to for TableProviders".to_string(), |
304 |
| - )) |
305 |
| - } |
306 |
| - |
307 |
| - fn try_encode_table_provider( |
308 |
| - &self, |
309 |
| - _node: Arc<dyn TableProvider>, |
310 |
| - _buf: &mut Vec<u8>, |
311 |
| - ) -> std::result::Result<(), DataFusionError> { |
312 |
| - Err(DataFusionError::NotImplemented( |
313 |
| - "No codec provided to for TableProviders".to_string(), |
314 |
| - )) |
315 |
| - } |
316 |
| -} |
317 |
| - |
318 |
| -#[derive(Debug)] |
319 |
| -pub struct DefaultPhysicalExtensionCodec {} |
320 |
| - |
321 |
| -impl PhysicalExtensionCodec for DefaultPhysicalExtensionCodec { |
322 |
| - fn try_decode( |
323 |
| - &self, |
324 |
| - _buf: &[u8], |
325 |
| - _inputs: &[Arc<dyn ExecutionPlan>], |
326 |
| - _registry: &dyn FunctionRegistry, |
327 |
| - ) -> Result<Arc<dyn ExecutionPlan>> { |
328 |
| - Err(DataFusionError::NotImplemented( |
329 |
| - "PhysicalExtensionCodec is not provided".to_string(), |
330 |
| - )) |
331 |
| - } |
332 |
| - |
333 |
| - fn try_encode( |
334 |
| - &self, |
335 |
| - _node: Arc<dyn ExecutionPlan>, |
336 |
| - _buf: &mut Vec<u8>, |
337 |
| - ) -> Result<()> { |
338 |
| - Err(DataFusionError::NotImplemented( |
339 |
| - "PhysicalExtensionCodec is not provided".to_string(), |
340 |
| - )) |
341 |
| - } |
342 |
| -} |
343 |
| - |
344 | 275 | #[cfg(test)]
|
345 | 276 | mod test {
|
346 | 277 | use super::*;
|
|
0 commit comments