From 5bf5b5364d43a32ebb1a404d95ff83674b72d825 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Tue, 22 Nov 2022 15:51:41 -0600 Subject: [PATCH] Fix more of the SQL tests in dax (#2310) There are now only four tests remaining which do not pass. One is related to error format mismatch. Two require orchestrator work. One won't pass until table name conversion is supported for multiple tables. --- dax/queryer/queryer.go | 2 +- dax/test/dax/dax_test.go | 21 ++++----------------- wire_response.go | 12 +++++++++++- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/dax/queryer/queryer.go b/dax/queryer/queryer.go index bb66262a7..3cd06bfe2 100644 --- a/dax/queryer/queryer.go +++ b/dax/queryer/queryer.go @@ -144,7 +144,7 @@ func (q *Queryer) QuerySQL(ctx context.Context, qual dax.TableQualifier, sql str } schema.Fields[i] = &featurebase.WireQueryField{ Name: dax.FieldName(col.ColumnName), - Type: col.Type.TypeDescription(), + Type: strings.ToLower(col.Type.TypeDescription()), // TODO(tlt): remove this once sql3 uses BaseTypes. BaseType: btype, TypeInfo: col.Type.TypeInfo(), } diff --git a/dax/test/dax/dax_test.go b/dax/test/dax/dax_test.go index 258facc76..aae4a3a67 100644 --- a/dax/test/dax/dax_test.go +++ b/dax/test/dax/dax_test.go @@ -92,23 +92,10 @@ func TestDAXIntegration(t *testing.T) { // skips is a list of tests which are currently not passing in dax. We // need to get these passing before alpha. skips := []string{ - "testinsert/test-5", // error messages differ - "table-82/test-3", - "table-82/test-8", - "table-83/test-3", - "table-83/test-8", - "cast_int/test-2", - "cast_int/test-7", - "cast_id/test-2", - "cast_string/test-12", - "cast_ts/test-7", - "sum_test/test-5", - "percentile_test/test-6", - "minmax_test/test-7", - "minmax_test/test-8", - "groupby_test/test-5", - "groupby_test/test-6", - "innerjointest/innerjoin-aggregate-groupby", + "testinsert/test-5", // error messages differ + "percentile_test/test-6", // related to TODO in orchestrator.executePercentile + "groupby_test/test-6", // something to do with GroupCount.DecimalAgg=nil in orchestrator.executeGroupBy + "innerjointest/innerjoin-aggregate-groupby", // join test which won't work until we support multiple tables } doSkip := func(name string) bool { diff --git a/wire_response.go b/wire_response.go index c7464ff13..409101b16 100644 --- a/wire_response.go +++ b/wire_response.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "strings" + "time" "github.com/molecula/featurebase/v3/dax" "github.com/molecula/featurebase/v3/pql" @@ -144,11 +145,20 @@ func (s *WireQueryResponse) UnmarshalJSONTyped(in []byte, typed bool) error { } } + case dax.BaseTypeTimestamp: + if src, ok := s.Data[i][j].(string); ok && src != "" { + val, err := time.ParseInLocation(time.RFC3339Nano, src, time.UTC) + if err != nil { + return errors.Wrap(err, "parsing timestamp") + } + s.Data[i][j] = val + } + case dax.BaseTypeBool, dax.BaseTypeString: // no need to convert default: - log.Printf("WARNING: unimplemented: %T", hdr.BaseType) + log.Printf("WARNING: unimplemented: %s", hdr.BaseType) } } }