TIMESTAMP values in MySQL (and I think Clickhouse and Doris) can return fractional seconds but only when requested. Try "SELECT NOW(6);" for example, which will return a fractional timestamp. The SQL standard includes 6 places of precision by default, but other databases like MySQL default to 0. As I understand it, Calcite follows the SQL standard and returns fractional timestamps with 6 places of precision.
--Justin On Mon, Aug 18, 2025 at 4:31 AM Yanjing Wang <zhuangzixiao...@gmail.com> wrote: > Hello Community, I hope this email finds you well. I'm investigating the > expected behavior of ResultSet#getString() method when dealing with > Timestamp column type across different implementations. I've noticed that > Avatica's getString() returns Timestamp values in the format 'yyyy-MM-dd > HH:mm:ss.ppppp...' (where the count of 'p' matches the precision value), > while some other SQL engines like MySQL, ClickHouse and Apache Doris return > the format 'yyyy-MM-dd HH:mm:ss' without fractional seconds. This > difference in format handling raises some questions: 1. Is the format > 'yyyy-MM-dd HH:mm:ss.ppppp...' with precision the intended standard > behavior for Avatica's ResultSet#getString()? 2. Should other > implementations (like MySQL, ClickHouse and Doris connectors) that use > Avatica protocol align with this format? 3. Are there any specific > considerations or reasons for including/excluding the fractional seconds in > the string representation? Current observations: - Avatica: returns > 'yyyy-MM-dd HH:mm:ss.ppppp...' (with precision) - MySQL, ClickHouse, Apache > Doris: returns 'yyyy-MM-dd HH:mm:ss' > Understanding the standard expectation would help ensure consistency across > different implementations. Thank you for your time and guidance. Best > regards, Yanjing Wang >