[GRASS-user] v.dissolve - is this a bug?

Hi,

In running v.dissolve within a script, I am getting an intermittent failure:

ERROR: key column must be integer or string

Here's the script spot that fails (but only sometimes)

v.db.addtable MAP
v.db.addcol MAP columns="Dissolve int"
v.db.update MAP column=Dissolve value=1
v.dissolve MAP output=DISSOLVE column=Dissolve

The killer is that it isn't reliable - sometimes it works, sometimes it fails, and I can't tell why!

Richard C

On Sat, Aug 14, 2010 at 10:16 AM, Richard Chirgwin
<rchirgwin@ozemail.com.au> wrote:

Hi,

In running v.dissolve within a script, I am getting an intermittent failure:

ERROR: key column must be integer or string

Here's the script spot that fails (but only sometimes)

v.db.addtable MAP
v.db.addcol MAP columns="Dissolve int"

At this point, please run
v.info -c MAP

and report here.

v.db.update MAP column=Dissolve value=1
v.dissolve MAP output=DISSOLVE column=Dissolve

The killer is that it isn't reliable - sometimes it works, sometimes it
fails, and I can't tell why!

Always on the same machine, the same binary and the same map?

Markus

Richard Chirgwin:

> In running v.dissolve within a script, I am getting an intermittent
> failure:
>
> ERROR: key column must be integer or string
>
> Here's the script spot that fails (but only sometimes)
>
> v.db.addtable MAP
> v.db.addcol MAP columns="Dissolve int"

Markus N:

At this point, please run
v.info -c MAP

and report here.

> v.db.update MAP column=Dissolve value=1
> v.dissolve MAP output=DISSOLVE column=Dissolve

> The killer is that it isn't reliable - sometimes it works, sometimes it
> fails, and I can't tell why!

Always on the same machine, the same binary and the same map?

Markus, Richard,

in the past I witnessed some strange randomness myself. Can't find the post
anymore (where Markus was referring to Heisenberg or someone's
uncertainty theory?).

Cheers, Nikos

On Mon, Aug 16, 2010 at 10:14 AM, Nikos Alexandris
<nikos.alexandris@felis.uni-freiburg.de> wrote:

Richard Chirgwin:

...

> The killer is that it isn't reliable - sometimes it works, sometimes it
> fails, and I can't tell why!

Always on the same machine, the same binary and the same map?

Markus, Richard,

in the past I witnessed some strange randomness myself. Can't find the post
anymore (where Markus was referring to Heisenberg or someone's
uncertainty theory?).

You mean "Heisenbug":

On Tue, Sep 23, 2008 at 8:55 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:
[ .. referring to memory corruption ...]

It doesn't help that such bugs often fail to manifest if the program
is run under a debugger (colloquially referred to as a "Heisenbug", in
reference to the quantum mechanics principle that simply observing a
system can change its behaviour).

So far we are far away from such a bug, also since v.dissolve is simply a
script. First we need to obtain answers to above questions.

Markus

Markus Neteler wrote:

On Mon, Aug 16, 2010 at 10:14 AM, Nikos Alexandris
<nikos.alexandris@felis.uni-freiburg.de> wrote:
  

Richard Chirgwin:
    

...
  

The killer is that it isn't reliable - sometimes it works, sometimes it
fails, and I can't tell why!
        

Always on the same machine, the same binary and the same map?
      

Markus, Richard,

in the past I witnessed some strange randomness myself. Can't find the post
anymore (where Markus was referring to Heisenberg or someone's
uncertainty theory?).
    
You mean "Heisenbug":

On Tue, Sep 23, 2008 at 8:55 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:
[ .. referring to memory corruption ...]
  

It doesn't help that such bugs often fail to manifest if the program
is run under a debugger (colloquially referred to as a "Heisenbug", in
reference to the quantum mechanics principle that simply observing a
system can change its behaviour).
    
So far we are far away from such a bug, also since v.dissolve is simply a
script. First we need to obtain answers to above questions.

Markus

Markus,

I will try to get it to reproduce, and post the results here.

Cheers,
Richard Chirgwin

  In case anyone's wondering, I found out what happens.

The issue is the handling of case by the OSX command line. Most of the time, the OSX command line ignores case. For example:

v.clean MyMap output=CleanMap option=break,snap
works the same as:
v.clean mymap output=cleanmap option=break,snap

The only difference is that the output file name is cased - but a case-less input of a cased name works.

However, database handling is sometimes case-sensitive. If I create the column using v.db.addcol:

v.db.addcol MyMap columns="Dissolve int"

then these will behave the same:
v.db.update MyMap column=dissolve value=1
and
v.db.update MyMap column=Dissolve value=1

However, v.dissolve will notice the difference!
v.dissolve MyMap output=MyMap_Dissolved column=Dissolve -- works
v.dissolve MyMap output=MyMap_Dissolved column=dissolve
ERROR: Key column must be of type integer or string

I would file this in the tracker, but there's nobody around to reset my password!

So: in using v.dissolve, beware of case.

Cheers,
Richard

On 16/08/10 6:08 PM, Markus Neteler wrote:

On Sat, Aug 14, 2010 at 10:16 AM, Richard Chirgwin
<rchirgwin@ozemail.com.au> wrote:

Hi,

In running v.dissolve within a script, I am getting an intermittent failure:

ERROR: key column must be integer or string

Here's the script spot that fails (but only sometimes)

v.db.addtable MAP
v.db.addcol MAP columns="Dissolve int"

At this point, please run
v.info -c MAP

and report here.

v.db.update MAP column=Dissolve value=1
v.dissolve MAP output=DISSOLVE column=Dissolve

The killer is that it isn't reliable - sometimes it works, sometimes it
fails, and I can't tell why!

Always on the same machine, the same binary and the same map?

Markus