anishshiva7 opened a new pull request, #9658:
URL: https://github.com/apache/texera/pull/9658

   ### What changes were proposed in this PR?
   
   **Root cause:** Type Casting looked a column up by its exact name 
(`attr.getName == attribute` in `SchemaCasting`, an exact-key `Map` lookup in 
`tupleCasting`), while other operators go through `Schema`, which ignores case. 
A unit naming `N` against a column `n` silently cast nothing.
   
   ```
   Before:  unit "N" -> STRING over column n:INTEGER  ->  n stays INTEGER, no 
error
   After:   unit "N" -> STRING over column n:INTEGER  ->  n becomes STRING 
(name stays "n")
   ```
   
   | Place | Change |
   | --- | --- |
   | `AttributeTypeUtils.SchemaCasting` | matches with `equalsIgnoreCase`; 
rebuilds the column under the **table's** name, not the setting's spelling |
   | `AttributeTypeUtils.tupleCasting` | looks the target type up by lowercased 
name |
   | `TypeCastingOpExec` | keys the unit map by lowercased name, so with `N` 
and `n` both set, the last unit wins, as in the schema fold |
   | `TypeCastingOpDesc.generateStandaloneCode` (#9035) | groups units by 
lowercased name and writes each cast against the table's column name, so the 
exported script matches the engine |
   
   `SchemaCasting` is also used by Python Lambda Function. Its column picker 
supplies the schema's exact name, so its behavior is unchanged in practice. A 
Lambda unit naming a column in another case was already inconsistent: its 
generated Python writes `tuple_['N']`, a new key.
   
   ### Any related issues, documentation, discussions?
   
   Closes #9036. Follows up on the standalone export in #9035, which the issue 
notes should switch along with the engine.
   
   ### How was this PR tested?
   
   New and updated tests, covering positive cases (different case, mixed case, 
the last of two units winning) and negative ones (no column in any case, empty 
name):
   
   | Spec | Tests |
   | --- | --- |
   | `AttributeTypeUtilsSpec` | `SchemaCasting matches the column ignoring case 
and keeps the table's name`, `SchemaCasting leaves the schema unchanged when no 
column has the name in any case`, `tupleCasting matches a target column 
ignoring case`, `tupleCasting leaves a column whose name no target matches in 
any case` |
   | `TypeCastingOpDescSpec` | the old exact-name test is replaced by `cast a 
column named in a different case, under the table's name`; new: `keep only the 
last of two units that name one column in different cases`, `skip a unit that 
names no column in any case` |
   | `TypeCastingOpExecSpec` | `cast a column named in a different case, the 
last unit for it winning` |
   
   ```
   sbt "WorkflowCore/testOnly 
org.apache.texera.amber.core.tuple.AttributeTypeUtilsSpec" \
       "WorkflowOperator/testOnly 
org.apache.texera.amber.operator.typecasting.* 
org.apache.texera.amber.operator.udf.python.*"
   sbt scalafmtCheckAll Test/scalafmtCheck
   ```
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


-- 
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]

Reply via email to