<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
font-size:10.0pt;
font-family:"Courier New";
mso-ligatures:none;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Consolas",serif;
mso-ligatures:standardcontextual;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>It is the same schema but writing the different files with must be optimizing the timestamps and adjusting the scale. I guess I need to force it to write it all with the same resolution. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Yeah, not a sqlite thing but when using OGR Sql I don’t get the same error. But I can replicate the error just reading with pyarrow and geopandas.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Mike<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>-- <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>Michael Smith<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>RSGIS Center – ERDC CRREL NH<o:p></o:p></span></p></div></div><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>US Army Corps</span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='color:black'>From: </span></b><span style='color:black'>Even Rouault <even.rouault@spatialys.com><br><b>Date: </b>Saturday, July 26, 2025 at 3:42 PM<br><b>To: </b>Michael Smith <michael.smith.erdc@gmail.com>, <gdal-dev@lists.osgeo.org><br><b>Subject: </b>Re: [gdal-dev] Timestamp cast error in GDAL Parquet Directory with sqlite dialect</span><span style='color:black;mso-ligatures:none'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Aptos",sans-serif'><o:p> </o:p></span></p></div><p>Michael,<o:p></o:p></p><p>are you sure this is the *same* schema ? From the error messages (which comes from libarrow-compute itself), it would seem there's a mix of timestamp in microsecond and timestamp in nanosecond, and that the algorithm in libarrow tries to homogenize things and an overflow occur. If 237718454400000000 is a timestamp in microseconds, that corresponds to January 1st 9503... I doubt the SQLite dialect plays any role in that.<o:p></o:p></p><p>Even<o:p></o:p></p><div><p class=MsoNormal>Le 26/07/2025 à 20:56, Michael Smith via gdal-dev a écrit :<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal>I have a collection of parquet files all with the same schema, different stac collections written using geopandas to parquet. <o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>When I query at the cli or in python for a directory of parquert files using sql I get timestamp casting errors<br><br><br><o:p></o:p></p><p class=MsoNormal>gdal vector info -i PARQUET:s3://mybucket/stac/mds/rasters/ --sql "select * from 'rasters' where st_intersects(geometry, st_geomfromtext('POLYGON ((-68.00948853933728 17.7602787370086, -64.99052950907739 17.7602787370086, -64.99052950907739 18.6509945435268, -68.00948853933728 18.6509945435268, -68.00948853933728 17.7602787370086))'))" --dialect sqlite -f text<o:p></o:p></p><p class=MsoNormal>INFO: Open of `PARQUET:s3://grid-dev-publiclidar/stac/mds/rasters/'<o:p></o:p></p><p class=MsoNormal> using driver `Parquet' successful.<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Layer name: SELECT<o:p></o:p></p><p class=MsoNormal>Geometry: Polygon<o:p></o:p></p><p class=MsoNormal>ERROR 1: ReadNext() failed: Casting from timestamp[us, tz=UTC] to timestamp[ns, tz=UTC] would result in out of bounds timestamp: 237718454400000000<o:p></o:p></p><p class=MsoNormal>Feature Count: 34<o:p></o:p></p><p class=MsoNormal>ERROR 1: ReadNext() failed: Casting from timestamp[us, tz=UTC] to timestamp[ns, tz=UTC] would result in out of bounds timestamp: 237718454400000000<o:p></o:p></p><p class=MsoNormal>Extent: (-180.000000, -90.000000) - (180.000000, 83.999167)<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>If I do it file by file for all the parquet in a directory, I don’t get an error. <o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Is this a bug or a problem with sqlite dialect and parquet?<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><div><div><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>-- </span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>Michael Smith</span><o:p></o:p></p><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>RSGIS Center – ERDC CRREL NH</span><o:p></o:p></p><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'>US Army Corps</span><o:p></o:p></p></div></div><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><span style='font-family:"Aptos",sans-serif;mso-ligatures:none'><br><br><o:p></o:p></span></p><pre>_______________________________________________<o:p></o:p></pre><pre>gdal-dev mailing list<o:p></o:p></pre><pre><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre><pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre></blockquote><pre>-- <o:p></o:p></pre><pre><a href="http://www.spatialys.com">http://www.spatialys.com</a><o:p></o:p></pre><pre>My software is free, but my time generally not.<o:p></o:p></pre></div></body></html>