Skip to content

Commit

Permalink
Merge branch 'main' into rip-grafana
Browse files Browse the repository at this point in the history
  • Loading branch information
iskakaushik authored Nov 23, 2023
2 parents 7f9aabc + b53231f commit 9cdb567
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
8 changes: 8 additions & 0 deletions flow/e2e/snowflake/peer_flow_sf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -73,6 +80,7 @@ func (s *PeerFlowE2ETestSuiteSF) SetupSuite() {

log.SetReportCaller(true)
log.SetLevel(log.WarnLevel)
log.SetOutput(logWriterType{t: s.T()})

s.setupTemporalLogger()

Expand Down
25 changes: 13 additions & 12 deletions flow/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9cdb567

Please sign in to comment.