MCPcopy Create free account
hub / github.com/apache/datafusion / union

Method union

datafusion/core/src/dataframe/mod.rs:764–773  ·  view source on GitHub ↗

Calculate the union of two [`DataFrame`]s, preserving duplicate rows. The two [`DataFrame`]s must have exactly the same schema # Example ``` # use datafusion::prelude::*; # use datafusion::error::Result; # use datafusion_common::assert_batches_sorted_eq; # #[tokio::main] # async fn main() -> Result<()> { let ctx = SessionContext::new(); let df = ctx .read_csv("tests/data/example.csv", CsvReadOpt

(self, dataframe: DataFrame)

Source from the content-addressed store, hash-verified

762 /// # }
763 /// ```
764 pub fn union(self, dataframe: DataFrame) -> Result<DataFrame> {
765 let plan = LogicalPlanBuilder::from(self.plan)
766 .union(dataframe.plan)?
767 .build()?;
768 Ok(DataFrame {
769 session_state: self.session_state,
770 plan,
771 projection_requires_validation: true,
772 })
773 }
774
775 /// Calculate the union of two [`DataFrame`]s using column names, preserving duplicate rows.
776 ///

Calls 1

buildMethod · 0.45