Xuanwo commented on code in PR #174:
URL: https://github.com/apache/iceberg-rust/pull/174#discussion_r1477279307


##########
crates/catalog/hms/src/catalog.rs:
##########
@@ -71,19 +54,29 @@ impl Debug for HmsCatalog {
 impl HmsCatalog {
     /// Create a new hms catalog.
     pub fn new(config: HmsCatalogConfig) -> Result<Self> {
-        let mut channel = thrift::transport::TTcpChannel::new();
-        channel
-            .open(config.address.as_str())
-            .map_err(from_thrift_error)?;
-        let (i_chan, o_chan) = channel.split().map_err(from_thrift_error)?;
-        let i_chan = TBufferedReadTransport::new(i_chan);
-        let o_chan = TBufferedWriteTransport::new(o_chan);
-        let i_proto = TBinaryInputProtocol::new(i_chan, true);
-        let o_proto = TBinaryOutputProtocol::new(o_chan, true);
-        let client = ThriftHiveMetastoreSyncClient::new(i_proto, o_proto);
+        let address = config
+            .address
+            .as_str()
+            .to_socket_addrs()
+            .map_err(from_io_error)?
+            .next()
+            .ok_or_else(|| {
+                Error::new(
+                    ErrorKind::Unexpected,
+                    format!("invalid address: {}", config.address),
+                )
+            })?;
+
+        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())

Review Comment:
   I agree we should make this setting available to users, though I believe 
it's a lower priority. I've created an issue at 
https://github.com/apache/iceberg-rust/issues/188 to keep track of this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to