You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/21 15:21:03 UTC

[GitHub] [arrow] andersonm-ibm commented on a change in pull request #10450: ARROW-9947: [Python] High-level Python API for Parquet encryption of files.

andersonm-ibm commented on a change in pull request #10450:
URL: https://github.com/apache/arrow/pull/10450#discussion_r655476565



##########
File path: cpp/src/arrow/python/parquet_encryption.cc
##########
@@ -0,0 +1,75 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "arrow/python/parquet_encryption.h"
+
+namespace arrow {
+namespace py {
+namespace parquet {
+namespace encryption {
+
+PyKmsClient::PyKmsClient(PyObject* handler, PyKmsClientVtable vtable)
+    : handler_(handler), vtable_(std::move(vtable)) {
+  Py_INCREF(handler);
+}
+
+PyKmsClient::~PyKmsClient() {}
+
+std::string PyKmsClient::WrapKey(const std::string& key_bytes,
+                                 const std::string& master_key_identifier) {
+  std::string wrapped;
+  auto st = SafeCallIntoPython([&]() -> Status {
+    vtable_.wrap_key(handler_.obj(), key_bytes, master_key_identifier, &wrapped);
+    return Status::OK();

Review comment:
       If I understand correctly the SafeCallIntoPython(), it preserves the current thread's error status, so if the Python method raises an exception, it will be preserved and the Python caller will eventually get it.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org