Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzelin committed Dec 16, 2024
1 parent d687110 commit d71e946
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,19 @@ public static List<Predicate> devolveDataFilters(
return Optional.empty();
}

List<Object> evolvedLiterals =
List<Object> devolvedLiterals =
CastExecutors.safelyCastLiteralsWithNumericEvolution(
predicate, dataField.type());

return evolvedLiterals == null
return devolvedLiterals == null
? Optional.empty()
: Optional.of(
new LeafPredicate(
predicate.function(),
dataField.type(),
indexOf(dataField, idToDataFields),
dataField.name(),
evolvedLiterals));
devolvedLiterals));
};

for (Predicate predicate : filters) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ public Predicate tryDevolveFilter(long dataSchemaId, Predicate filter) {
if (tableSchemaId == dataSchemaId) {
return filter;
}
List<Predicate> evolved =
List<Predicate> devolved =
Objects.requireNonNull(
SchemaEvolutionUtil.devolveDataFilters(
schemaFields.apply(tableSchemaId),
schemaFields.apply(dataSchemaId),
Collections.singletonList(filter)));
return evolved.isEmpty() ? null : evolved.get(0);
return devolved.isEmpty() ? null : devolved.get(0);
}

public List<DataField> tableDataFields() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void testCreateDataProjection() {
}

@Test
public void testEvolveDataFilters() {
public void testDevolveDataFilters() {
List<Predicate> predicates = new ArrayList<>();
predicates.add(
new LeafPredicate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.paimon.flink;

import org.apache.paimon.casting.CastExecutors;
import org.apache.paimon.testutils.junit.parameterized.ParameterizedTestExtension;
import org.apache.paimon.testutils.junit.parameterized.Parameters;

Expand All @@ -31,7 +32,7 @@

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

/** TODO all file format tests. */
/** ITCase for {@link CastExecutors#safelyCastLiteralsWithNumericEvolution}. */
@ExtendWith(ParameterizedTestExtension.class)
public class FilterPushdownWithSchemaChangeITCase extends CatalogITCaseBase {

Expand Down

0 comments on commit d71e946

Please sign in to comment.