tbar4 commented on code in PR #1113:
URL:
https://github.com/apache/datafusion-ballista/pull/1113#discussion_r1844586967
##########
docs/source/user-guide/rust.md:
##########
@@ -17,78 +17,126 @@
under the License.
-->
-# Ballista Rust Client
+# Distributing DataFusion with Ballista
-To connect to a Ballista cluster from Rust, first start by creating a
`BallistaContext`.
+To connect to a Ballista cluster from Rust, first start by creating a
`SessionContext` connected to remote scheduler server.
```rust
-let config = BallistaConfig::builder()
- .set("ballista.shuffle.partitions", "4")
- .build()?;
+use ballista::prelude::*;
+use datafusion::{
+ execution::SessionStateBuilder,
+ prelude::{SessionConfig, SessionContext},
+};
+
+let config = SessionConfig::new_with_ballista()
+ .with_target_partitions(4)
+ .with_ballista_job_name("Remote SQL Example");
+
+let state = SessionStateBuilder::new()
+ .with_config(config)
+ .with_default_features()
+ .build();
+
+let ctx = SessionContext::remote_with_state("df://localhost:50050",
state).await?;
+```
+
+For testing purposes, standalone, in process cluster could be started with:
+
+```rust
+use ballista::prelude::*;
+use datafusion::{
+ execution::SessionStateBuilder,
+ prelude::{SessionConfig, SessionContext},
+};
+let config = SessionConfig::new_with_ballista()
+ .with_target_partitions(1)
+ .with_ballista_standalone_parallelism(2);
+
+let state = SessionStateBuilder::new()
+ .with_config(config)
+ .with_default_features()
+ .build();
+
+let ctx = SessionContext::standalone_with_state(state).await?;
-// connect to Ballista scheduler
-let ctx = BallistaContext::remote("localhost", 50050, &config);
```
-Here is a full example using the DataFrame API.
+Following examples require running remove scheduler and executor nodes.
+
+Full example using the DataFrame API.
```rust
+use ballista::prelude::*;
+use ballista_examples::test_util;
+use datafusion::{
+ prelude::{col, lit, ParquetReadOptions, SessionContext},
+};
+
+/// This example demonstrates executing a simple query against an Arrow data
source (Parquet) and
+/// fetching results, using the DataFrame trait
#[tokio::main]
async fn main() -> Result<()> {
- let config = BallistaConfig::builder()
- .set("ballista.shuffle.partitions", "4")
- .build()?;
+ // creating SessionContext with default settings
+ let ctx = SessionContext::remote("df://localhost:50050".await?;
Review Comment:
missing closing parentheses after `"localhost:50050"`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]