check same rowID for same frame in actions

This commit is contained in:
Linh Vo 2017-06-20 21:37:27 -05:00
parent 6d12478e6b
commit e0bf37da40

View file

@ -94,19 +94,19 @@ func (i *InputDefinition) LoadDefinition(pb *internal.InputDefinition) error {
}
numPrimaryKey := 0
countRowID := make(map[uint64]bool)
countRowID := make(map[string]uint64)
for _, field := range pb.Fields {
var actions []Action
for _, action := range field.Actions {
if err := i.ValidateAction(action); err != nil {
return err
}
if action.RowID != 0 {
_, ok := countRowID[action.RowID]
if !ok {
countRowID[action.RowID] = true
} else {
if action.RowID != 0 && action.Frame != ""{
val, ok := countRowID[action.Frame]
if ok && val == action.RowID {
return fmt.Errorf("duplicate rowID with other field: %s", action.RowID)
} else {
countRowID[action.Frame] = action.RowID
}
}
actions = append(actions, Action{