Skip to content
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ python/**/target/
tests/integration/target/
tests/integration/.venv/
tests/integration/install

# Python bytecode (do not commit)
**/__pycache__/
*.py[cod]
123 changes: 121 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 17 additions & 82 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,90 +1,25 @@
[workspace]
members = [
".",
"src/function-stream",
"protocol",
"cli/cli",
"src/catalog",
"src/catalog_storage",
"src/common",
"src/config",
"src/coordinator",
"src/logger",
"src/runtime_common",
"src/servicer",
"src/sqlparser",
"src/streaming_runtime",
"src/streaming_planner",
"src/wasm_runtime",
]
resolver = "2"
default-members = ["src/function-stream"]

[package]
name = "function-stream"
# Shared crate metadata for workspace members (`version.workspace = true`, etc.).
[workspace.package]
version = "0.6.0"
edition = "2024"

[lib]
name = "function_stream"
path = "src/lib.rs"

[[bin]]
name = "function-stream"
path = "src/main.rs"


[dependencies]
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync", "time", "net", "signal"] }
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
serde_json = "1.0"
uuid = { version = "1.0", features = ["v4", "v7"] }
log = "0.4"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-appender = "0.2"
anyhow = "1.0"
thiserror = "2"
tonic = { version = "0.12", features = ["default"] }
async-trait = "0.1"
num_cpus = "1.0"
protocol = { path = "./protocol" }
prost = "0.13"
rdkafka = { version = "0.38", features = ["cmake-build", "ssl", "gssapi", "curl"] }
crossbeam-channel = "0.5"
wasmtime = { version = "41.0.3", features = ["component-model", "async"] }
base64 = "0.22"
wasmtime-wasi = "41.0.3"
rocksdb = { version = "0.21", features = ["multi-threaded-cf", "lz4"] }
bincode = { version = "2", features = ["serde"] }
chrono = "0.4"
tokio-stream = "0.1.18"
lru = "0.12"
parking_lot = "0.12"
arrow = { version = "55", default-features = false }
arrow-array = "55"
arrow-ipc = "55"
arrow-schema = { version = "55", features = ["serde"] }
parquet = "55"
object_store = { version = "0.12.5", features = ["aws"] }
bytes = "1"
futures = "0.3"
serde_json_path = "0.7"
xxhash-rust = { version = "0.8", features = ["xxh3"] }
proctitle = "0.1"
unicase = "2.7"
petgraph = "0.7"
rand = { version = "0.8", features = ["small_rng"] }
itertools = "0.14"
strum = { version = "0.26", features = ["derive"] }

arrow-json = {version = '55.2.0'}
apache-avro = "0.21"
datafusion = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
datafusion-common = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
datafusion-execution = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
datafusion-expr = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
datafusion-physical-expr = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
datafusion-proto = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}

sqlparser = { git = "https://github.com/FunctionStream/sqlparser-rs", branch = "0.58.0/fs" }

ahash = "0.8"
governor = "0.8.0"
lance = { version = "4.0.0", default-features = false, features = ["aws"] }
arrow-array-lance = { package = "arrow-array", version = "57.3.0" }
arrow-ipc-lance = { package = "arrow-ipc", version = "57.3.0" }

[features]
default = ["incremental-cache", "python"]
incremental-cache = ["wasmtime/incremental-cache"]
python = []

[dev-dependencies]
tempfile = "3.27.0"
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
APP_NAME := function-stream
# Version from root `[workspace.package]` (single source of truth).
VERSION := $(shell grep '^version' Cargo.toml | head -1 | awk -F '"' '{print $$2}')
DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")

Expand Down Expand Up @@ -106,6 +107,7 @@ build: .check-env .ensure-target .build-wasm
@RUSTFLAGS="$(OPTIMIZE_FLAGS)" \
cargo build --release \
--target $(TRIPLE) \
-p $(APP_NAME) \
--features python \
--quiet
$(call log,BUILD,CLI)
Expand All @@ -118,14 +120,15 @@ build: .check-env .ensure-target .build-wasm

