From fdd6d33293807ecbf60967ba5631fe6674ee63f8 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Wed, 7 Jul 2021 11:21:54 -0700 Subject: [PATCH] /{go,integration-tests}: fix parse int with leading zero issue --- go/libraries/doltcore/env/actions/infer_schema.go | 6 ++++++ integration-tests/bats/import-create-tables.bats | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/go/libraries/doltcore/env/actions/infer_schema.go b/go/libraries/doltcore/env/actions/infer_schema.go index 4ba6527d24..accbde271e 100644 --- a/go/libraries/doltcore/env/actions/infer_schema.go +++ b/go/libraries/doltcore/env/actions/infer_schema.go @@ -224,6 +224,12 @@ func leastPermissiveNumericType(strVal string, floatThreshold float64) (ti typei if err != nil { return typeinfo.UnknownType } + + // handle leading zero case + if strVal[0] == '0' { + return typeinfo.StringDefaultType + } + if ui <= math.MaxUint32 { return typeinfo.Uint32Type } else { diff --git a/integration-tests/bats/import-create-tables.bats b/integration-tests/bats/import-create-tables.bats index f40abe2880..1f69342339 100755 --- a/integration-tests/bats/import-create-tables.bats +++ b/integration-tests/bats/import-create-tables.bats @@ -108,7 +108,6 @@ teardown() { } @test "import-create-tables: import data from csv and create the table different types" { - skip "unable to cast to uint64, parse error" run dolt table import -c --pk=pk test people.csv [ "$status" -eq 0 ] [[ "$output" =~ "Import completed successfully." ]] || false