diff --git a/contrib/dolphin/data/load-ignore.txt b/contrib/dolphin/data/load-ignore.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f30778b503d35e01c42cce39fc4e99f99d36bac --- /dev/null +++ b/contrib/dolphin/data/load-ignore.txt @@ -0,0 +1 @@ +(11, ,'男','test')(12, , ,'test')(13, , ,'test')(14,12,'man','test')(15,12, ,'test')(16,\N,\N,'test') \ No newline at end of file diff --git a/contrib/dolphin/input/load.source b/contrib/dolphin/input/load.source index 66d3d843416b5e63e7349668d5e53153d2798908..89873153d035ef1989ea9bfa94bb08ef90c7ede4 100644 --- a/contrib/dolphin/input/load.source +++ b/contrib/dolphin/input/load.source @@ -37,6 +37,14 @@ insert into t_space_float values(5, ' 1.5 ', ' 2.6 ', ' 3.9 ', ' 4.9 '); - insert into t_space_float values(5, ' 1.5. ', ' 2.6 ', ' 3.9 ', ' 4.9 '); -- should error select * from t_space_float order by n; +-- test ignore +create table t_load_ignore(c_01 int primary key,c_02 int default 18,c_03 char(5) default '女',c_04 varchar(15)); +load data infile '@abs_builddir@/data/load-ignore.txt' ignore + into table t_load_ignore character set 'utf8' + fields terminated by ',' enclosed by '"' + lines starting by '(' terminated by ')'; +select * from t_load_ignore order by c_01; + create table t1(a int, b int); load data infile '@abs_builddir@/data/load1.csv' into table t1; select * from t1; diff --git a/contrib/dolphin/output/load.source b/contrib/dolphin/output/load.source index 3cd302ac624be995521617f8fd3f3bd2d8031696..3dcb1139b51b761199ed53bc766cf7db3fafbeac 100644 --- a/contrib/dolphin/output/load.source +++ b/contrib/dolphin/output/load.source @@ -68,6 +68,30 @@ select * from t_space_float order by n; 5 | 2 | 3 | 4 | 5 (5 rows) +-- test ignore +create table t_load_ignore(c_01 int primary key,c_02 int default 18,c_03 char(5) default '女',c_04 varchar(15)); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t_load_ignore_pkey" for table "t_load_ignore" +load data infile '@abs_builddir@/data/load-ignore.txt' ignore + into table t_load_ignore character set 'utf8' + fields terminated by ',' enclosed by '"' + lines starting by '(' terminated by ')'; +WARNING: invalid input syntax for integer: " " +CONTEXT: COPY t_load_ignore, line 1, column c_02: " " +WARNING: invalid input syntax for integer: " " +CONTEXT: COPY t_load_ignore, line 2, column c_02: " " +WARNING: invalid input syntax for integer: " " +CONTEXT: COPY t_load_ignore, line 3, column c_02: " " +select * from t_load_ignore order by c_01; + c_01 | c_02 | c_03 | c_04 +------+------+-------+-------- + 11 | 0 | '男' | 'test' + 12 | 0 | | 'test' + 13 | 0 | | 'test' + 14 | 12 | 'man' | 'test' + 15 | 12 | | 'test' + 16 | | | 'test' +(6 rows) + create table t1(a int, b int); load data infile '@abs_builddir@/data/load1.csv' into table t1; select * from t1; diff --git a/contrib/dolphin/plugin_optimizer/commands/copy.cpp b/contrib/dolphin/plugin_optimizer/commands/copy.cpp index b405070ef3f2b11243107a42309ca0265d362638..b4dfd0317b1eed5af4013bf4d256547a2e470598 100644 --- a/contrib/dolphin/plugin_optimizer/commands/copy.cpp +++ b/contrib/dolphin/plugin_optimizer/commands/copy.cpp @@ -6420,6 +6420,10 @@ Datum InputFunctionCallForBulkload(CopyState cstate, FmgrInfo* flinfo, char* str if (str == NULL && flinfo->fn_strict) return (Datum)0; /* just return null result */ +#ifdef DOLPHIN + fcinfo.can_ignore = cstate->is_ignore; +#endif + SPI_STACK_LOG("push cond", NULL, NULL); pushed = SPI_push_conditional();