Skip to content

[Feature Request]: Support SET clause in LOAD DATA to tell the NULL string #5079

Closed

Description

@domingozhang

Is there an existing issue for the same feature request?

  • I have checked the existing issues.

Is your feature request related to a problem?

No response

Describe the feature you'd like

In LOAD DATA statement, there needs a clause of SET to tell the NULL string as following

SET
col_name = nullif(col_name ,'NULL');

If use SET, the string NULL in CSV will be loaded as null value not a string NULL

Describe implementation you've considered

No response

Documentation, Adoption, Use Case, Migration Strategy

No response

Additional information

No response

Activity

  1. added
    priority/p0
    source/on-demand
    on Sep 19, 2022
  2. added this to the v0.6.0 milestone on Sep 19, 2022
  3. domingozhang commented on Sep 19, 2022

    @domingozhang
    ContributorAuthor

    \N is still NULL
    If the nullif(col_name , value) is true, it returns NULL value.
    Such as nullif(a, 'null')

  4. jianwan0214 commented on Nov 2, 2022

    @jianwan0214
    Contributor

    for example, we create table t1(a int);
    then, use this sql
    load data infile '/Users/wangjian/test/a.txt' into table t1 set a=nullif(a, 'null');
    which means we set the string 'null' as null value in file.

  5. jianwan0214 commented on Nov 2, 2022

    @jianwan0214
    Contributor

    create table t2(a int, b int);
    load data infile '/Users/wangjian/test/a.txt' into table t2 set a=nullif(a, 'null'), a=nullif(a, 'abc'), b=nullif(b, 'bc'), b = nullif(b, 'de');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/featurepriority/p0source/on-demand

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions