This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new b6bbd1d feat: Make thrift transport configurable (#194)
b6bbd1d is described below
commit b6bbd1d14360695621ed77e5af14446dfee372e6
Author: Mark Grey <[email protected]>
AuthorDate: Tue Feb 20 08:13:07 2024 -0500
feat: Make thrift transport configurable (#194)
* feat: make transport configurable (#188)
* implement default for HmsThriftTransport
---
crates/catalog/hms/src/catalog.rs | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/crates/catalog/hms/src/catalog.rs
b/crates/catalog/hms/src/catalog.rs
index f3eab62..a00aaf3 100644
--- a/crates/catalog/hms/src/catalog.rs
+++ b/crates/catalog/hms/src/catalog.rs
@@ -29,10 +29,22 @@ use std::fmt::{Debug, Formatter};
use std::net::ToSocketAddrs;
use typed_builder::TypedBuilder;
+/// Which variant of the thrift transport to communicate with HMS
+/// See:
<https://github.com/apache/thrift/blob/master/doc/specs/thrift-rpc.md#framed-vs-unframed-transport>
+#[derive(Debug, Default)]
+pub enum HmsThriftTransport {
+ /// Use the framed transport
+ Framed,
+ /// Use the buffered transport (default)
+ #[default]
+ Buffered,
+}
+
/// Hive metastore Catalog configuration.
#[derive(Debug, TypedBuilder)]
pub struct HmsCatalogConfig {
address: String,
+ thrift_transport: HmsThriftTransport,
}
struct HmsClient(ThriftHiveMetastoreClient);
@@ -67,12 +79,16 @@ impl HmsCatalog {
)
})?;
- let client = ThriftHiveMetastoreClientBuilder::new("hms")
- .address(address)
- // Framed thrift rpc is not enabled by default in HMS, we use
- // buffered instead.
-
.make_codec(volo_thrift::codec::default::DefaultMakeCodec::buffered())
- .build();
+ let builder =
ThriftHiveMetastoreClientBuilder::new("hms").address(address);
+
+ let client = match &config.thrift_transport {
+ HmsThriftTransport::Framed => builder
+
.make_codec(volo_thrift::codec::default::DefaultMakeCodec::framed())
+ .build(),
+ HmsThriftTransport::Buffered => builder
+
.make_codec(volo_thrift::codec::default::DefaultMakeCodec::buffered())
+ .build(),
+ };
Ok(Self {
config,