[ 
https://issues.apache.org/jira/browse/FLINK-36113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

tiancx updated FLINK-36113:
---------------------------
        Fix Version/s: 1.20.1
    Affects Version/s: 1.20.0
          Description: 
The legacyTransform method in the StreamGraphGenerator class has a judgment: 
the transform instance of PhysicalTransformation is always false
{code:java}
//代码占位符
private Collection<Integer> legacyTransform(Transformation<?> transform) {
    Collection<Integer> transformedIds;
    if (transform instanceof FeedbackTransformation<?>) {
        transformedIds = transformFeedback((FeedbackTransformation<?>) 
transform);
    } else if (transform instanceof CoFeedbackTransformation<?>) {
        transformedIds = transformCoFeedback((CoFeedbackTransformation<?>) 
transform);
    } else if (transform instanceof SourceTransformationWrapper<?>) {
        transformedIds = transform(((SourceTransformationWrapper<?>) 
transform).getInput());
    } else {
        throw new IllegalStateException("Unknown transformation: " + transform);
    }

    if (transform.getBufferTimeout() >= 0) {
        streamGraph.setBufferTimeout(transform.getId(), 
transform.getBufferTimeout());
    } else {
        streamGraph.setBufferTimeout(transform.getId(), getBufferTimeout());
    }

    if (transform.getUid() != null) {
        streamGraph.setTransformationUID(transform.getId(), transform.getUid());
    }
    if (transform.getUserProvidedNodeHash() != null) {
        streamGraph.setTransformationUserHash(
                transform.getId(), transform.getUserProvidedNodeHash());
    }

    if (!streamGraph.getExecutionConfig().hasAutoGeneratedUIDsEnabled()) {
        if (transform instanceof PhysicalTransformation
                && transform.getUserProvidedNodeHash() == null
                && transform.getUid() == null) {
            throw new IllegalStateException(
                    "Auto generated UIDs have been disabled "
                            + "but no UID or hash has been assigned to operator 
"
                            + transform.getName());
        }

    }

    if (transform.getMinResources() != null && 
transform.getPreferredResources() != null) {
        streamGraph.setResources(
                transform.getId(),
                transform.getMinResources(),
                transform.getPreferredResources());
    }

    streamGraph.setManagedMemoryUseCaseWeights(
            transform.getId(),
            transform.getManagedMemoryOperatorScopeUseCaseWeights(),
            transform.getManagedMemorySlotScopeUseCases());

    return transformedIds;
} {code}
If this needs optimization, I am willing to do so

 

  was:
Judgment optimization: The legacyTransform method in the StreamGraphGenerator 
class has a judgment: the transform instance of PhysicalTransformation is 
always false
{code:java}
//代码占位符
private Collection<Integer> legacyTransform(Transformation<?> transform) {
    Collection<Integer> transformedIds;
    if (transform instanceof FeedbackTransformation<?>) {
        transformedIds = transformFeedback((FeedbackTransformation<?>) 
transform);
    } else if (transform instanceof CoFeedbackTransformation<?>) {
        transformedIds = transformCoFeedback((CoFeedbackTransformation<?>) 
transform);
    } else if (transform instanceof SourceTransformationWrapper<?>) {
        transformedIds = transform(((SourceTransformationWrapper<?>) 
transform).getInput());
    } else {
        throw new IllegalStateException("Unknown transformation: " + transform);
    }

    if (transform.getBufferTimeout() >= 0) {
        streamGraph.setBufferTimeout(transform.getId(), 
transform.getBufferTimeout());
    } else {
        streamGraph.setBufferTimeout(transform.getId(), getBufferTimeout());
    }

    if (transform.getUid() != null) {
        streamGraph.setTransformationUID(transform.getId(), transform.getUid());
    }
    if (transform.getUserProvidedNodeHash() != null) {
        streamGraph.setTransformationUserHash(
                transform.getId(), transform.getUserProvidedNodeHash());
    }

    if (!streamGraph.getExecutionConfig().hasAutoGeneratedUIDsEnabled()) {
        if (transform instanceof PhysicalTransformation
                && transform.getUserProvidedNodeHash() == null
                && transform.getUid() == null) {
            throw new IllegalStateException(
                    "Auto generated UIDs have been disabled "
                            + "but no UID or hash has been assigned to operator 
"
                            + transform.getName());
        }

    }

    if (transform.getMinResources() != null && 
transform.getPreferredResources() != null) {
        streamGraph.setResources(
                transform.getId(),
                transform.getMinResources(),
                transform.getPreferredResources());
    }

    streamGraph.setManagedMemoryUseCaseWeights(
            transform.getId(),
            transform.getManagedMemoryOperatorScopeUseCaseWeights(),
            transform.getManagedMemorySlotScopeUseCases());

    return transformedIds;
} {code}
I'm willing to optimize this.

 

          Environment:     (was: master)
             Priority: Minor  (was: Major)

> Condition 'transform instanceof PhysicalTransformation' is always 'false' 
> --------------------------------------------------------------------------
>
>                 Key: FLINK-36113
>                 URL: https://issues.apache.org/jira/browse/FLINK-36113
>             Project: Flink
>          Issue Type: Improvement
>    Affects Versions: 1.20.0
>            Reporter: tiancx
>            Priority: Minor
>             Fix For: 1.20.1
>
>         Attachments: Snipaste_2024-08-21_01-29-52.png
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The legacyTransform method in the StreamGraphGenerator class has a judgment: 
> the transform instance of PhysicalTransformation is always false
> {code:java}
> //代码占位符
> private Collection<Integer> legacyTransform(Transformation<?> transform) {
>     Collection<Integer> transformedIds;
>     if (transform instanceof FeedbackTransformation<?>) {
>         transformedIds = transformFeedback((FeedbackTransformation<?>) 
> transform);
>     } else if (transform instanceof CoFeedbackTransformation<?>) {
>         transformedIds = transformCoFeedback((CoFeedbackTransformation<?>) 
> transform);
>     } else if (transform instanceof SourceTransformationWrapper<?>) {
>         transformedIds = transform(((SourceTransformationWrapper<?>) 
> transform).getInput());
>     } else {
>         throw new IllegalStateException("Unknown transformation: " + 
> transform);
>     }
>     if (transform.getBufferTimeout() >= 0) {
>         streamGraph.setBufferTimeout(transform.getId(), 
> transform.getBufferTimeout());
>     } else {
>         streamGraph.setBufferTimeout(transform.getId(), getBufferTimeout());
>     }
>     if (transform.getUid() != null) {
>         streamGraph.setTransformationUID(transform.getId(), 
> transform.getUid());
>     }
>     if (transform.getUserProvidedNodeHash() != null) {
>         streamGraph.setTransformationUserHash(
>                 transform.getId(), transform.getUserProvidedNodeHash());
>     }
>     if (!streamGraph.getExecutionConfig().hasAutoGeneratedUIDsEnabled()) {
>         if (transform instanceof PhysicalTransformation
>                 && transform.getUserProvidedNodeHash() == null
>                 && transform.getUid() == null) {
>             throw new IllegalStateException(
>                     "Auto generated UIDs have been disabled "
>                             + "but no UID or hash has been assigned to 
> operator "
>                             + transform.getName());
>         }
>     }
>     if (transform.getMinResources() != null && 
> transform.getPreferredResources() != null) {
>         streamGraph.setResources(
>                 transform.getId(),
>                 transform.getMinResources(),
>                 transform.getPreferredResources());
>     }
>     streamGraph.setManagedMemoryUseCaseWeights(
>             transform.getId(),
>             transform.getManagedMemoryOperatorScopeUseCaseWeights(),
>             transform.getManagedMemorySlotScopeUseCases());
>     return transformedIds;
> } {code}
> If this needs optimization, I am willing to do so
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to