Bug report #16425

Error converting to integer 64 bits when output is a temporary layer

Added by Pablo Fernández Moniz about 7 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/Core
Affected QGIS version:2.14.13 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:no timely feedback
Crashes QGIS or corrupts data:No Copied to github as #:24334

Description

see comment #16425-3


After creating a new layer with processing, integer 64 bits fields (qlonglong) are incorrectly converted.

QGIS version: 2.14 and 2.18 for Windows 7 32 and 64 bits. (I does not fail in Linux nor OSX).

Steps to reproduce:

Load a layer(A) with two fields ID (type integer 64 bits, qlonglong) and geom (type linestring, for example). The ID field values use 18 digits.

Make some geoprocessing with the layer. In our case we ran “Line intersection” algorithm over the layer with itself. The unique field is set to be the ID field.

The resulting layer(B) sets the ID field to be of type text (QGIS 2.18) or uses type real (QGIS 2.14). Now we are not able to too compare the the IDs from A with IDs from B directly. Now:
In 2.18, we are forced to to convert A.ID to string to compare it with B.ID in 2.18, which is the layer that introduced the “error”. As a different workaround, if we try to convert the B.ID (which is int64) to int, we either get it shortened or an error saying it cannot be converted to int (as expected, we miss the to_int64 function).
In 2.14, we cannot make the comparison because the real field cuts off the last digits (it uses scientific notation, see attached image).

Therefore, we think that the qlonglong type should be used in the resulting layer B. While that is not possible, we also miss a to_int64 function to make the first workaround possible.

real_number_in_scientific_notation.png (25.6 KB) Pablo Fernández Moniz, 2017-04-07 05:51 AM

History

#1 Updated by Alexander Bruy almost 7 years ago

  • Category set to Processing/Core
  • Description updated (diff)

#2 Updated by Giovanni Manghi almost 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#3 Updated by Giovanni Manghi almost 7 years ago

  • Status changed from Open to Feedback
  • Priority changed from High to Normal

I just tested on master/QGIS3 and this seems to happen only if the output is a temporary layer, if the output is set to point to "normal" file then the column type is qlonglong.

#4 Updated by Giovanni Manghi almost 7 years ago

  • Subject changed from Error converting to integer 64 bits to Error converting to integer 64 bits when output is a temporary layer
  • Description updated (diff)

#5 Updated by Giovanni Manghi almost 7 years ago

  • Status changed from Feedback to Open

#6 Updated by Jürgen Fischer almost 7 years ago

  • Description updated (diff)

#7 Updated by Alexander Bruy about 5 years ago

  • Status changed from Open to Feedback

Please test with 3.4/master and attach sample data.

#8 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to no timely feedback
  • Status changed from Feedback to Closed

Closing for lack of feedback.

Also available in: Atom PDF