Skip to content

Commit 5d79cfd

Browse files
adriangbclaude
andcommitted
Document is_json as legacy and drop it from assertions
Mark the is_json=true emission in json_field_metadata() as a legacy, non-standard key kept only for back-compat, to be removed in a future release. Drop the corresponding assertion from the test helper so the remaining checks only enforce the canonical Arrow extension keys (ARROW:extension:name, ARROW:extension:metadata) — the legacy key continues to be emitted but is no longer part of the contract under test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 625b1df commit 5d79cfd

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/common_union.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,22 @@ use datafusion::common::ScalarValue;
1414
/// Attach this to any Arrow `Field` whose values are JSON-encoded strings so
1515
/// downstream consumers can recognize them as JSON rather than opaque text.
1616
///
17-
/// Emits both the legacy `is_json` key (for back-compat with existing
18-
/// consumers of this crate) and Arrow's canonical JSON extension type keys
17+
/// Emits Arrow's canonical JSON extension type keys
1918
/// (`ARROW:extension:name` = `arrow.json`, `ARROW:extension:metadata` = `{}`),
2019
/// see <https://arrow.apache.org/docs/format/CanonicalExtensions.html#json>.
20+
///
21+
/// Also emits a legacy `is_json` = `true` key. This key predates this crate's
22+
/// adoption of the canonical extension and is non-standard — no other Arrow
23+
/// tool recognizes it. It is kept only for back-compat with existing
24+
/// downstream consumers of this crate and will be removed in a future
25+
/// release; new consumers should key off `ARROW:extension:name` instead.
2126
#[must_use]
2227
pub fn json_field_metadata() -> HashMap<String, String> {
2328
HashMap::from([
24-
("is_json".to_string(), "true".to_string()),
2529
("ARROW:extension:name".to_string(), "arrow.json".to_string()),
2630
("ARROW:extension:metadata".to_string(), "{}".to_string()),
31+
// Legacy, non-standard. Remove in a future release — see doc comment above.
32+
("is_json".to_string(), "true".to_string()),
2733
])
2834
}
2935

tests/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ async fn test_json_get_array_inner_field_json_metadata() {
185185
}
186186

187187
fn assert_json_field_metadata(metadata: &HashMap<String, String>) {
188-
assert_eq!(metadata.get("is_json").map(String::as_str), Some("true"));
189188
assert_eq!(
190189
metadata.get("ARROW:extension:name").map(String::as_str),
191190
Some("arrow.json")

0 commit comments

Comments
 (0)