Ray's Knowledge Base
Unlock

Represent mixed-type fields as marked canonical JSON text

DecisionVerified 30 Sep 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.

Context#

Concatenating mixed text and numeric fields as plain strings loses the difference between the number 3 and the string "3".

Decision#

Use a string column marked json, with canonical JSON text per cell. Preserve the marker through take, filter, slice, sort and concat. Report json in the catalog, expose Series.is_json in Python, and use Arrow's arrow.json extension at the boundary.

Why#

Typed values must remain distinct group keys. Observer inbox 5f2574cd39 records replacement of the old coercion-to-text rule.

Rejected options#

Coercing every value to plain text loses type identity. A variant-style union column was deferred rather than introduced with this feature.

Also found by searching

  • group by on mixed column treats number 3 and string "3" as the same key
  • concatenating frames with text and numeric values in one field loses types
  • how do I store a column whose cells mix numbers and strings without coercing to text
  • heterogeneous typed field, arrow.json extension type, Series.is_json
  • group by key treats number 3 and string "3" as the same value in mixed-type column
  • how do I store a column with both strings and numbers without losing type distinction?
  • mixed type field concatenated to plain text loses whether it was int or str, how to represent it in a column
  • Series.is_json arrow.json extension canonical JSON per cell