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
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ project(':iceberg-orc') {
}

project(':iceberg-parquet') {
test {
useJUnitPlatform()
}
dependencies {
implementation project(path: ':iceberg-bundled-guava', configuration: 'shadow')
api project(':iceberg-api')
Expand Down
7 changes: 4 additions & 3 deletions parquet/src/test/java/org/apache/iceberg/TestHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
*/
package org.apache.iceberg;

import static org.assertj.core.api.Assertions.assertThatThrownBy;

import java.util.concurrent.Callable;
import org.apache.avro.AvroRuntimeException;
import org.apache.avro.generic.GenericRecord;
import org.assertj.core.api.AbstractThrowableAssert;
import org.assertj.core.api.Assertions;

public class TestHelpers {

Expand All @@ -42,7 +43,7 @@ public static void assertThrows(
String containedInMessage,
Callable callable) {
AbstractThrowableAssert<?, ? extends Throwable> check =
Assertions.assertThatThrownBy(callable::call).as(message).isInstanceOf(expected);
assertThatThrownBy(callable::call).as(message).isInstanceOf(expected);
if (null != containedInMessage) {
check.hasMessageContaining(containedInMessage);
}
Expand All @@ -62,7 +63,7 @@ public static void assertThrows(
String containedInMessage,
Runnable runnable) {
AbstractThrowableAssert<?, ? extends Throwable> check =
Assertions.assertThatThrownBy(runnable::run).as(message).isInstanceOf(expected);
assertThatThrownBy(runnable::run).as(message).isInstanceOf(expected);
if (null != containedInMessage) {
check.hasMessageContaining(containedInMessage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class TestParquetReadProjection extends TestReadProjection {
protected GenericData.Record writeAndRead(
String desc, Schema writeSchema, Schema readSchema, GenericData.Record record)
throws IOException {
File file = temp.newFile(desc + ".parquet");
File file = temp.resolve(desc + ".parquet").toFile();
file.delete();

try (FileAppender<GenericData.Record> appender =
Expand Down
210 changes: 116 additions & 94 deletions parquet/src/test/java/org/apache/iceberg/avro/TestReadProjection.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Map;
import java.util.UUID;
Expand All @@ -33,29 +34,25 @@
import org.apache.iceberg.io.FileAppender;
import org.apache.iceberg.relocated.com.google.common.collect.Lists;
import org.apache.parquet.schema.MessageType;
import org.junit.rules.TemporaryFolder;

/** Utilities for tests that need to write Parquet files. */
class ParquetWritingTestUtils {

private ParquetWritingTestUtils() {}

static File writeRecords(TemporaryFolder temp, Schema schema, GenericData.Record... records)
static File writeRecords(Path temp, Schema schema, GenericData.Record... records)
throws IOException {
return writeRecords(temp, schema, Collections.emptyMap(), null, records);
}

static File writeRecords(
TemporaryFolder temp,
Schema schema,
Map<String, String> properties,
GenericData.Record... records)
Path temp, Schema schema, Map<String, String> properties, GenericData.Record... records)
throws IOException {
return writeRecords(temp, schema, properties, null, records);
}

static File writeRecords(
TemporaryFolder temp,
Path temp,
Schema schema,
Map<String, String> properties,
Function<MessageType, ParquetValueWriter<?>> createWriterFunc,
Expand Down Expand Up @@ -97,8 +94,8 @@ static long write(
return len;
}

static File createTempFile(TemporaryFolder temp) throws IOException {
File tmpFolder = temp.newFolder("parquet");
static File createTempFile(Path temp) throws IOException {
File tmpFolder = temp.resolve("parquet").toFile();
String filename = UUID.randomUUID().toString();
return new File(tmpFolder, FileFormat.PARQUET.addExtension(filename));
}
Expand Down
Loading