Fix config file types of csv_skip_rows and csv_skip_columns (#4726)

This commit is contained in:
Lee Jaeyong 2018-09-21 04:43:39 +09:00 committed by Daniel Nelson
parent 820d1afa2e
commit dfe8e3b473
1 changed files with 8 additions and 8 deletions

View File

@ -1541,24 +1541,24 @@ func getParserConfig(name string, tbl *ast.Table) (*parsers.Config, error) {
if node, ok := tbl.Fields["csv_skip_rows"]; ok {
if kv, ok := node.(*ast.KeyValue); ok {
if str, ok := kv.Value.(*ast.String); ok {
iVal, err := strconv.Atoi(str.Value)
c.CSVSkipRows = iVal
if integer, ok := kv.Value.(*ast.Integer); ok {
v, err := integer.Int()
if err != nil {
return nil, fmt.Errorf("E! parsing to int: %v", err)
return nil, err
}
c.CSVHeaderRowCount = int(v)
}
}
}
if node, ok := tbl.Fields["csv_skip_columns"]; ok {
if kv, ok := node.(*ast.KeyValue); ok {
if str, ok := kv.Value.(*ast.String); ok {
iVal, err := strconv.Atoi(str.Value)
c.CSVSkipColumns = iVal
if integer, ok := kv.Value.(*ast.Integer); ok {
v, err := integer.Int()
if err != nil {
return nil, fmt.Errorf("E! parsing to int: %v", err)
return nil, err
}
c.CSVHeaderRowCount = int(v)
}
}
}