test(pyamber): add unit tests for attribute_type_utils#6833
test(pyamber): add unit tests for attribute_type_utils#6833Amer-Mukhtar wants to merge 3 commits into
Conversation
Automated Reviewer SuggestionsBased on the
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 408 | 0.249 | 24,666/33,269/33,269 us | 🔴 -9.1% / 🔴 +100.5% |
| 🔴 | bs=100 sw=10 sl=64 | 887 | 0.541 | 107,414/160,949/160,949 us | 🔴 +41.6% / 🔴 +47.5% |
| ⚪ | bs=1000 sw=10 sl=64 | 1,063 | 0.649 | 951,383/984,037/984,037 us | ⚪ within ±5% / 🟢 -8.3% |
Baseline details
Latest main a351f44 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 408 tuples/sec | 449 tuples/sec | 754.55 tuples/sec | -9.1% | -45.9% |
| bs=10 sw=10 sl=64 | MB/s | 0.249 MB/s | 0.274 MB/s | 0.461 MB/s | -9.1% | -45.9% |
| bs=10 sw=10 sl=64 | p50 | 24,666 us | 22,867 us | 12,816 us | +7.9% | +92.5% |
| bs=10 sw=10 sl=64 | p95 | 33,269 us | 32,435 us | 16,594 us | +2.6% | +100.5% |
| bs=10 sw=10 sl=64 | p99 | 33,269 us | 32,435 us | 19,806 us | +2.6% | +68.0% |
| bs=100 sw=10 sl=64 | throughput | 887 tuples/sec | 992 tuples/sec | 969.38 tuples/sec | -10.6% | -8.5% |
| bs=100 sw=10 sl=64 | MB/s | 0.541 MB/s | 0.605 MB/s | 0.592 MB/s | -10.6% | -8.6% |
| bs=100 sw=10 sl=64 | p50 | 107,414 us | 98,055 us | 103,584 us | +9.5% | +3.7% |
| bs=100 sw=10 sl=64 | p95 | 160,949 us | 113,638 us | 109,097 us | +41.6% | +47.5% |
| bs=100 sw=10 sl=64 | p99 | 160,949 us | 113,638 us | 117,304 us | +41.6% | +37.2% |
| bs=1000 sw=10 sl=64 | throughput | 1,063 tuples/sec | 1,084 tuples/sec | 1,004 tuples/sec | -1.9% | +5.9% |
| bs=1000 sw=10 sl=64 | MB/s | 0.649 MB/s | 0.662 MB/s | 0.613 MB/s | -2.0% | +5.9% |
| bs=1000 sw=10 sl=64 | p50 | 951,383 us | 925,606 us | 1,002,357 us | +2.8% | -5.1% |
| bs=1000 sw=10 sl=64 | p95 | 984,037 us | 961,930 us | 1,046,463 us | +2.3% | -6.0% |
| bs=1000 sw=10 sl=64 | p99 | 984,037 us | 961,930 us | 1,073,661 us | +2.3% | -8.3% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,490.19,200,128000,408,0.249,24666.04,33269.02,33269.02
1,100,10,64,20,2255.69,2000,1280000,887,0.541,107413.96,160949.39,160949.39
2,1000,10,64,20,18820.35,20000,12800000,1063,0.649,951382.53,984037.15,984037.15
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Pull request overview
Adds missing unit-test coverage for the Python worker’s core.models.schema.attribute_type_utils conversion helpers, ensuring Arrow ↔ AttributeType mapping (including LARGE_BINARY’s metadata-based encoding) is validated and protected against regressions.
Changes:
- Introduces a new pytest module covering
detect_attribute_type_from_arrow_fieldacross supported Arrow types, timestamp units, metadata precedence, and error behavior for unsupported types. - Adds coverage for
create_arrow_field_with_metadata, includingLARGE_BINARYmarker metadata behavior and round-trip preservation through Arrow schemas.
Comments suppressed due to low confidence (1)
amber/src/test/python/core/models/schema/test_attribute_type_utils.py:179
- Similar to the earlier metadata check: comparing
field.metadatato a plain dict can be fragile. Prefer asserting the presence/value of thetexera_typemarker to avoid version-specific equality behavior.
def test_unicode_name_survives_on_a_large_binary_field(self):
field = create_arrow_field_with_metadata("列名", AttributeType.LARGE_BINARY)
assert field.name == "列名"
assert field.metadata == LARGE_BINARY_METADATA
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Amer Mukhtar <136252708+Amer-Mukhtar@users.noreply.github.com>
Description
What changes were proposed in this PR?
amber/src/test/python/core/models/schema/test_attribute_type_utils.py, a new pytest spec for the Python worker'sattribute_type_utils, which previously had no dedicated unit tests.detect_attribute_type_from_arrow_field: every supported Arrow type, timestamps across all four units, thetexera_type: LARGE_BINARYmetadata marker taking precedence over the Arrow type, metadata that doesn't mark large binary falling back to the type mapping, and unmapped Arrow types raisingKeyError.create_arrow_field_with_metadata: everyAttributeType, metadata attached only forLARGE_BINARY, attribute names preserved verbatim (empty, unicode, emoji, long), and non-AttributeTypeinput raisingKeyError.LARGE_BINARYfield degrades it toSTRING.Any related issues, documentation, discussions?
Closes: #6635
How was this PR tested?
cd amber && pytest src/test/python/core/models/schema/test_attribute_type_utils.py -v, expect all 67 tests passing.Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude