Skip to content

Commit

Permalink
Example update
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Mar 30, 2024
1 parent dd2b7ac commit d7b5441
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/arrow-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ use axum_streams::*;

fn source_test_stream(schema: Arc<Schema>) -> impl Stream<Item = RecordBatch> {
// Simulating a stream with a plain vector and throttling to show how it works
stream::iter((0..10).map(move |_| {
stream::iter((0i64..10i64).map(move |idx| {
RecordBatch::try_new(
schema.clone(),
vec![
Arc::new(Int64Array::from(vec![idx, idx * 2, idx * 3])),
Arc::new(StringArray::from(vec!["New York", "London", "Gothenburg"])),
Arc::new(Float64Array::from(vec![40.7128, 51.5074, 57.7089])),
Arc::new(Float64Array::from(vec![-74.0060, -0.1278, 11.9746])),
Expand All @@ -29,6 +30,7 @@ fn source_test_stream(schema: Arc<Schema>) -> impl Stream<Item = RecordBatch> {

async fn test_text_stream() -> impl IntoResponse {
let schema = Arc::new(Schema::new(vec![
Field::new("id", DataType::Int64, false),
Field::new("city", DataType::Utf8, false),
Field::new("lat", DataType::Float64, false),
Field::new("lng", DataType::Float64, false),
Expand Down

0 comments on commit d7b5441

Please sign in to comment.