diff --git a/errors.go b/errors.go index 978b555b..53ea9439 100644 --- a/errors.go +++ b/errors.go @@ -56,8 +56,6 @@ const ( ) var ( - errDriver = errors.New("internal driver error: please file a bug report") - errAPI = errors.New("API error") errVectorSize = errors.New("data chunks cannot exceed duckdb's internal vector size") diff --git a/errors_test.go b/errors_test.go index dac9d6dd..2e23933b 100644 --- a/errors_test.go +++ b/errors_test.go @@ -56,6 +56,8 @@ func TestErrNestedMap(t *testing.T) { } func TestErrAppender(t *testing.T) { + t.Parallel() + t.Run(errAppenderInvalidCon.Error(), func(t *testing.T) { var con driver.Conn _, err := NewAppenderFromConn(con, "", "test") @@ -160,6 +162,13 @@ func TestErrAppender(t *testing.T) { require.NoError(t, con.Close()) require.NoError(t, c.Close()) }) + + t.Run(errUnsupportedMapKeyType.Error(), func(t *testing.T) { + c, con, a := prepareAppender(t, `CREATE TABLE test (m MAP(INT[], STRUCT(v INT)))`) + err := a.AppendRow(nil) + testError(t, err, errAppenderAppendRow.Error(), errUnsupportedMapKeyType.Error()) + cleanupAppender(t, c, con, a) + }) } func TestErrAppend(t *testing.T) { @@ -186,10 +195,8 @@ func TestErrAppendDecimal(t *testing.T) { func TestErrAppendEnum(t *testing.T) { c, con, a := prepareAppender(t, testTypesEnumSQL+";"+`CREATE TABLE test (e my_enum)`) - err := a.AppendRow("3") testError(t, err, errAppenderAppendRow.Error(), castErrMsg) - cleanupAppender(t, c, con, a) } diff --git a/vector.go b/vector.go index 7094c118..e7e1d57c 100644 --- a/vector.go +++ b/vector.go @@ -404,7 +404,6 @@ func (vec *vector) initCString(duckdbType C.duckdb_type) { } func (vec *vector) initDecimal(logicalType C.duckdb_logical_type, colIdx int) error { - // Get the width and scale. vec.width = uint8(C.duckdb_decimal_width(logicalType)) vec.scale = uint8(C.duckdb_decimal_scale(logicalType))