Skip to content
Merged
Show file tree
Hide file tree
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
32 changes: 24 additions & 8 deletions crates/catalog/hms/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use std::sync::Arc;
use anyhow::anyhow;
use async_trait::async_trait;
use hive_metastore::{
ThriftHiveMetastoreClient, ThriftHiveMetastoreClientBuilder,
ThriftHiveMetastoreGetDatabaseException, ThriftHiveMetastoreGetTableException,
GetTableRequest, ThriftHiveMetastoreClient, ThriftHiveMetastoreClientBuilder,
ThriftHiveMetastoreGetDatabaseException, ThriftHiveMetastoreGetTableReqException,
};
use iceberg::encryption::kms::{KeyManagementClient, KmsClientFactory};
use iceberg::io::{FileIO, FileIOBuilder, StorageFactory};
Expand Down Expand Up @@ -583,10 +583,15 @@ impl Catalog for HmsCatalog {
let hive_table = self
.client
.0
.get_table(db_name.clone().into(), table.name.clone().into())
.get_table_req(GetTableRequest {
db_name: db_name.clone().into(),
tbl_name: table.name.clone().into(),
..Default::default()
})
.await
.map(from_thrift_exception)
.map_err(from_thrift_error)??;
.map_err(from_thrift_error)??
.table;

let metadata_location = get_metadata_location(&hive_table.parameters)?;

Expand Down Expand Up @@ -661,12 +666,18 @@ impl Catalog for HmsCatalog {
let resp = self
.client
.0
.get_table(db_name.into(), table_name.into())
.get_table_req(GetTableRequest {
db_name: db_name.into(),
tbl_name: table_name.into(),
..Default::default()
})
.await;

match resp {
Ok(MaybeException::Ok(_)) => Ok(true),
Ok(MaybeException::Exception(ThriftHiveMetastoreGetTableException::O2(_))) => Ok(false),
Ok(MaybeException::Exception(ThriftHiveMetastoreGetTableReqException::O2(_))) => {
Ok(false)
}
Ok(MaybeException::Exception(exception)) => Err(Error::new(
ErrorKind::Unexpected,
"Operation failed for hitting thrift error".to_string(),
Expand Down Expand Up @@ -698,10 +709,15 @@ impl Catalog for HmsCatalog {
let mut tbl = self
.client
.0
.get_table(src_dbname.clone().into(), src_tbl_name.clone().into())
.get_table_req(GetTableRequest {
db_name: src_dbname.clone().into(),
tbl_name: src_tbl_name.clone().into(),
..Default::default()
})
.await
.map(from_thrift_exception)
.map_err(from_thrift_error)??;
.map_err(from_thrift_error)??
.table;

tbl.db_name = Some(dest_dbname.into());
tbl.table_name = Some(dest_tbl_name.into());
Expand Down
18 changes: 7 additions & 11 deletions dev/hms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM apache/hive:3.1.3

ENV AWSSDK_VERSION=2.20.18
ENV HADOOP_VERSION=3.1.0
FROM apache/hive:4.2.1

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mirrors change from pyiceberg


USER root

ADD --chmod=644 --checksum=sha256:a18508b9348af095ea41301e439354dbd449e304ac44c6885b2b4fe78de88126 \
https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-aws/${HADOOP_VERSION}/hadoop-aws-${HADOOP_VERSION}.jar \
/opt/hive/lib/hadoop-aws-${HADOOP_VERSION}.jar
ADD --chmod=644 --checksum=sha256:faf78ac4880f56cf52791d84ec1068ce7c66acc4295d580a726104b734c01fcd \
https://repo1.maven.org/maven2/com/amazonaws/aws-java-sdk-bundle/1.11.271/aws-java-sdk-bundle-1.11.271.jar \
/opt/hive/lib/aws-java-sdk-bundle-1.11.271.jar
# Link the hadoop-aws and AWS SDK jars that the image ships into the metastore classpath
RUN ln -s /opt/hadoop/share/hadoop/tools/lib/hadoop-aws-*.jar /opt/hive/lib/ && \
ln -s /opt/hadoop/share/hadoop/tools/lib/bundle-*.jar /opt/hive/lib/

COPY core-site.xml /opt/hadoop/etc/hadoop/core-site.xml
# The entrypoint links this directory into the Hive config directory, over its own core-site.xml
ENV HIVE_CUSTOM_CONF_DIR=/opt/hive/custom-conf
COPY core-site.xml ${HIVE_CUSTOM_CONF_DIR}/core-site.xml

USER hive
Loading