fix: resolve batched service header columns - #2729
Lenin Mookiah (leninworld) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey Lenin Mookiah (@leninworld) 👋! We use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
To test your commit locally, please follow our guild on building from source. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues remain, and all assessments indicate approval readiness.
Review effort: Lite
Findings: None
What changed in this PR
Fixes batched Cognitive Service authentication by resolving credentials and headers from batched values while preserving payload arrays.
Changes:
- Adds batch-aware credential and header-map resolution.
- Updates Fabric fallback handling and validates incompatible types.
- Adds regression tests and documents batch credential behavior.
| File | Description |
|---|---|
docs/Explore Algorithms/AI Services/Advanced Usage - Async, Batching, and Multi-Key.ipynb |
Documents per-batch credential behavior. |
cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/CognitiveServiceBaseSuite.scala |
Tests batching, fallback, validation, and payload preservation. |
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/ServiceHeaderValues.scala |
Resolves and validates batched header values. |
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/CognitiveServiceBase.scala |
Applies batch-aware authentication and header resolution. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Related Issues/PRs
Fixes #2064
What changes are proposed in this pull request?
Automatically batched Cognitive Service transformers now resolve request-header service parameters from the batched values instead of casting the entire Spark array to a scalar.
Batching behavior is otherwise unchanged. No warning is emitted for multiple distinct credentials within one batch.
How is this patch tested?
Local validation with JDK 11 and Spark 3.5.0:
cognitive/Test/compilepassed.CognitiveServiceBaseSuite: 12/12 passed, covering batched string/map headers, null and blank credentials, Fabric fallback, invalid element types, public batching/flattening, and payload isolation.Docker integration used Spark 3.5.1, Java 11.0.22, and Linux x86-64. A real
TextSentimentstage loaded the branch-built Cognitive JAR and called a credential-free local mock endpoint. Two rows were combined into one request, the first usable subscription key authenticated the batch, andFlattenBatchpreserved both original row keys.Validation evidence
Local compilation, style, and focused Scala regression suite:
Docker Spark end-to-end regression using the branch-built artifact:
Repaired
TextSentimentfunction loaded and transformed the automatically batchedsubscriptionKeyCol:Does this PR change any dependencies?
Does this PR add a new feature? If so, have you added samples on website?