nastra commented on code in PR #12301: URL: https://github.com/apache/iceberg/pull/12301#discussion_r1961721456
########## api/src/test/java/org/apache/iceberg/TestFileFormat.java: ########## @@ -0,0 +1,56 @@ +/* + * 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; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.FieldSource; + +class TestFileFormat { + + private static final Object[][] FILE_NAMES = + new Object[][] { + // Files with format + {"file.puffin", FileFormat.PUFFIN}, Review Comment: > Can you double-check? I've undone the fix locally and get these test failures, all with out-of-bounds indexes: > > <img alt="Screenshot 2025-02-18 at 18 00 49" width="1511" src="https://private-user-images.githubusercontent.com/7870972/414390892-c1824754-475d-4efd-a193-f301761d8b06.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NzMxNzcsIm5iZiI6MTczOTk3Mjg3NywicGF0aCI6Ii83ODcwOTcyLzQxNDM5MDg5Mi1jMTgyNDc1NC00NzVkLTRlZmQtYTE5My1mMzAxNzYxZDhiMDYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTlUMTM0NzU3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjY3ODlhZjM4NzNmNTYxMTA3YjFmYTAxZmEyMGIwZDY3M2I3MjRlZDE2NjNlNzVlMjBiYzc4NDhkYWIyNjUzOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.M5g-slXiMpHxS9gZMc51AdkpwXkNvQvWSoiOG02-ZHc"> > E.g., for the `file.csv` case: > > * It goes through the list of file formats in enum order, the last is `metadata.json` with 13 characters > * From length of `file.csv` (8 characters), subtract 13 characters for `.metadata.json` and 1 for the dot > * Your start index is -6 and you get an `IndexOutOfBoundsException` Yes I'm aware of that. My point is that we should just add some test cases where we're expecting a valid `FileFormat` to show that the same issue happens e.g. with `x.orc` too and not just unsupported file formats like csv. @rshkv can you please add ``` {"x.parquet", FileFormat.PARQUET}, {"x.puffin", FileFormat.PUFFIN}, {"x.orc", FileFormat.ORC}, {"x.avro", FileFormat.AVRO}, ``` in the right order to the argument list? -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org