fix: page an upper-case .PARQUET key as a table in the S3 views

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-12-02 10:08:19 -08:00
co-authored by Claude Opus 5.5
parent c3c451d136
commit 5b75d257a7
2 changed files with 2 additions and 6 deletions
@@ -5,6 +5,7 @@ import { dbColumnKind } from './dbTableFilters'
describe('serverTableFormat', () => {
it('pages delimited text and newline-delimited JSON through the csv reader', () => {
expect(serverTableFormat('a/b.parquet')).toBe('parquet')
expect(serverTableFormat('a/b.PARQUET')).toBe('parquet')
for (const key of ['a.csv', 'a.TSV', 'a.jsonl', 'a.ndjson']) {
expect(serverTableFormat(key)).toBe('csv')
}
@@ -14,10 +15,6 @@ describe('serverTableFormat', () => {
expect(serverTableFormat('a.json')).toBeUndefined()
expect(serverTableFormat('a.txt')).toBeUndefined()
})
it('leaves an upper-case parquet extension to the download card', () => {
expect(serverTableFormat('a.PARQUET')).toBeUndefined()
})
})
describe('datatypeOf', () => {
+1 -2
View File
@@ -5,8 +5,7 @@ import type { IDbTableOps } from './dbOps'
/** Files the server can page through as a table, without reading them whole. */
export function serverTableFormat(fileKey: string): 'parquet' | 'csv' | undefined {
// The parquet reader requires the lower-case extension; the CSV reader takes any case.
if (fileKey.endsWith('.parquet')) return 'parquet'
if (/\.parquet$/i.test(fileKey)) return 'parquet'
if (/\.(csv|tsv|jsonl|ndjson)$/i.test(fileKey)) return 'csv'
return undefined
}