pub struct ExecutionContext { /* private fields */ }Implementations§
Source§impl ExecutionContext
impl ExecutionContext
Sourcepub fn new(path: String) -> ExecutionContext
pub fn new(path: String) -> ExecutionContext
Examples found in repository?
examples/query_example.rs (line 17)
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let mut workspace_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
8 workspace_dir.pop();
9 workspace_dir.pop();
10
11 let test_data_path = workspace_dir.join("test-data");
12
13 let absolute_path = test_data_path.canonicalize()?;
14
15 let path_str = absolute_path.to_string_lossy().to_string();
16
17 let ctx = ExecutionContext::new(path_str);
18
19 let df = ctx
20 .sql(
21 "
22 SELECT key as symbol, revenue, net_income
23 FROM financials
24 AT ('2019-01-17T00:00:00.000Z') -- as per Financial Quarter end date
25 WHERE industry IN ('Software')
26 ORDER BY revenue DESC
27 LIMIT 5;
28 ",
29 )
30 .await?;
31
32 df.show().await?;
33
34 Ok(())
35}Sourcepub async fn sql(&self, sql: &str) -> Result<DataFrame, Box<dyn Error>>
pub async fn sql(&self, sql: &str) -> Result<DataFrame, Box<dyn Error>>
Examples found in repository?
examples/query_example.rs (lines 20-29)
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let mut workspace_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
8 workspace_dir.pop();
9 workspace_dir.pop();
10
11 let test_data_path = workspace_dir.join("test-data");
12
13 let absolute_path = test_data_path.canonicalize()?;
14
15 let path_str = absolute_path.to_string_lossy().to_string();
16
17 let ctx = ExecutionContext::new(path_str);
18
19 let df = ctx
20 .sql(
21 "
22 SELECT key as symbol, revenue, net_income
23 FROM financials
24 AT ('2019-01-17T00:00:00.000Z') -- as per Financial Quarter end date
25 WHERE industry IN ('Software')
26 ORDER BY revenue DESC
27 LIMIT 5;
28 ",
29 )
30 .await?;
31
32 df.show().await?;
33
34 Ok(())
35}Auto Trait Implementations§
impl !RefUnwindSafe for ExecutionContext
impl !UnwindSafe for ExecutionContext
impl Freeze for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl UnsafeUnpin for ExecutionContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more