-
Notifications
You must be signed in to change notification settings - Fork 9
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
Rewrite #100
Merged
matthewmturner
merged 17 commits into
datafusion-contrib:main
from
matthewmturner:feat/tui-textarea
Aug 25, 2024
Merged
Rewrite #100
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fde3199
Checkin
matthewmturner e29e45d
Working
matthewmturner 14e7df5
Logs working
matthewmturner 6c77ad4
More working
matthewmturner f149703
Scrolling working
matthewmturner 4bb34d6
Cleanup
matthewmturner 0d9c412
License
matthewmturner b7fa886
Cargo.toml cleanup
matthewmturner 6638d11
Add clear editor
matthewmturner 3c6aaca
More cleanup
matthewmturner 7807ab8
Clippy
matthewmturner 5f3e73c
Fix test
matthewmturner 48661c8
Cleanup deps
matthewmturner b324b39
More cleanup
matthewmturner 3f70bd3
Improve scrolling
matthewmturner f39a113
Small fix
matthewmturner 4e0025b
Clippy
matthewmturner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,41 @@ | ||
[package] | ||
edition = "2021" | ||
name = "datafusion-tui" | ||
description = "Terminal based, extensible, interactive data analysis tool using SQL " | ||
version = "0.1.0" | ||
homepage = "https://github.com/datafusion-contrib/datafusion-tui" | ||
repository = "https://github.com/datafusion-contrib/datafusion-tui" | ||
readme = "README.md" | ||
authors = ["Matthew Turner <[email protected]>"] | ||
license = "Apache-2.0" | ||
keywords = ["arrow", "query", "sql", "datafusion"] | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
arrow = "13" | ||
aws-sdk-s3 = "0.9.0" | ||
aws-types = "0.9.0" | ||
ballista = { version = "0.7", optional = true } | ||
clap = { version = "3", features = ["derive", "cargo"] } | ||
crossterm = { version = "0.23", features = ["serde"] } | ||
datafusion = "8" | ||
datafusion-catalogprovider-glue = { version = "0.1.7", optional = true } | ||
datafusion-objectstore-s3 = { version = "0.2.1", optional = true } | ||
dirs = "4.0" | ||
futures = "0.3" | ||
http = "0.2.6" | ||
log = "0.4" | ||
mimalloc = { version = "0.1", default-features = false } | ||
serde = "1.0.136" | ||
serde_json = "1.0.79" | ||
ratatui = { version = "0.28", default-features = false, features = [ | ||
'crossterm', | ||
'serde', | ||
] } | ||
tui-logger = {version="0.12", features=["crossterm"]} | ||
tokio = { version = "1", features = ["full"] } | ||
unicode-width = "0.1.9" | ||
|
||
[features] | ||
s3 = ["datafusion-objectstore-s3"] | ||
glue = ["datafusion-catalogprovider-glue"] | ||
async-trait = "0.1.80" | ||
clap = { version = "4.5.1", features = ["derive"] } | ||
color-eyre = "0.6.3" | ||
crossterm = { version = "0.28.1", features = ["event-stream"] } | ||
datafusion = "40.0.0" | ||
directories = "5.0.1" | ||
futures = "0.3.30" | ||
itertools = "0.13.0" | ||
lazy_static = "1.4.0" | ||
log = "0.4.22" | ||
ratatui = "0.28.0" | ||
serde = { version = "1.0.197", features = ["derive"] } | ||
strum = "0.26.2" | ||
tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros"] } | ||
tokio-stream = "0.1.15" | ||
tokio-util = "0.7.10" | ||
toml = "0.8.12" | ||
tui-logger = {version = "0.12", features = ["tracing-support"]} | ||
tui-textarea = "0.6.1" | ||
|
||
[[bin]] | ||
name = "dft" | ||
path = "src/main.rs" | ||
|
||
[lints.clippy] | ||
clone_on_ref_ptr = "deny" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use std::path::PathBuf; | ||
|
||
use directories::{ProjectDirs, UserDirs}; | ||
use lazy_static::lazy_static; | ||
use serde::Deserialize; | ||
|
||
lazy_static! { | ||
pub static ref PROJECT_NAME: String = env!("CARGO_CRATE_NAME").to_uppercase().to_string(); | ||
pub static ref DATA_FOLDER: Option<PathBuf> = | ||
std::env::var(format!("{}_DATA", PROJECT_NAME.clone())) | ||
.ok() | ||
.map(PathBuf::from); | ||
pub static ref LOG_ENV: String = format!("{}_LOGLEVEL", PROJECT_NAME.clone()); | ||
pub static ref LOG_FILE: String = format!("{}.log", env!("CARGO_PKG_NAME")); | ||
} | ||
|
||
fn project_directory() -> PathBuf { | ||
if let Some(user_dirs) = UserDirs::new() { | ||
return user_dirs.home_dir().join(".config").join("dft"); | ||
}; | ||
|
||
let maybe_project_dirs = ProjectDirs::from("", "", env!("CARGO_PKG_NAME")); | ||
if let Some(project_dirs) = maybe_project_dirs { | ||
project_dirs.data_local_dir().to_path_buf() | ||
} else { | ||
panic!("No known data directory") | ||
} | ||
} | ||
|
||
pub fn get_data_dir() -> PathBuf { | ||
if let Some(data_dir) = DATA_FOLDER.clone() { | ||
data_dir | ||
} else { | ||
project_directory() | ||
} | ||
} | ||
|
||
#[derive(Debug, Default, Deserialize)] | ||
pub struct AppConfig { | ||
#[serde(default = "default_datafusion_config")] | ||
pub datafusion: DataFusionConfig, | ||
#[serde(default = "default_display_config")] | ||
pub display: DisplayConfig, | ||
#[serde(default = "default_interaction_config")] | ||
pub interaction: InteractionConfig, | ||
} | ||
|
||
fn default_datafusion_config() -> DataFusionConfig { | ||
DataFusionConfig::default() | ||
} | ||
|
||
fn default_display_config() -> DisplayConfig { | ||
DisplayConfig::default() | ||
} | ||
|
||
fn default_interaction_config() -> InteractionConfig { | ||
InteractionConfig::default() | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
pub struct DisplayConfig { | ||
#[serde(default = "default_tick_rate")] | ||
pub tick_rate: f64, | ||
#[serde(default = "default_frame_rate")] | ||
pub frame_rate: f64, | ||
} | ||
|
||
fn default_tick_rate() -> f64 { | ||
60.0 | ||
} | ||
|
||
fn default_frame_rate() -> f64 { | ||
60.0 | ||
} | ||
|
||
impl Default for DisplayConfig { | ||
fn default() -> Self { | ||
Self { | ||
tick_rate: 5.0, | ||
frame_rate: 5.0, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, Deserialize)] | ||
pub struct DataFusionConfig { | ||
#[serde(default = "default_stream_batch_size")] | ||
pub stream_batch_size: usize, | ||
} | ||
|
||
fn default_stream_batch_size() -> usize { | ||
1 | ||
} | ||
|
||
impl Default for DataFusionConfig { | ||
fn default() -> Self { | ||
Self { | ||
stream_batch_size: 1, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Default, Deserialize)] | ||
pub struct InteractionConfig { | ||
#[serde(default = "default_mouse")] | ||
pub mouse: bool, | ||
#[serde(default = "default_paste")] | ||
pub paste: bool, | ||
} | ||
|
||
fn default_mouse() -> bool { | ||
false | ||
} | ||
|
||
fn default_paste() -> bool { | ||
false | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