build-lite: .check-env .ensure-target
$(call log,BUILD,Rust Lite [$(OS_NAME) / $(TRIPLE)])
@RUSTFLAGS="$(INDUSTRIAL_RUSTFLAGS)" \
@RUSTFLAGS="$(OPTIMIZE_FLAGS)" \
cargo build --release \
--target $(TRIPLE) \
-p $(APP_NAME) \
--no-default-features \
--features incremental-cache \
--quiet
$(call log,BUILD,CLI for dist)
@RUSTFLAGS="$(INDUSTRIAL_RUSTFLAGS)" \
@RUSTFLAGS="$(OPTIMIZE_FLAGS)" \
cargo build --release \
--target $(TRIPLE) \
-p function-stream-cli \
Expand Down
4 changes: 2 additions & 2 deletions cli/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "function-stream-cli"
version = "0.1.0"
edition = "2021"
version.workspace = true
edition.workspace = true

[[bin]]
name = "cli"
Expand Down
44 changes: 19 additions & 25 deletions cli/cli/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use arrow_ipc::reader::StreamReader;
use arrow_schema::DataType;
use comfy_table::presets::UTF8_FULL;
use comfy_table::{Attribute, Cell, Color, ContentArrangement, Table, TableComponent};
use protocol::cli::{function_stream_service_client::FunctionStreamServiceClient, SqlRequest};
use protocol::cli::{SqlRequest, function_stream_service_client::FunctionStreamServiceClient};
use rustyline::error::ReadlineError;
use rustyline::{Config, DefaultEditor, EditMode};
use std::fmt;
Expand Down Expand Up @@ -158,17 +158,17 @@ impl Repl {
}

// 3. Strict Data Check: Only proceed if data is explicitly present and non-empty
if let Some(bytes) = response.data {
if !bytes.is_empty() {
// format_arrow_data returns Ok(Some(Table)) ONLY if row_count > 0
match self.format_arrow_data(&bytes) {
Ok(Some(table)) => println!("{}", table),
Ok(None) => {
// Data was present but contained 0 rows (e.g., empty result set)
// We print nothing here to keep output clean as requested
}
Err(e) => eprintln!("Failed to parse result data: {}", e),
if let Some(bytes) = response.data
&& !bytes.is_empty()
{
// format_arrow_data returns Ok(Some(Table)) ONLY if row_count > 0
match self.format_arrow_data(&bytes) {
Ok(Some(table)) => println!("{}", table),
Ok(None) => {
// Data was present but contained 0 rows (e.g., empty result set)
// We print nothing here to keep output clean as requested
}
Err(e) => eprintln!("Failed to parse result data: {}", e),
}
}

Expand Down Expand Up @@ -243,11 +243,7 @@ impl Repl {
}
}

if has_rows {
Ok(Some(table))
} else {
Ok(None)
}
if has_rows { Ok(Some(table)) } else { Ok(None) }
}

fn extract_value(&self, column: &dyn Array, row: usize) -> String {
Expand Down Expand Up @@ -317,7 +313,7 @@ impl Repl {

#[cfg(unix)]
let mut sigterm = {
use tokio::signal::unix::{signal, SignalKind};
use tokio::signal::unix::{SignalKind, signal};
signal(SignalKind::terminate()).expect("failed to register SIGTERM handler")
};

Expand Down Expand Up @@ -403,10 +399,8 @@ impl Repl {
println!();
}

if !skip_save_history {
if let Some(ref mut ed) = repl.lock().await.editor {
let _ = ed.save_history(".function-stream-cli-history");
}
if !skip_save_history && let Some(ref mut ed) = repl.lock().await.editor {
let _ = ed.save_history(".function-stream-cli-history");
}
Ok(())
}
Expand Down Expand Up @@ -448,10 +442,10 @@ impl Repl {
}

fn add_history_entry(&mut self, entry: &str) {
if let Some(ed) = self.editor.as_mut() {
if !entry.trim().is_empty() {
let _ = ed.add_history_entry(entry.trim());
}
if let Some(ed) = self.editor.as_mut()
&& !entry.trim().is_empty()
{
let _ = ed.add_history_entry(entry.trim());
}
}

Expand Down
Loading
Loading