diff --git a/flow/e2e/snowflake/peer_flow_sf_test.go b/flow/e2e/snowflake/peer_flow_sf_test.go index 37848f0383..3c62490271 100644 --- a/flow/e2e/snowflake/peer_flow_sf_test.go +++ b/flow/e2e/snowflake/peer_flow_sf_test.go @@ -63,6 +63,13 @@ func (s *PeerFlowE2ETestSuiteSF) setupTemporalLogger() { s.SetLogger(tlogger) } +type logWriterType struct{ t *testing.T } + +func (l logWriterType) Write(p []byte) (n int, err error) { + l.t.Logf(string(p)) + return len(p), nil +} + func (s *PeerFlowE2ETestSuiteSF) SetupSuite() { err := godotenv.Load() if err != nil { @@ -73,6 +80,7 @@ func (s *PeerFlowE2ETestSuiteSF) SetupSuite() { log.SetReportCaller(true) log.SetLevel(log.WarnLevel) + log.SetOutput(logWriterType{t: s.T()}) s.setupTemporalLogger() diff --git a/flow/model/model.go b/flow/model/model.go index 0557af2774..b91dbaa901 100644 --- a/flow/model/model.go +++ b/flow/model/model.go @@ -135,22 +135,23 @@ func (r *RecordItems) toMap() (map[string]interface{}, error) { jsonStruct := make(map[string]interface{}) for col, idx := range r.colToValIdx { v := r.values[idx] + if v.Value == nil { + jsonStruct[col] = nil + continue + } + var err error switch v.Kind { case qvalue.QValueKindString, qvalue.QValueKindJSON: - if v.Value == nil { - jsonStruct[col] = nil - } else { - strVal, ok := v.Value.(string) - if !ok { - return nil, fmt.Errorf("expected string value for column %s for %T", col, v.Value) - } + strVal, ok := v.Value.(string) + if !ok { + return nil, fmt.Errorf("expected string value for column %s for %T", col, v.Value) + } - if len(strVal) > 15*1024*1024 { - jsonStruct[col] = "" - } else { - jsonStruct[col] = strVal - } + if len(strVal) > 15*1024*1024 { + jsonStruct[col] = "" + } else { + jsonStruct[col] = strVal } case qvalue.QValueKindTimestamp, qvalue.QValueKindTimestampTZ, qvalue.QValueKindDate, qvalue.QValueKindTime, qvalue.QValueKindTimeTZ: