Skip to content
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

fix(udf): increase external udf message limit to 20MB #18591

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/expr/impl/src/udf/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::sync::{Arc, LazyLock, Weak};
use std::time::Duration;

use anyhow::bail;
use arrow_flight::flight_service_client::FlightServiceClient;
use arrow_udf_flight::Client;
use futures_util::{StreamExt, TryStreamExt};
use ginepro::{LoadBalancedChannel, ResolutionStrategy};
Expand Down Expand Up @@ -164,6 +165,9 @@ impl UdfImpl for ExternalFunction {
}
}

// TODO(rc): allow changing this in configuration
const MAX_DECODING_MESSAGE_SIZE: usize = 20 << 20; // 20MB

/// Get or create a client for the given UDF service.
///
/// There is a global cache for clients, so that we can reuse the same client for the same service.
Expand All @@ -186,7 +190,9 @@ fn get_or_create_flight_client(link: &str) -> Result<Arc<Client>> {
let client = Arc::new(tokio::task::block_in_place(|| {
RUNTIME.block_on(async {
let channel = connect_tonic(link).await?;
Ok(Client::new(channel).await?) as Result<_>
let client = FlightServiceClient::new(channel)
.max_decoding_message_size(MAX_DECODING_MESSAGE_SIZE);
Ok(Client::with_flight_client(client).await?) as Result<_>
})
})?);
clients.insert(link.to_owned(), Arc::downgrade(&client));
Expand Down
Loading