Skip to content

Commit

Permalink
ANY type creation
Browse files Browse the repository at this point in the history
  • Loading branch information
taniabogatsch committed Sep 13, 2024
1 parent fbb2e4d commit cdf8723
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions type_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type TypeInfo interface {
// NewTypeInfo returns type information for DuckDB's primitive types.
func NewTypeInfo(t Type) (TypeInfo, error) {
name, inMap := unsupportedTypeToStringMap[t]
if inMap {
if inMap && t != TYPE_ANY {
return nil, getError(errAPI, unsupportedTypeError(name))
}

Expand Down Expand Up @@ -183,7 +183,7 @@ func (info *typeInfo) logicalType() C.duckdb_logical_type {
case TYPE_BOOLEAN, TYPE_TINYINT, TYPE_SMALLINT, TYPE_INTEGER, TYPE_BIGINT, TYPE_UTINYINT, TYPE_USMALLINT,
TYPE_UINTEGER, TYPE_UBIGINT, TYPE_FLOAT, TYPE_DOUBLE, TYPE_TIMESTAMP, TYPE_TIMESTAMP_S, TYPE_TIMESTAMP_MS,
TYPE_TIMESTAMP_NS, TYPE_TIMESTAMP_TZ, TYPE_DATE, TYPE_TIME, TYPE_INTERVAL, TYPE_HUGEINT, TYPE_VARCHAR,
TYPE_BLOB, TYPE_UUID:
TYPE_BLOB, TYPE_UUID, TYPE_ANY:
return C.duckdb_create_logical_type(C.duckdb_type(info.Type))

case TYPE_DECIMAL:
Expand Down
6 changes: 4 additions & 2 deletions type_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func TestTypeInfo(t *testing.T) {
var primitiveTypes []Type
for k := range typeToStringMap {
_, inMap := unsupportedTypeToStringMap[k]
if inMap {
if inMap && k != TYPE_ANY {
continue
}
switch k {
Expand Down Expand Up @@ -75,7 +75,9 @@ func TestErrTypeInfo(t *testing.T) {

var unsupportedTypes []Type
for k := range unsupportedTypeToStringMap {
unsupportedTypes = append(unsupportedTypes, k)
if k != TYPE_ANY {
unsupportedTypes = append(unsupportedTypes, k)
}
}

for _, unsupported := range unsupportedTypes {
Expand Down

0 comments on commit cdf8723

Please sign in to comment.