You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by gi...@apache.org on 2026/08/06 22:45:06 UTC

(texera) branch gh-readonly-queue/main/pr-7298-5b2e8667854e30a7abff4f2bb4e5aba55526c020 created (now 1b61a0e46b)

This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-7298-5b2e8667854e30a7abff4f2bb4e5aba55526c020
in repository https://gitbox.apache.org/repos/asf/texera.git


      at 1b61a0e46b fix(workflow-operator): give a clear error when the HF result column collides with an input column (#7298)

This branch includes the following new commits:

     new 1b61a0e46b fix(workflow-operator): give a clear error when the HF result column collides with an input column (#7298)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(texera) 01/01: fix(workflow-operator): give a clear error when the HF result column collides with an input column (#7298)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-7298-5b2e8667854e30a7abff4f2bb4e5aba55526c020
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 1b61a0e46b087172d56bbf9a01eaa0cb91845eb6
Author: Prateek Ganigi <91...@users.noreply.github.com>
AuthorDate: Thu Aug 6 13:24:10 2026 -0700

    fix(workflow-operator): give a clear error when the HF result column collides with an input column (#7298)
    
    ### What changes were proposed in this PR?
    
    If the HuggingFace operator's Result Column Name matches an existing
    input column, `getOutputSchemas` reached `Schema.add`, which threw a
    generic `RuntimeException("Attribute name '...' already exists in the
    schema")`, which is unhelpful, and it doesn't tell the user what to do.
    
    This adds a pre-check in `getOutputSchemas`: if the resolved result
    column already exists in the input schema, it throws a clear, actionable
    message ("Result column '...' already exists in the input table. Choose
    a different Result Column Name.") instead of the opaque internal error.
    
    ### Any related issues, documentation, discussions?
    
    Closes #7198.
    
    ### How was this PR tested?
    
    `sbt "WorkflowOperator/testOnly
    org.apache.texera.amber.operator.huggingFace.*"`: passes (124 tests).
    Added a test that a colliding result column produces the clear "Result
    column '...'" error. scalafmt clean.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    This PR was not authored or co-authored using generative AI tooling.
---
 .../operator/huggingFace/HuggingFaceInferenceOpDesc.scala | 15 ++++++++++++---
 .../huggingFace/HuggingFaceInferenceOpDescSpec.scala      |  9 +++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDesc.scala b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDesc.scala
index 590b509787..cf506fb760 100644
--- a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDesc.scala
+++ b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDesc.scala
@@ -262,9 +262,18 @@ class HuggingFaceInferenceOpDesc extends PythonOperatorDescriptor {
 
   override def getOutputSchemas(
       inputSchemas: Map[PortIdentity, Schema]
-  ): Map[PortIdentity, Schema] =
+  ): Map[PortIdentity, Schema] = {
+    val inputSchema = inputSchemas.values.head
+    val resultCol = resolvedResultColumn
+    if (inputSchema.containsAttribute(resultCol)) {
+      throw new RuntimeException(
+        s"Result column '$resultCol' already exists in the input table. " +
+          "Choose a different Result Column Name."
+      )
+    }
     Map(
-      operatorInfo.outputPorts.head.id -> inputSchemas.values.head
-        .add(resolvedResultColumn, AttributeType.STRING)
+      operatorInfo.outputPorts.head.id -> inputSchema
+        .add(resultCol, AttributeType.STRING)
     )
+  }
 }
diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDescSpec.scala
index b6b0355435..bf6549fb80 100644
--- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDescSpec.scala
+++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDescSpec.scala
@@ -687,4 +687,13 @@ class HuggingFaceInferenceOpDescSpec extends AnyFlatSpec with Matchers {
       .path("type")
       .asText() shouldBe "password"
   }
+
+  it should "give a clear error when the result column collides with an input column" in {
+    val desc = makeDesc(resultColumn = "prompt")
+    val inputSchema = Schema().add("prompt", AttributeType.STRING)
+    val ex = intercept[RuntimeException] {
+      desc.getOutputSchemas(Map(PortIdentity(0) -> inputSchema))
+    }
+    ex.getMessage should include("Result column 'prompt'")
+  }
 }