flyrain commented on code in PR #402:
URL: https://github.com/apache/polaris/pull/402#discussion_r1819764638


##########
polaris-service/src/test/java/org/apache/polaris/service/catalog/io/TestFileIO.java:
##########
@@ -0,0 +1,145 @@
+/*
+ * 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.polaris.service.catalog.io;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Supplier;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.ManifestFile;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.io.InputFile;
+import org.apache.iceberg.io.OutputFile;
+
+/**
+ * File IO wrapper used for tests. It measures the number of bytes read, files 
written, and files
+ * deleted. It can inject exceptions during InputFile and OutputFile creation.
+ */
+public class TestFileIO implements FileIO {
+  private final FileIO io;
+
+  // When present, the following will be used to throw exceptions at various 
parts of the IO
+  private final Optional<Supplier<RuntimeException>> 
newInputFileExceptionSupplier;
+  private final Optional<Supplier<RuntimeException>> 
newOutputFileExceptionSupplier;

Review Comment:
   Makes sense to pursue null-safety. The `Optional` isn't designed for that 
though. It works in a clumsy way to achieve that, you will have to add 
`Optional` to the signatures of all callers, and serialization won't work IIUC. 
It doesn't quite matter here anyway. I'm fine with either one.
   
   



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

Reply via email to