Bugs item #1964658, was opened at 2008-05-15 17:06
Message generated for change (Settings changed) made by sjoerd
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1964658&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core
Group: MonetDB4 CVS Head
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Marcin Zukowski (e-r00)
>Assigned to: Sjoerd Mullender (sjoerd)
Summary: Problem with names of reverse()'d BATs.

Initial Comment:
I have a MIL operator that requires a bat name as a parameter. Later, this bat 
name is used to retrieve the actual bat and do something with it.

If I have a BAT as a variable in MIL, I typically do the following:
  var batId := b.bbpname();
  operator(batId);

However, if batId is a result of a reverse() operation, as in:
  var a := bat(void, int);
  var b := a.reverse();
now both a.bbpname() and b.bbpname() are the same. If I give b to the operator, 
and then search for it with BBPindex (in C), I get a, not b.

Any way to avoid this ambiguity? And please, I don't consider rename() the 
solution - it's just oh-so-unsafe, example:
  var x := new(void, int);
  x.rename("A");
  x.info().find("batId").print(); # A
  var y := x.reverse();  
  y.info().find("batId").print(); # A
  y.rename("B");
  y.info().find("batId").print(); # B
  var z := y.reverse();
  z.info().find("batId").print(); # A
  z.rename("C");
  z.info().find("batId").print(); # C
  x.info().find("batId").print(); # C (!!!)
Above can be seen as a bug by itself probably

----------------------------------------------------------------------

Comment By: Marcin Zukowski (e-r00)
Date: 2009-01-15 15:28

Message:
I am not using it anymore, so I do not have an opinion.


----------------------------------------------------------------------

Comment By: Sjoerd Mullender (sjoerd)
Date: 2009-01-15 15:16

Message:
I implemented my third option in the Development branch.

Marcin, does this solution satisfy you?

----------------------------------------------------------------------

Comment By: Sjoerd Mullender (sjoerd)
Date: 2009-01-15 10:46

Message:
If I understand correctly, there are two parts to this report.

- When the reverse bat has not been named explicitly, bbpname returns the
name of the non reversed bat.
- When renaming a bat, the effect can be seen through other variables
pointing to the same bat.

The latter is definitely not a bug.  It is the bat that gets renamed, no
matter how you refer to it.  Naming is not a label that hangs on the
variable, it is a label that hangs on the bat that is referenced through
the variable.  Remember, bats have an existence apart from any variables
referring to it.

The former is, to say the least, unfortunate.  The implementation is
clear: The core of the BBPname macro is
((i) > 0 || BBP_logical(i))?BBP_logical(i):BBP_logical(-(i))
so if the reverse (i<0) does not have a name, the name for the non
reversed bat is returned.

Various possible solutions come to mind:
- Leave as is;  ;-)
- Return empty string, indicating no name;
- Give reverse bats their own names automatically (like tmp_XXX for non
reversed bats).

This last solutions is probably the preferred solution for Marcin.  It
does involve some work since the automatically assigned name is used and
interpreted in various places, and those places also need to work with an
automatically created name for the reverse bat.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1964658&group_id=56967

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to