Skip to content

Commit

Permalink
Remove unnecessary optional in CastTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
krvikash committed Oct 10, 2024
1 parent 50ec6fb commit 346a6cc
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Optional;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -57,12 +56,12 @@ public void testProjectionPushdownWithCast()
public void testJoinPushdownWithCast()
{
for (CastTestCase testCase : supportedCastTypePushdown()) {
assertThat(query("SELECT l.id FROM %s l JOIN %s r ON CAST(l.%s AS %s) = r.%s".formatted(leftTable(), rightTable(), testCase.sourceColumn(), testCase.castType(), testCase.targetColumn().orElseThrow())))
assertThat(query("SELECT l.id FROM %s l JOIN %s r ON CAST(l.%s AS %s) = r.%s".formatted(leftTable(), rightTable(), testCase.sourceColumn(), testCase.castType(), testCase.targetColumn())))
.isFullyPushedDown();
}

for (CastTestCase testCase : unsupportedCastTypePushdown()) {
assertThat(query("SELECT l.id FROM %s l JOIN %s r ON CAST(l.%s AS %s) = r.%s".formatted(leftTable(), rightTable(), testCase.sourceColumn(), testCase.castType(), testCase.targetColumn().orElseThrow())))
assertThat(query("SELECT l.id FROM %s l JOIN %s r ON CAST(l.%s AS %s) = r.%s".formatted(leftTable(), rightTable(), testCase.sourceColumn(), testCase.castType(), testCase.targetColumn())))
.joinIsNotFullyPushedDown();
}
}
Expand All @@ -77,7 +76,7 @@ public void testInvalidCast()
}
}

public record CastTestCase(String sourceColumn, String castType, Optional<String> targetColumn)
public record CastTestCase(String sourceColumn, String castType, String targetColumn)
{
public CastTestCase
{
Expand Down
Loading

0 comments on commit 346a6cc

Please sign in to comment.