rdblue commented on code in PR #2639: URL: https://github.com/apache/iceberg/pull/2639#discussion_r1071456336
########## core/src/test/java/org/apache/iceberg/encryption/EncryptionTestUtils.java: ########## @@ -0,0 +1,108 @@ +/* + * 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. + */ +package org.apache.iceberg.encryption; + +import static org.apache.iceberg.Files.localInput; +import static org.apache.iceberg.Files.localOutput; + +import java.io.File; +import org.apache.iceberg.io.InputFile; +import org.apache.iceberg.io.OutputFile; +import org.apache.iceberg.io.PositionOutputStream; +import org.apache.iceberg.io.SeekableInputStream; + +public class EncryptionTestUtils { + public static class EncryptedLocalOutputFile implements OutputFile, NativelyEncryptedFile { Review Comment: After looking at `NativelyEncryptedFile` and the surrounding code, I think that it is something we should remove. I understand the motivation to use special `InputFile` and `OutputFile` instances to pass encryption information around, but this is just too hacky because it passes configuration to the read and write builders in a way that is not at all obvious. I think that the builders should accept encryption parameters and that we should use those for testing rather than creating instances like this. After taking the step to pass encryption options to the builders directly, there isn't that much code to bridge. Taking a look at Spark's `BaseRowReader`, for example, there's no need to pass the file, format, start, length, residual, and encryption key metadata separately. It would be much better to simply pass those as the original `FileScanTask`. Cleaning up a few cases like that seems worth the changes and makes the API easier to test and understand. -- 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]
