Skip to content

Commit

Permalink
Merge pull request rapidsai#10 from liurenjie1024/ray/shuffle0902
Browse files Browse the repository at this point in the history
Multi table serializer for kudo
  • Loading branch information
wjxiz1992 authored Sep 4, 2024
2 parents 5112a61 + f049d6c commit a9d83d6
Show file tree
Hide file tree
Showing 17 changed files with 1,469 additions and 1,019 deletions.
18 changes: 18 additions & 0 deletions java/src/main/java/ai/rapids/cudf/HostColumnVector.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package ai.rapids.cudf;

import ai.rapids.cudf.utils.Arms;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
Expand Down Expand Up @@ -283,6 +285,22 @@ public ColumnVector copyToDevice() {
}
}

/**
* Convert a list of HostColumnVectors to a Table.
* `columns` is closed after the Table is created.
*/
public static Table toTable(List<HostColumnVector> columns) {
ColumnVector[] cols = new ColumnVector[columns.size()];
try (CloseableArray<ColumnVector> array = CloseableArray.wrap(cols)) {
for (int i = 0; i < columns.size(); i += 1) {
array.set(i, columns.get(i).copyToDevice());
}
return new Table(array.getArray());
} finally {
Arms.closeQuietly(columns);
}
}

/////////////////////////////////////////////////////////////////////////////
// BUILDER
/////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit a9d83d6

Please sign in to comment.