Skip to content

Commit d018dec

Browse files
Update lib (#229)
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f856b33 commit d018dec

402 files changed

Lines changed: 1967 additions & 1257 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ python/**/target/
3838
tests/integration/target/
3939
tests/integration/.venv/
4040
tests/integration/install
41+
42+
# Python bytecode (do not commit)
43+
**/__pycache__/
44+
*.py[cod]

Cargo.lock

Lines changed: 121 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 17 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,25 @@
11
[workspace]
22
members = [
3-
".",
3+
"src/function-stream",
44
"protocol",
55
"cli/cli",
6+
"src/catalog",
7+
"src/catalog_storage",
8+
"src/common",
9+
"src/config",
10+
"src/coordinator",
11+
"src/logger",
12+
"src/runtime_common",
13+
"src/servicer",
14+
"src/sqlparser",
15+
"src/streaming_runtime",
16+
"src/streaming_planner",
17+
"src/wasm_runtime",
618
]
19+
resolver = "2"
20+
default-members = ["src/function-stream"]
721

8-
[package]
9-
name = "function-stream"
22+
# Shared crate metadata for workspace members (`version.workspace = true`, etc.).
23+
[workspace.package]
1024
version = "0.6.0"
1125
edition = "2024"
12-
13-
[lib]
14-
name = "function_stream"
15-
path = "src/lib.rs"
16-
17-
[[bin]]
18-
name = "function-stream"
19-
path = "src/main.rs"
20-
21-
22-
[dependencies]
23-
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync", "time", "net", "signal"] }
24-
serde = { version = "1.0", features = ["derive"] }
25-
serde_yaml = "0.9"
26-
serde_json = "1.0"
27-
uuid = { version = "1.0", features = ["v4", "v7"] }
28-
log = "0.4"
29-
tracing = "0.1"
30-
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
31-
tracing-appender = "0.2"
32-
anyhow = "1.0"
33-
thiserror = "2"
34-
tonic = { version = "0.12", features = ["default"] }
35-
async-trait = "0.1"
36-
num_cpus = "1.0"
37-
protocol = { path = "./protocol" }
38-
prost = "0.13"
39-
rdkafka = { version = "0.38", features = ["cmake-build", "ssl", "gssapi", "curl"] }
40-
crossbeam-channel = "0.5"
41-
wasmtime = { version = "41.0.3", features = ["component-model", "async"] }
42-
base64 = "0.22"
43-
wasmtime-wasi = "41.0.3"
44-
rocksdb = { version = "0.21", features = ["multi-threaded-cf", "lz4"] }
45-
bincode = { version = "2", features = ["serde"] }
46-
chrono = "0.4"
47-
tokio-stream = "0.1.18"
48-
lru = "0.12"
49-
parking_lot = "0.12"
50-
arrow = { version = "55", default-features = false }
51-
arrow-array = "55"
52-
arrow-ipc = "55"
53-
arrow-schema = { version = "55", features = ["serde"] }
54-
parquet = "55"
55-
object_store = { version = "0.12.5", features = ["aws"] }
56-
bytes = "1"
57-
futures = "0.3"
58-
serde_json_path = "0.7"
59-
xxhash-rust = { version = "0.8", features = ["xxh3"] }
60-
proctitle = "0.1"
61-
unicase = "2.7"
62-
petgraph = "0.7"
63-
rand = { version = "0.8", features = ["small_rng"] }
64-
itertools = "0.14"
65-
strum = { version = "0.26", features = ["derive"] }
66-
67-
arrow-json = {version = '55.2.0'}
68-
apache-avro = "0.21"
69-
datafusion = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
70-
datafusion-common = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
71-
datafusion-execution = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
72-
datafusion-expr = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
73-
datafusion-physical-expr = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
74-
datafusion-proto = {git = 'https://github.com/FunctionStream/datafusion', branch = '48.0.1/fs'}
75-
76-
sqlparser = { git = "https://github.com/FunctionStream/sqlparser-rs", branch = "0.58.0/fs" }
77-
78-
ahash = "0.8"
79-
governor = "0.8.0"
80-
lance = { version = "4.0.0", default-features = false, features = ["aws"] }
81-
arrow-array-lance = { package = "arrow-array", version = "57.3.0" }
82-
arrow-ipc-lance = { package = "arrow-ipc", version = "57.3.0" }
83-
84-
[features]
85-
default = ["incremental-cache", "python"]
86-
incremental-cache = ["wasmtime/incremental-cache"]
87-
python = []
88-
89-
[dev-dependencies]
90-
tempfile = "3.27.0"

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212
APP_NAME := function-stream
13+
# Version from root `[workspace.package]` (single source of truth).
1314
VERSION := $(shell grep '^version' Cargo.toml | head -1 | awk -F '"' '{print $$2}')
1415
DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
1516

@@ -106,6 +107,7 @@ build: .check-env .ensure-target .build-wasm
106107
@RUSTFLAGS="$(OPTIMIZE_FLAGS)" \
107108
cargo build --release \
108109
--target $(TRIPLE) \
110+
-p $(APP_NAME) \
109111
--features python \
110112
--quiet
111113
$(call log,BUILD,CLI)
@@ -118,14 +120,15 @@ build: .check-env .ensure-target .build-wasm
118120

119121
build-lite: .check-env .ensure-target
120122
$(call log,BUILD,Rust Lite [$(OS_NAME) / $(TRIPLE)])
121-
@RUSTFLAGS="$(INDUSTRIAL_RUSTFLAGS)" \
123+
@RUSTFLAGS="$(OPTIMIZE_FLAGS)" \
122124
cargo build --release \
123125
--target $(TRIPLE) \
126+
-p $(APP_NAME) \
124127
--no-default-features \
125128
--features incremental-cache \
126129
--quiet
127130
$(call log,BUILD,CLI for dist)
128-
@RUSTFLAGS="$(INDUSTRIAL_RUSTFLAGS)" \
131+
@RUSTFLAGS="$(OPTIMIZE_FLAGS)" \
129132
cargo build --release \
130133
--target $(TRIPLE) \
131134
-p function-stream-cli \

cli/cli/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "function-stream-cli"
3-
version = "0.1.0"
4-
edition = "2021"
3+
version.workspace = true
4+
edition.workspace = true
55

66
[[bin]]
77
name = "cli"

cli/cli/src/repl.rs

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use arrow_ipc::reader::StreamReader;
1717
use arrow_schema::DataType;
1818
use comfy_table::presets::UTF8_FULL;
1919
use comfy_table::{Attribute, Cell, Color, ContentArrangement, Table, TableComponent};
20-
use protocol::cli::{function_stream_service_client::FunctionStreamServiceClient, SqlRequest};
20+
use protocol::cli::{SqlRequest, function_stream_service_client::FunctionStreamServiceClient};
2121
use rustyline::error::ReadlineError;
2222
use rustyline::{Config, DefaultEditor, EditMode};
2323
use std::fmt;
@@ -158,17 +158,17 @@ impl Repl {
158158
}
159159

160160
// 3. Strict Data Check: Only proceed if data is explicitly present and non-empty
161-
if let Some(bytes) = response.data {
162-
if !bytes.is_empty() {
163-
// format_arrow_data returns Ok(Some(Table)) ONLY if row_count > 0
164-
match self.format_arrow_data(&bytes) {
165-
Ok(Some(table)) => println!("{}", table),
166-
Ok(None) => {
167-
// Data was present but contained 0 rows (e.g., empty result set)
168-
// We print nothing here to keep output clean as requested
169-
}
170-
Err(e) => eprintln!("Failed to parse result data: {}", e),
161+
if let Some(bytes) = response.data
162+
&& !bytes.is_empty()
163+
{
164+
// format_arrow_data returns Ok(Some(Table)) ONLY if row_count > 0
165+
match self.format_arrow_data(&bytes) {
166+
Ok(Some(table)) => println!("{}", table),
167+
Ok(None) => {
168+
// Data was present but contained 0 rows (e.g., empty result set)
169+
// We print nothing here to keep output clean as requested
171170
}
171+
Err(e) => eprintln!("Failed to parse result data: {}", e),
172172
}
173173
}
174174

@@ -243,11 +243,7 @@ impl Repl {
243243
}
244244
}
245245

246-
if has_rows {
247-
Ok(Some(table))
248-
} else {
249-
Ok(None)
250-
}
246+
if has_rows { Ok(Some(table)) } else { Ok(None) }
251247
}
252248

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

318314
#[cfg(unix)]
319315
let mut sigterm = {
320-
use tokio::signal::unix::{signal, SignalKind};
316+
use tokio::signal::unix::{SignalKind, signal};
321317
signal(SignalKind::terminate()).expect("failed to register SIGTERM handler")
322318
};
323319

@@ -403,10 +399,8 @@ impl Repl {
403399
println!();
404400
}
405401

406-
if !skip_save_history {
407-
if let Some(ref mut ed) = repl.lock().await.editor {
408-
let _ = ed.save_history(".function-stream-cli-history");
409-
}
402+
if !skip_save_history && let Some(ref mut ed) = repl.lock().await.editor {
403+
let _ = ed.save_history(".function-stream-cli-history");
410404
}
411405
Ok(())
412406
}
@@ -448,10 +442,10 @@ impl Repl {
448442
}
449443

450444
fn add_history_entry(&mut self, entry: &str) {
451-
if let Some(ed) = self.editor.as_mut() {
452-
if !entry.trim().is_empty() {
453-
let _ = ed.add_history_entry(entry.trim());
454-
}
445+
if let Some(ed) = self.editor.as_mut()
446+
&& !entry.trim().is_empty()
447+
{
448+
let _ = ed.add_history_entry(entry.trim());
455449
}
456450
}
457451

0 commit comments

Comments
 (0)