Opened 5 years ago

Closed 5 years ago

#7192 closed defect (fixed)

XLSX Filter: Misdetection of field type if first cell blank

Reported by: mccuskk Owned by: warmerdam
Priority: normal Milestone: 2.3.0
Component: OGR_SF Version: 2.2.3
Severity: normal Keywords:
Cc:

Description (last modified by mccuskk)

If you run the following against the supplied file:

ogrinfo -ro -where 'fid = 1' "7192.xlsx" Sheet1

The columns "Works Order" and "Appointment" are both shown as type String. Adding values in the first cell of the column gives their correct types of Integer and Date respectively.

Attachments (2)

7192.xlsx (7.6 KB ) - added by mccuskk 5 years ago.
0001-Bug-fixes.patch (7.2 KB ) - added by mccuskk 5 years ago.
Patch file containing fixes for this bug and #7193

Download all attachments as: .zip

Change History (8)

by mccuskk, 5 years ago

Attachment: 7192.xlsx added

comment:1 by mccuskk, 5 years ago

Description: modified (diff)

by mccuskk, 5 years ago

Attachment: 0001-Bug-fixes.patch added

Patch file containing fixes for this bug and #7193

comment:2 by Even Rouault, 5 years ago

Thanks for your patch. Could you rework it without the addition of OFTUnknown ? As OGRFieldType is part of the C API, I would prefer if we could avoid extending it, since it means that client code could possibly receive OFTUnknown, whereas it is only something internal to the library. Submitting it as a PR against https://github.com/OSGeo/gdal could allow us checking more easily if it breaks stuff. And adding new test case(s) in autotest/ogr/ogr_xlsx.py would be welcome

comment:3 by mccuskk, 5 years ago

I've reworked the changes and created a PR for trunk. I'm happy to do autotests but trying to run ./run_all.py in the autotests folder gives me

File "./run_all.py", line 37, in <module>

import gdaltest

File "pymod/gdaltest.py", line 39, in <module>

from osgeo import gdal

ImportError: No module named osgeo

Do I need to set some paths first?

Many Thanks

Kieran McCusker

comment:4 by Even Rouault, 5 years ago

Do I need to set some paths first?

You need first to build the Python bindings:

cd swig/python
make

and then set

export PYTHONPATH=$PWD/build/lib.linux-x86_64-2.7 (to adapt to the actual directory name)

comment:5 by mccuskk, 5 years ago

I have now added the autotest tests for this PR.

Looking at the PR I notice it has a cross against it with a tooltip of:

0 / 2 Checks OK

Is this something I need to worry about? Where can I find out what checks it is doing?

comment:6 by Even Rouault, 5 years ago

Milestone: 2.3.0
Resolution: fixed
Status: newclosed

Was fixed per r41282

Note: See TracTickets for help on using tickets.