AnzhiZhang commented on issue #3562: URL: https://github.com/apache/texera/issues/3562#issuecomment-3193973885
I have talked to @aicam, and he agreed that I can take this issue. This is the comparison function used in the frontend. https://github.com/apache/texera/blob/d03f3bffafe87eb37f6f578bb83cb5648e741082/core/gui/src/app/common/util/workflow-compilation-utils.ts#L22-L34 However, this function only performs shallow equality using JavaScript object reference comparison `===`. Even if two schema arrays contain attributes with identical content, as long as they are two different object instances, the comparison will evaluate to false. If we log the schemas and the comparison result ``` console.log(schemas[0]); console.log(schemas[1]); console.log(schemas[0] === schemas[1]); ``` <img width="649" height="164" alt="Image" src="https://github.com/user-attachments/assets/fd90a75e-dca4-4296-b398-c9a0a07f9b19" /> To fix, just need to compare these schema attribute objects are equal, the most convenient way is using JSON. ```ts export function areAllPortSchemasEqual(schemas: (PortSchema | undefined)[]): boolean { if (schemas.length <= 1) { return true; } if (schemas[0] === undefined) { return schemas.every(schema => schema === undefined); } else { const firstSchemaString = JSON.stringify(schemas[0]); return schemas.every(schema => schema !== undefined && JSON.stringify(schema) === firstSchemaString); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
