Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangpengHao committed Nov 12, 2024
1 parent 10b0205 commit 89c24b7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
Binary file modified doc/parquet-viewer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod schema;
use datafusion::{
error::DataFusionError,
execution::{SendableRecordBatchStream, TaskContext},
logical_expr::LogicalPlan,
physical_plan::{
collect, stream::RecordBatchStreamAdapter, streaming::PartitionStream, ExecutionPlan,
},
Expand Down Expand Up @@ -272,7 +271,6 @@ fn App() -> impl IntoView {
let (sql_query, set_sql_query) = create_signal(String::new());
let (query_result, set_query_result) = create_signal(Vec::<arrow::array::RecordBatch>::new());
let (file_name, set_file_name) = create_signal(String::from("uploaded"));
let (logical_plan, set_logical_plan) = create_signal(None::<LogicalPlan>);
let (physical_plan, set_physical_plan) = create_signal(None::<Arc<dyn ExecutionPlan>>);

let execute_query = move || {
Expand Down Expand Up @@ -339,7 +337,7 @@ fn App() -> impl IntoView {
}
};

set_logical_plan.set(Some(plan.clone()));
web_sys::console::log_1(&plan.display_indent().to_string().into());

let physical_plan = match state.create_physical_plan(&plan).await {
Ok(plan) => plan,
Expand Down Expand Up @@ -616,10 +614,9 @@ fn App() -> impl IntoView {
return view! {
}.into_view();
} else {
let logical_plan = logical_plan.get().unwrap();
let physical_plan = physical_plan.get().unwrap();
view! {
<QueryResults query_result=result logical_plan=logical_plan physical_plan=physical_plan />
<QueryResults query_result=result physical_plan=physical_plan />
}
.into_view()
}
Expand Down
19 changes: 1 addition & 18 deletions src/query_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use arrow::datatypes::DataType;
use arrow::record_batch::RecordBatch;
use datafusion::{
common::cast::{as_binary_array, as_binary_view_array, as_string_view_array},
logical_expr::LogicalPlan,
physical_plan::{
accept, display::DisplayableExecutionPlan, DisplayFormatType, ExecutionPlan,
ExecutionPlanVisitor,
Expand All @@ -16,7 +15,6 @@ use leptos::*;
#[component]
pub fn QueryResults(
query_result: Vec<RecordBatch>,
logical_plan: LogicalPlan,
physical_plan: Arc<dyn ExecutionPlan>,
) -> impl IntoView {
let (active_tab, set_active_tab) = create_signal("results".to_string());
Expand All @@ -34,16 +32,6 @@ pub fn QueryResults(
>
"Query Results"
</button>
<button
class=move || format!(
"px-4 py-2 {} {}",
if active_tab() == "logical_plan" { "border-b-2 border-blue-500 text-blue-600" } else { "text-gray-600" },
"hover:text-blue-600"
)
on:click=move |_| set_active_tab("logical_plan".to_string())
>
"Logical Plan"
</button>
<button
class=move || format!(
"px-4 py-2 {} {}",
Expand All @@ -52,7 +40,7 @@ pub fn QueryResults(
)
on:click=move |_| set_active_tab("physical_plan".to_string())
>
"Physical Plan"
"ExecutionPlan"
</button>
</div>

Expand Down Expand Up @@ -104,11 +92,6 @@ pub fn QueryResults(
</table>
</div>
}.into_view(),
"logical_plan" => view! {
<div class="whitespace-pre-wrap font-mono">
{logical_plan.display_indent().to_string()}
</div>
}.into_view(),
"physical_plan" => view! {
<PhysicalPlan physical_plan=physical_plan.clone() />
}.into_view(),
Expand Down

0 comments on commit 89c24b7

Please sign in to comment.