Skip to content

bug(node): passing undefined to nullable field gives coerced values #2645

@wjones127

Description

@wjones127

LanceDB version

v0.22.0

What happened?

Would instead expect to resolve to null values. Instead:

  • bool -> false
  • f32 -> NaN
  • string -> ""

Are there known steps to reproduce?

const lancedb = require('@lancedb/lancedb');
const arrow = require('apache-arrow');

(async () => {
    const conn = await lancedb.connect("memory://");
    const schema = new arrow.Schema([
        new arrow.Field("text", new arrow.Utf8(), true),
        new arrow.Field("number", new arrow.Float32(), true),
        new arrow.Field("bool", new arrow.Bool(), true),
    ]);
    const table = await conn.createEmptyTable("test_table", schema);
    await table.add([{ text: undefined, number: undefined, bool: undefined }]);
    const result = await table.query().toArray();
    console.log(result);
})();
[ {"text": "", "number": NaN, "bool": false} ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerstypescriptTypescript / javascript

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions