mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 15:51:01 +00:00
fixed csv bugs (#2355)
This commit is contained in:
parent
e572c8f2c1
commit
2146f407c3
2 changed files with 65 additions and 2 deletions
|
|
@ -279,10 +279,14 @@ func (i *bulkInsertSourceCSVRowIter) Next(ctx context.Context) (types.Row, error
|
|||
result[idx] = intVal
|
||||
|
||||
case *parser.DataTypeIDSet:
|
||||
return nil, sql3.NewErrTypeConversionOnMap(0, 0, evalValue, mapColumn.colType.TypeDescription())
|
||||
intVal, err := strconv.ParseInt(evalValue, 10, 64)
|
||||
if err != nil {
|
||||
return nil, sql3.NewErrTypeConversionOnMap(0, 0, evalValue, mapColumn.colType.TypeDescription())
|
||||
}
|
||||
result[idx] = []int64{intVal}
|
||||
|
||||
case *parser.DataTypeStringSet:
|
||||
return nil, sql3.NewErrTypeConversionOnMap(0, 0, evalValue, mapColumn.colType.TypeDescription())
|
||||
result[idx] = []string{evalValue}
|
||||
|
||||
case *parser.DataTypeTimestamp:
|
||||
intVal, err := strconv.ParseInt(evalValue, 10, 64)
|
||||
|
|
|
|||
|
|
@ -1802,6 +1802,65 @@ func TestPlanner_BulkInsert(t *testing.T) {
|
|||
}
|
||||
})
|
||||
|
||||
t.Run("BulkInsertCSVStringIDSet", func(t *testing.T) {
|
||||
|
||||
_, _, err = sql_test.MustQueryRows(t, c.GetNode(0).Server, `create table greg-test (
|
||||
_id STRING,
|
||||
id_col ID,
|
||||
string_col STRING cachetype ranked size 1000,
|
||||
int_col int,
|
||||
decimal_col DECIMAL(2),
|
||||
bool_col BOOL
|
||||
time_col TIMESTAMP,
|
||||
stringset_col STRINGSET,
|
||||
ideset_col IDSET
|
||||
);`)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, _, err = sql_test.MustQueryRows(t, c.GetNode(0).Server, `BULK INSERT INTO greg-test (
|
||||
_id,
|
||||
id_col,
|
||||
string_col,
|
||||
int_col,
|
||||
decimal_col,
|
||||
bool_col,
|
||||
time_col,
|
||||
stringset_col,
|
||||
ideset_col)
|
||||
map (
|
||||
0 ID,
|
||||
1 STRING,
|
||||
2 INT,
|
||||
3 DECIMAL(2),
|
||||
4 BOOL,
|
||||
5 TIMESTAMP,
|
||||
6 STRINGSET,
|
||||
7 IDSET)
|
||||
transform(
|
||||
@1,
|
||||
@0,
|
||||
@1,
|
||||
@2,
|
||||
@3,
|
||||
@4,
|
||||
@5,
|
||||
@6,
|
||||
@7)
|
||||
FROM
|
||||
x'8924809397503602651,TEST,-123,1.12,0,2013-07-15T01:18:46Z,stringset1,1
|
||||
64575677503602651,TEST2,321,31.2,1,2014-07-15T01:18:46Z,stringset1,1
|
||||
8924809397503602651,TEST,-123,1.12,0,2013-07-15T01:18:46Z,stringset2,2'
|
||||
with
|
||||
BATCHSIZE 10000
|
||||
format 'CSV'
|
||||
input 'STREAM';`)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestPlanner_SelectSelectSource(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue