diff --git a/duckdbservice/arrow_helpers.go b/duckdbservice/arrow_helpers.go index 08cd4ba..7d8520a 100644 --- a/duckdbservice/arrow_helpers.go +++ b/duckdbservice/arrow_helpers.go @@ -133,8 +133,8 @@ func DuckDBTypeToArrow(dbType string) arrow.DataType { // irrecoverably lost at the driver level. return arrow.FixedWidthTypes.Time64us - // Timestamps (no timezone → empty TimeZone string) - case "TIMESTAMP": + case "TIMESTAMP", "TIMESTAMP WITHOUT TIME ZONE": + // No timezone means an empty Arrow TimeZone string. return &arrow.TimestampType{Unit: arrow.Microsecond} case "TIMESTAMP_S": return &arrow.TimestampType{Unit: arrow.Second} @@ -142,7 +142,7 @@ func DuckDBTypeToArrow(dbType string) arrow.DataType { return &arrow.TimestampType{Unit: arrow.Millisecond} case "TIMESTAMP_NS": return &arrow.TimestampType{Unit: arrow.Nanosecond} - case "TIMESTAMPTZ": + case "TIMESTAMPTZ", "TIMESTAMP WITH TIME ZONE": return &arrow.TimestampType{Unit: arrow.Microsecond, TimeZone: "UTC"} // Interval diff --git a/duckdbservice/arrow_helpers_test.go b/duckdbservice/arrow_helpers_test.go index d959a84..68fba1f 100644 --- a/duckdbservice/arrow_helpers_test.go +++ b/duckdbservice/arrow_helpers_test.go @@ -65,11 +65,15 @@ func TestDuckDBTypeToArrow(t *testing.T) { // Timestamps — plain TIMESTAMP must NOT have timezone {"TIMESTAMP", &arrow.TimestampType{Unit: arrow.Microsecond}}, + {"TIMESTAMP WITHOUT TIME ZONE", &arrow.TimestampType{Unit: arrow.Microsecond}}, + {"timestamp without time zone", &arrow.TimestampType{Unit: arrow.Microsecond}}, {"TIMESTAMP_S", &arrow.TimestampType{Unit: arrow.Second}}, {"TIMESTAMP_MS", &arrow.TimestampType{Unit: arrow.Millisecond}}, {"TIMESTAMP_NS", &arrow.TimestampType{Unit: arrow.Nanosecond}}, // TIMESTAMPTZ must have UTC timezone {"TIMESTAMPTZ", &arrow.TimestampType{Unit: arrow.Microsecond, TimeZone: "UTC"}}, + {"TIMESTAMP WITH TIME ZONE", &arrow.TimestampType{Unit: arrow.Microsecond, TimeZone: "UTC"}}, + {"timestamp with time zone", &arrow.TimestampType{Unit: arrow.Microsecond, TimeZone: "UTC"}}, // Interval {"INTERVAL", arrow.FixedWidthTypes.MonthDayNanoInterval}, @@ -171,11 +175,11 @@ func TestParseDecimalParams(t *testing.T) { {"DECIMAL(10,5)", 10, 5}, {"DECIMAL(38,0)", 38, 0}, {"NUMERIC(5,3)", 5, 3}, - {"DECIMAL", 18, 3}, // default fallback - {"DECIMAL()", 18, 3}, // empty parens - {"DECIMAL(abc,def)", 18, 3}, // non-numeric - {"DECIMAL(18,)", 18, 3}, // missing scale - {"DECIMAL(,2)", 18, 3}, // missing precision + {"DECIMAL", 18, 3}, // default fallback + {"DECIMAL()", 18, 3}, // empty parens + {"DECIMAL(abc,def)", 18, 3}, // non-numeric + {"DECIMAL(18,)", 18, 3}, // missing scale + {"DECIMAL(,2)", 18, 3}, // missing precision } for _, tt := range tests {