-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from duckdb/jray/result-visitors
refactor result extraction to use visitors
- Loading branch information
Showing
5 changed files
with
83 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DuckDBDataChunk } from './DuckDBDataChunk'; | ||
import { DuckDBValue } from './values'; | ||
|
||
export function getColumnsFromChunks(chunks: readonly DuckDBDataChunk[]): DuckDBValue[][] { | ||
const columns: DuckDBValue[][] = []; | ||
if (chunks.length === 0) { | ||
return columns; | ||
} | ||
chunks[0].visitColumns(column => columns.push(column)); | ||
for (let chunkIndex = 1; chunkIndex < chunks.length; chunkIndex++) { | ||
for (let columnIndex = 0; columnIndex < columns.length; columnIndex++) { | ||
chunks[chunkIndex].visitColumnValues(columnIndex, value => columns[columnIndex].push(value)); | ||
} | ||
} | ||
return columns; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { DuckDBDataChunk } from './DuckDBDataChunk'; | ||
import { DuckDBValue } from './values'; | ||
|
||
export function getRowsFromChunks(chunks: readonly DuckDBDataChunk[]): DuckDBValue[][] { | ||
const rows: DuckDBValue[][] = []; | ||
for (const chunk of chunks) { | ||
chunk.visitRows(row => rows.push(row)); | ||
} | ||
return rows; | ||
} |