fix(iotdb): render timestamps in session zone and type max_by
This commit is contained in:
6 files changed
+62
-6
No files matched your search
@@ -164,9 +164,14 @@ describe("defaultIoTDBTimestampFormatter", () => {
|
||||
expect(defaultIoTDBTimestampFormatter("iotdb", "INT64", "time_zone=Asia%2FShanghai")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("uses UTC when the connection does not specify a time zone", () => {
|
||||
it("uses the IoTDB client session default when the connection does not specify a time zone", () => {
|
||||
const formatter = defaultIoTDBTimestampFormatter("iotdb", "TIMESTAMP(ms)", "");
|
||||
expect(applyColumnFormatter(1, formatter)).toBe("1970-01-01T00:00:00.001+00:00");
|
||||
expect(applyColumnFormatter("1787759999000", formatter)).toBe("2026-08-26T23:59:59.000+08:00");
|
||||
});
|
||||
|
||||
it("falls back to the IoTDB client session default for an invalid configured zone", () => {
|
||||
const formatter = defaultIoTDBTimestampFormatter("iotdb", "TIMESTAMP(ms)", "time_zone=Not%2FAZone");
|
||||
expect(applyColumnFormatter(1, formatter)).toBe("1970-01-01T08:00:00.001+08:00");
|
||||
});
|
||||
|
||||
it("round-trips a negative nanosecond timestamp without truncating toward zero", () => {
|
||||
|
||||
@@ -429,12 +429,15 @@ export function iotdbTimestampFractionDigits(precision: IoTDBTimestampPrecision)
|
||||
|
||||
function iotdbTimestampTimeZone(urlParams: string | undefined): string {
|
||||
const params = new URLSearchParams(urlParams ?? "");
|
||||
const candidate = params.get("time_zone") || params.get("timezone") || params.get("zone_id") || "UTC";
|
||||
// Keep display aligned with the IoTDB Go client's default session zone.
|
||||
// Otherwise an unconfigured connection interprets SQL literals in
|
||||
// Asia/Shanghai but the grid renders the returned epoch in UTC.
|
||||
const candidate = params.get("time_zone") || params.get("timezone") || params.get("zone_id") || "Asia/Shanghai";
|
||||
try {
|
||||
dayjs(0).tz(candidate);
|
||||
return candidate;
|
||||
} catch {
|
||||
return "UTC";
|
||||
return "Asia/Shanghai";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user