Skip to content

Commit

Permalink
closeOnExcept -> withResources in MetaUtils (NVIDIA#1107)
Browse files Browse the repository at this point in the history
* closeOnExcept -> withResources in MetaUtils

Signed-off-by: Alessandro Bellina <abellina@nvidia.com>

* getBatchFromMeta needs to add to the reference count

Signed-off-by: Alessandro Bellina <abellina@nvidia.com>
  • Loading branch information
abellina authored Nov 13, 2020
1 parent 706aef8 commit 9787f36
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ object MetaUtils extends Arm {
* @return table that must be closed by the caller
*/
def getTableFromMeta(deviceBuffer: DeviceMemoryBuffer, meta: TableMeta): Table = {
closeOnExcept(new ArrayBuffer[ColumnVector](meta.columnMetasLength())) { columns =>
withResource(new Array[ColumnVector](meta.columnMetasLength())) { columns =>
val columnMeta = new ColumnMeta
(0 until meta.columnMetasLength).foreach { i =>
columns.append(makeCudfColumn(deviceBuffer, meta.columnMetas(columnMeta, i)))
columns(i) = makeCudfColumn(deviceBuffer, meta.columnMetas(columnMeta, i))
}
new Table(columns :_*)
}
Expand Down

0 comments on commit 9787f36

Please sign in to comment.