in spark/sql/dataframewriter.go [97:111]
func getSaveMode(mode string) (proto.WriteOperation_SaveMode, error) {
if mode == "" {
return proto.WriteOperation_SAVE_MODE_UNSPECIFIED, nil
} else if strings.EqualFold(mode, "Append") {
return proto.WriteOperation_SAVE_MODE_APPEND, nil
} else if strings.EqualFold(mode, "Overwrite") {
return proto.WriteOperation_SAVE_MODE_OVERWRITE, nil
} else if strings.EqualFold(mode, "ErrorIfExists") {
return proto.WriteOperation_SAVE_MODE_ERROR_IF_EXISTS, nil
} else if strings.EqualFold(mode, "Ignore") {
return proto.WriteOperation_SAVE_MODE_IGNORE, nil
} else {
return 0, sparkerrors.WithType(fmt.Errorf("unsupported save mode: %s", mode), sparkerrors.InvalidInputError)
}
}