-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create memory table #271
Merged
Merged
Create memory table #271
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9037eea
Merge remote-tracking branch 'upstream/main' into main
jdye64 a483b62
Merge remote-tracking branch 'upstream/main' into main
jdye64 d1f50ee
Merge remote-tracking branch 'upstream/main'
jdye64 f87fc01
Merge remote-tracking branch 'upstream/main'
jdye64 15cde56
Introduce to_variant trait function to LogicalNode and create Explain…
jdye64 e03bc86
Cargo fmt
jdye64 1e35f30
bindings for Extension LogicalNode
jdye64 1dd7246
Add missing classes to list of exports so test_imports will pass
jdye64 52a2f05
upstream merge
jdye64 8d989cf
upstream merge
jdye64 72baea1
Update to point to proper repo
jdye64 ae91873
Update pytest to adhere to aggregate calls being wrapped in projections
jdye64 bf67ce6
Address linter change which causes a pytest to fail
jdye64 75956fa
Add bindings for LogicalPlan::CreateMemoryTable
jdye64 09252f7
Merge branch 'main' into create_memory_table
jdye64 6ec16ea
Merge branch 'main' into create_memory_table
jdye64 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use std::fmt::{self, Display, Formatter}; | ||
|
||
use datafusion_expr::CreateMemoryTable; | ||
use pyo3::prelude::*; | ||
|
||
use crate::sql::logical::PyLogicalPlan; | ||
|
||
use super::logical_node::LogicalNode; | ||
|
||
#[pyclass(name = "CreateMemoryTable", module = "datafusion.expr", subclass)] | ||
#[derive(Clone)] | ||
pub struct PyCreateMemoryTable { | ||
create: CreateMemoryTable, | ||
} | ||
|
||
impl From<PyCreateMemoryTable> for CreateMemoryTable { | ||
fn from(create: PyCreateMemoryTable) -> Self { | ||
create.create | ||
} | ||
} | ||
|
||
impl From<CreateMemoryTable> for PyCreateMemoryTable { | ||
fn from(create: CreateMemoryTable) -> PyCreateMemoryTable { | ||
PyCreateMemoryTable { create } | ||
} | ||
} | ||
|
||
impl Display for PyCreateMemoryTable { | ||
fn fmt(&self, f: &mut Formatter) -> fmt::Result { | ||
write!( | ||
f, | ||
"CreateMemoryTable | ||
Name: {:?} | ||
Input: {:?} | ||
if_not_exists: {:?} | ||
or_replace: {:?}", | ||
&self.create.name, | ||
&self.create.input, | ||
&self.create.if_not_exists, | ||
&self.create.or_replace, | ||
) | ||
} | ||
} | ||
|
||
#[pymethods] | ||
impl PyCreateMemoryTable { | ||
fn name(&self) -> PyResult<String> { | ||
Ok(self.create.name.to_string()) | ||
} | ||
|
||
fn input(&self) -> PyResult<Vec<PyLogicalPlan>> { | ||
Ok(Self::inputs(self)) | ||
} | ||
|
||
fn if_not_exists(&self) -> bool { | ||
self.create.if_not_exists | ||
} | ||
|
||
fn or_replace(&self) -> bool { | ||
self.create.or_replace | ||
} | ||
|
||
fn __repr__(&self) -> PyResult<String> { | ||
Ok(format!("CreateMemoryTable({})", self)) | ||
} | ||
|
||
fn __name__(&self) -> PyResult<String> { | ||
Ok("CreateMemoryTable".to_string()) | ||
} | ||
} | ||
|
||
impl LogicalNode for PyCreateMemoryTable { | ||
fn inputs(&self) -> Vec<PyLogicalPlan> { | ||
vec![PyLogicalPlan::from((*self.create.input).clone())] | ||
} | ||
|
||
fn to_variant(&self, py: Python) -> PyResult<PyObject> { | ||
Ok(self.clone().into_py(py)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use datafusion_expr::Extension; | ||
use pyo3::prelude::*; | ||
|
||
use crate::sql::logical::PyLogicalPlan; | ||
|
||
use super::logical_node::LogicalNode; | ||
|
||
#[pyclass(name = "Extension", module = "datafusion.expr", subclass)] | ||
#[derive(Clone)] | ||
pub struct PyExtension { | ||
pub node: Extension, | ||
} | ||
|
||
impl From<Extension> for PyExtension { | ||
fn from(node: Extension) -> PyExtension { | ||
PyExtension { node } | ||
} | ||
} | ||
|
||
#[pymethods] | ||
impl PyExtension { | ||
fn name(&self) -> PyResult<String> { | ||
Ok(self.node.node.name().to_string()) | ||
} | ||
} | ||
|
||
impl LogicalNode for PyExtension { | ||
fn inputs(&self) -> Vec<PyLogicalPlan> { | ||
vec![] | ||
} | ||
|
||
fn to_variant(&self, py: Python) -> PyResult<PyObject> { | ||
Ok(self.clone().into_py(py)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a new entry here for
CreateMemoryTable
as well?