Skip to content

Separate display logic from execution logic in ExecutionContext #134

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

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Sep 12, 2024

Second part of #132
Follow on to #131

The rationale here is to split out the logic that handles display (e.g. println! and Query from the actual execution, again so that we can update / test the underying ExecutionContext without having the UI affected

This PR moves the "display" releated logic out of the ExecutionContext and into the app / CLI modules respectively.

@alamb alamb force-pushed the alamb/split_display branch from bc49ebb to 094f809 Compare September 12, 2024 13:14
@alamb alamb changed the title Separate display logic from execution logic in ExecutionContext (NOT READY FOR REVIEW) Separate display logic from execution logic in ExecutionContext Sep 12, 2024
@alamb alamb force-pushed the alamb/split_display branch from 094f809 to 44857d1 Compare September 12, 2024 13:16
///
/// Error handling: If an error occurs while executing a query, the error is
/// logged and execution continues
pub async fn run_sqls(&self, sqls: Vec<&str>, sender: UnboundedSender<AppEvent>) -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the code that executes queries and sends them as AppEvents into its own struct

}

/// Prints the stream to stdout
async fn print_stream(&self, mut stream: SendableRecordBatchStream) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the actual calls to println into the cli code

@@ -145,123 +140,44 @@ impl ExecutionContext {
&self.flightsql_client
}

pub async fn run_sqls(&self, sqls: Vec<&str>, sender: UnboundedSender<AppEvent>) -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to AppExecution

@alamb alamb marked this pull request as ready for review September 12, 2024 13:18
@@ -42,8 +39,6 @@ use {
};

use crate::app::config::ExecutionConfig;
use crate::app::state::tabs::sql::Query;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main goal of the PR is to remove these lines from this module

@matthewmturner
Copy link
Collaborator

I test locally with both the local context and flightsql client and app still works as expected so good to go

@matthewmturner matthewmturner merged commit 493f577 into datafusion-contrib:main Sep 12, 2024
3 checks passed
@alamb alamb deleted the alamb/split_display branch September 12, 2024 15:03
@alamb
Copy link
Contributor Author

alamb commented Sep 12, 2024

Thanks @matthewmturner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants