Skip to content

Commit

Permalink
address latest rounds of Eduard's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenzwu committed Jun 19, 2024
1 parent 8a3f349 commit be97ade
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
10 changes: 5 additions & 5 deletions core/src/test/java/org/apache/iceberg/TestDataTaskParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,20 @@ private String snapshotsDataTaskJson() {
}

private void assertDataTaskEquals(StaticDataTask expected, StaticDataTask actual) {
assertThat(expected.schema().asStruct())
assertThat(actual.schema().asStruct())
.as("Schema should match")
.isEqualTo(actual.schema().asStruct());
.isEqualTo(expected.schema().asStruct());

assertThat(expected.projectedSchema().asStruct())
assertThat(actual.projectedSchema().asStruct())
.as("Projected schema should match")
.isEqualTo(actual.projectedSchema().asStruct());
.isEqualTo(expected.projectedSchema().asStruct());

TestContentFileParser.assertContentFileEquals(
expected.metadataFile(), actual.metadataFile(), PartitionSpec.unpartitioned());

List<StructLike> expectedRows = Lists.newArrayList(expected.rows());
List<StructLike> actualRows = Lists.newArrayList(actual.rows());
assertThat(actualRows).hasSize(expectedRows.size());
assertThat(actualRows).hasSameSizeAs(expectedRows);

// all fields are primitive types or map
Schema schema = expected.schema();
Expand Down
14 changes: 2 additions & 12 deletions core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

<<<<<<< HEAD
import com.fasterxml.jackson.databind.JsonNode;
=======
>>>>>>> 58ab1e5e8 (address Eduard's comments)
import org.apache.iceberg.expressions.ExpressionUtil;
import org.apache.iceberg.expressions.Expressions;
import org.apache.iceberg.expressions.ResidualEvaluator;
Expand All @@ -39,13 +35,8 @@ public void testNullArguments() {
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Invalid file scan task: null");

<<<<<<< HEAD
assertThatThrownBy(() -> FileScanTaskParser.fromJson((JsonNode) null, true))
.isInstanceOf(IllegalArgumentException.class)
=======
assertThatThrownBy(() -> FileScanTaskParser.fromJson((String) null, true))
.isInstanceOf(IllegalArgumentException.class)
>>>>>>> 58ab1e5e8 (address Eduard's comments)
.hasMessage("Invalid JSON string for file scan task: null");

assertThatThrownBy(() -> ScanTaskParser.toJson(null))
Expand Down Expand Up @@ -75,8 +66,7 @@ public void testFileScanTaskParserWithoutTaskTypeField(boolean caseSensitive) {
PartitionSpec spec = TestBase.SPEC;
FileScanTask fileScanTask = createFileScanTask(spec, caseSensitive);
FileScanTask deserializedTask =
FileScanTaskParser.
fromJson(fileScanTaskJsonWithoutTaskType(), caseSensitive);
FileScanTaskParser.fromJson(fileScanTaskJsonWithoutTaskType(), caseSensitive);
assertFileScanTaskEquals(fileScanTask, deserializedTask, spec, caseSensitive);
}

Expand Down Expand Up @@ -166,7 +156,7 @@ private static void assertFileScanTaskEquals(
expected.deletes().get(pos), actual.deletes().get(pos), spec);
}

assertThat(expected.schema().sameSchema(actual.schema())).as("Schema should match").isTrue();
assertThat(actual.schema().asStruct()).isEqualTo(expected.schema().asStruct());
assertThat(actual.spec()).isEqualTo(expected.spec());
assertThat(
ExpressionUtil.equivalent(
Expand Down

0 comments on commit be97ade

Please sign in to comment.