Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status

Current state: "Under Discussion"

Discussion thread

JIRA: here (<- link to )

...

Discussion threadhttps://lists.apache.org/thread/v0b8pfh0o7rwtlok2mfs5s6q9w5vw8h6
Vote thread
JIRA

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-28706

Release1.16


Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

@PublicEvolving
public interface SupportsDynamicFiltering {

  /**
* applyReturns the candidate filter fields intothis thepartition table source, andsupported. return the accepted fields. The
* data corresponding the filter fields will be provided in runtime, which can be used to filter
* the partitions and the input data.
*/
List<String>This method can tell the
* planner which fields can be used as dynamic filtering fields, the planner will pick some
* fields from the returned fields based on the query, and create dynamic filtering operator.
*/
List<String> listAcceptedFilterFields();

/**
* Applies the candidate filter fields into the table source. The data corresponding the filter
* fields will be provided in runtime, which can be used to filter the partitions or the input
* data.
*
* <p>NOTE: the candidate filter fields are always from the result of {@link
* #listAcceptedFilterFields()}.
*/
void applyDynamicFiltering(List<String> candidateFilterFields);
}

...

    @Override
public void handleSourceEvent(int subtaskId, int attemptNumber, SourceEvent sourceEventSourceEvent sourceEvent) {
if (sourceEvent instanceof DynamicFilteringEvent) {
if LOG.info(sourceEvent"Received instanceof DynamicFilteringEvent): {}", subtaskId);
createSplitAssigner(((DynamicFilteringEvent) sourceEvent).getData());
}
}

private void createSplitAssigner(@Nullable DynamicFilteringData dynamicFilteringData) {
DynamicFileEnumerator fileEnumerator = fileEnumeratorFactory.create();
if (dynamicFilteringData != null) {
fileEnumerator.setDynamicFilteringData(dynamicFilteringData);
}
// create splits
splitAssigner = splitAssignerFactory.create(splits);
}
}


  • DynamicFileEnumerator will do the partition filter of all partitions based on DynamicFilteringData, the pseudocode for HiveSourceDynamicFileEnumerator looks like:

...