Description
QueryContext + rows.Next fails for an ARRAY, MAP or STRUCT column when one nested DOUBLE or FLOAT value is NaN, Infinity or -Infinity. The Arrow row scanner renders nested values as JSON text, and for a non-finite float jsonfmt.Append falls through to json.Marshal, which rejects it. The whole result fails with:
databricks: arrow row scanner failed getting column value for arr: json: unsupported value: NaN
The value is present in the Arrow batch, and the same value in a top-level DOUBLE column scans fine as a float64. The failure is only in the JSON rendering of nested values. It is the same in v1.17.0, v1.19.0 and on main (57bc51a).
Reproducer, against a SQL warehouse:
SELECT array(CAST('NaN' AS DOUBLE), CAST('Infinity' AS DOUBLE)) AS arrrows, err := db.QueryContext(ctx, "SELECT array(CAST('NaN' AS DOUBLE), CAST('Infinity' AS DOUBLE)) AS arr")
// err == nil
var dest any
ok := rows.Next()
// ok == false
err = rows.Err()
// databricks: arrow row scanner failed getting column value for arr: json: unsupported value: NaNReproducer without a warehouse, in internal/rows/arrowbased on main:
func TestListOfDoubleWithNonFiniteValues(t *testing.T) {
lb := array.NewListBuilder(memory.NewGoAllocator(), arrow.PrimitiveTypes.Float64)
defer lb.Release()
lb.Append(true)
lb.ValueBuilder().(*array.Float64Builder).AppendValues([]float64{1.5, math.NaN(), math.Inf(1), math.Inf(-1)}, nil)
arr := lb.NewArray()
defer arr.Release()
holder, err := (&arrowValueContainerMaker{}).makeColumnValueContainer(arr.DataType(), time.UTC, nil, nil)
assert.NoError(t, err)
assert.NoError(t, holder.SetValueArray(arr.Data()))
_, err = holder.Value(0)
assert.NoError(t, err) // json: unsupported value: NaN
}The same happens for a MAP value and a STRUCT field, which use the same marshalScalar path.
Expected: a non-finite float inside a complex value does not fail the result. JSON has no literal for these values, so they could be rendered as the strings "NaN", "Infinity" and "-Infinity". These are regular DOUBLE and FLOAT values in Databricks SQL https://docs.databricks.com/aws/en/sql/language-manual/data-types/special-floating-point-values.
Activity
cathleeny commentedon Nov 19, 2026
Thanks for catching this and for the detailed reproducer, @jakubhrncar! It is fixed in #574: NaN and ±Infinity inside ARRAY, MAP and STRUCT values now render as the JSON strings
"NaN","Infinity"and"-Infinity"instead of failing the result.