Skip to content

Commit a1f4cd4

Browse files
authored
fix(athena-driver): Correct handling for NULL values (#6171)
1 parent 112300e commit a1f4cd4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/cubejs-athena-driver/src/AthenaDriver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ export class AthenaDriver extends BaseDriver implements DriverInterface {
343343
const fields: Record<string, any> = {};
344344
columnInfo
345345
.forEach((c, j) => {
346-
fields[c.Name] = row.Data?.[j].VarCharValue;
346+
const r = row.Data;
347+
fields[c.Name] = (r === null || r === undefined || r[j].VarCharValue === undefined) ? null : r[j].VarCharValue;
347348
});
348349
yield fields as R;
349350
}

packages/cubejs-testing-shared/src/DriverTests.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export class DriverTests {
3434
SELECT 2 AS id, 200 AS amount, 'new' AS status
3535
UNION ALL
3636
SELECT 3 AS id, 400 AS amount, 'processed' AS status
37+
UNION ALL
38+
SELECT 4 AS id, 500 AS amount, NULL AS status
3739
) AS data
3840
ORDER BY 1
3941
`;
@@ -42,6 +44,7 @@ export class DriverTests {
4244
{ id: 1, amount: 100, status: 'new' },
4345
{ id: 2, amount: 200, status: 'new' },
4446
{ id: 3, amount: 400, status: 'processed' },
47+
{ id: 4, amount: 500, status: null },
4548
];
4649

4750
public static CSV_ROWS = dedent`

0 commit comments

Comments
 (0)