Repository navigation
Commit 959939d
committed
test: bind number and true/false loop variables in generated Python operators
Inside a control block, a number or true/false property of an operator
whose Scala descriptor generates Python, such as Radar Chart's Fill
Opacity or Radar Plot's Show Legend, is written into the code before
the loop runs, so the compiler rejects a reference such as $o there
today.
These tests pin how such a reference is read when the code runs:
- PythonOperatorDescriptorSpec and WorkflowCompilerSpec: the code is
generated from probe values in the reference's place, and where the
value lands as it is, the code calls
self.loop_variable_value(name, kind) instead: 'integer' for an int
property, 'long' for a long one. A value the descriptor checks or
adjusts (Histogram2D's bins, Hugging Face's limits, Figure Factory
Table's Row Height and Font Size), one inside a text, a comment or a
name, one the code computes with, never holds or reads when the
operator starts, and one that decides the output schema stay compile
errors that name the property and why, never a probe value the user
did not type. The compile probes the code once and decides every
reason from that binding: the code's reason before the schema's, and
a schema reason only once every input has a schema.
- test_operator.py: loop_variable_value reads the values bound at the
operator's first tuple and converts them as StateReferenceBinding
does: trimmed as String.trim, then new BigDecimal(text)
.longValueExact() (within 32 bits for an int property, as Jackson
writes it), Double.parseDouble, or true/false by equalsIgnoreCase.
The parity tables are generated on JDK 17 through the compiled
State.fromJson and StateReferenceBinding.coerce, and through a Limit's
int property for the 32-bit bound. Binding fails for a required value
its property cannot take, as the JVM's binding does.
- test_executor_manager.py: binding requires the values the generated
code reads, by name and kind.
- LoopIntegrationSpec: Radar Chart's opacity and Radar Plot's legend
follow the loop variable on every iteration; each legend is matched
to its iteration by the plot's trace count.
Before the next commit the Scala specs do not compile (there is no
loopVariableBinding), the new Python tests fail with AttributeError or
on the values they read, and the two new LoopIntegrationSpec cases fail
to compile their workflow.1 parent 8f83171 commit 959939d
5 files changed
Lines changed: 1666 additions & 20 deletions
File tree
- amber/src/test
- integration/org/apache/texera/amber/engine/e2e
- python/core
- architecture/managers
- models
- common
- workflow-compiler/src/test/scala/org/apache/texera/common/compiler
- workflow-operator/src/test/scala/org/apache/texera/amber/operator
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
460 | 540 | | |
461 | 541 | | |
462 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
74 | 89 | | |
75 | 90 | | |
76 | 91 | | |
| |||
364 | 379 | | |
365 | 380 | | |
366 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
367 | 406 | | |
368 | 407 | | |
369 | 408 | | |
| |||
0 commit comments