[ 
https://issues.apache.org/jira/browse/CALCITE-7321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alessandro Solimando resolved CALCITE-7321.
-------------------------------------------
    Resolution: Fixed

Fixed via 
[{{6300c79}}|https://github.com/apache/calcite/commit/6300c7964c78592f4c276dc25e21fe35f80e1846],
 thanks to the reviewers for their help!

>  FilesTableFunction throws NumberFormatException on macOS with GNU stat 
> installed
> ---------------------------------------------------------------------------------
>
>                 Key: CALCITE-7321
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7321
>             Project: Calcite
>          Issue Type: Bug
>          Components: os-adapter
>    Affects Versions: 1.41.0
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.42.0
>
>
> h3. Problem
> Command generation assumes BSD stat on macOS in 
> [FilesTableFunction.java:121-143|https://github.com/apache/calcite/blob/935d6764258584b5c30f761042669d3a268bf44f/plus/src/main/java/org/apache/calcite/adapter/os/FilesTableFunction.java#L121-L143],
>  which breaks when GNU coreutils is installed via Homebrew.
> The BSD stat format flags (-f) are not recognized by GNU stat, causing it to 
> output default text format.
> The parser then attempts to convert descriptive text like "  File: .", 
> resulting in this stack-trace:
> {noformat}
> java.lang.NumberFormatException: Character   is neither a decimal digit 
> number, decimal point, nor "e" notation exponential mark.
> at 
> org.apache.calcite.adapter.os.FilesTableFunction$1$1$1.field(FilesTableFunction.java:256){noformat}
> h3. Solution
> Detect which stat implementation is available at runtime using stat --version 
> (BSD stat does not support this flag), and adapt the format specifiers 
> accordingly



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to