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-7299-c7dd5ae427b2fc7a09331fa311261e1ee2a7c2c2
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 133da7bbd6b27c7fba17a6ab894793745bf0c873
Author: Prateek Ganigi <[email protected]>
AuthorDate: Mon Aug 10 15:19:57 2026 -0700

    fix(workflow-operator): report a clear error when a configured HF 
image/audio column is missing (#7299)
    
    ### What changes were proposed in this PR?
    
    If the HuggingFace operator's `Input Image Column` (or `Input Audio
    Column`) named a column that doesn't exist in the input table,
    `use_image_column` / `use_audio_column` silently became false and the
    user got the misleading "No image source. Set an Input Image Column or
    upload an image.", even though they *had* set one, just misspelled it.
    
    This distinguishes the two cases: at that point there's no upload and
    the column resolved to false, which when a column name is actually
    configured, can only mean it isn't in the table. So a non-empty
    configured column now produces a clear "Input Image Column '<name>' not
    found in the input table. Available columns: [...]" error instead of the
    generic "No image source" message. Same for audio.
    
    ### Any related issues, documentation, discussions?
    
    Closes #7197.
    
    ### How was this PR tested?
    
    `sbt "WorkflowOperator/testOnly
    org.apache.texera.amber.operator.huggingFace.*
    org.apache.texera.amber.util.PythonCodeRawInvalidTextSpec"`: passes (126
    tests). Added a test asserting the generated script produces the "Input
    Image/Audio Column '...' not found" errors;
    `PythonCodeRawInvalidTextSpec` py-compiles the generated Python (guards
    the added nested indentation). scalafmt clean.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    This PR was co-authored with Claude Opus 4.8 in compliance with ASF
    policy.
---
 .../huggingFace/codegen/HuggingFaceCodegenBase.scala     | 16 ++++++++++++++--
 .../huggingFace/HuggingFaceInferenceOpDescSpec.scala     |  7 +++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/codegen/HuggingFaceCodegenBase.scala
 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/codegen/HuggingFaceCodegenBase.scala
index 613a77aab3..e37d4f30e4 100644
--- 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/codegen/HuggingFaceCodegenBase.scala
+++ 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/codegen/HuggingFaceCodegenBase.scala
@@ -572,7 +572,13 @@ object HuggingFaceCodegenBase {
        |        audio_error = None
        |        if task in image_tasks and not use_image_column:
        |            if not has_image_upload:
-       |                image_error = "No image source. Set an Input Image 
Column or upload an image."
+       |                if self.INPUT_IMAGE_COLUMN and 
str(self.INPUT_IMAGE_COLUMN).strip():
+       |                    image_error = (
+       |                        f"Input Image Column 
'{self.INPUT_IMAGE_COLUMN}' not found in the input table. "
+       |                        f"Available columns: {list(table.columns)}"
+       |                    )
+       |                else:
+       |                    image_error = "No image source. Set an Input Image 
Column or upload an image."
        |            else:
        |                try:
        |                    image_bytes = self._read_image_input()
@@ -580,7 +586,13 @@ object HuggingFaceCodegenBase {
        |                    image_error = f"Could not read image input 
({type(e).__name__}: {e})"
        |        if task in audio_only_tasks and not use_audio_column:
        |            if not has_audio_upload:
-       |                audio_error = "No audio source. Set an Input Audio 
Column or upload audio."
+       |                if self.INPUT_AUDIO_COLUMN and 
str(self.INPUT_AUDIO_COLUMN).strip():
+       |                    audio_error = (
+       |                        f"Input Audio Column 
'{self.INPUT_AUDIO_COLUMN}' not found in the input table. "
+       |                        f"Available columns: {list(table.columns)}"
+       |                    )
+       |                else:
+       |                    audio_error = "No audio source. Set an Input Audio 
Column or upload audio."
        |            else:
        |                try:
        |                    audio_bytes = self._read_audio_input()
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 439b111fae..b006ed4b0c 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
@@ -692,6 +692,13 @@ class HuggingFaceInferenceOpDescSpec extends AnyFlatSpec 
with Matchers {
       .asText() shouldBe "password"
   }
 
+  it should "report a clear error when a configured image/audio column is 
missing from the input table" in {
+    val code = makeDesc().generatePythonCode()
+    code should include("Input Image Column '")
+    code should include("Input Audio Column '")
+    code should include("not found in the input table")
+  }
+
   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)

Reply via email to