Skip to content

Commit dce396d

Browse files
authored
Make the loop iterating over multiple parquet files parallel (#5486)
This makes the loop over multiple parquet files parallel This PR is the same as #4952, except it fixes the bug exposed by that PR. `CPtrsToData` and `CPtrsToWhereNulls` need to be local for each parallel task, so they must be declared inside of the forall loop. Technically, they will be instantiated more than they really need to be, but it is correct. Resolves #4952 Signed-off-by: Jade Abraham <jade.abraham@hpe.com>
1 parent 27b1bb5 commit dce396d

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/ParquetMsg.chpl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,20 +1281,24 @@ module ParquetMsg {
12811281

12821282
var subdoms = getSubdomains(this.sizes);
12831283

1284+
pqLogger.debug(getM(), getR(), getL(),
1285+
"readInto with e.domain=%?, ty=%?, offsets=%?, subdoms=%?, filenames=%?"
1286+
.format(e.domain, this.ty, this.offsets, subdoms, this.filenames));
1287+
12841288
coforall loc in Locales with (ref this) do on loc {
12851289
const LocTypes = this.ty;
1286-
var CPtrsToData: [e.domain] c_ptr(void);
1287-
var CPtrsToWhereNulls: [e.domain] c_ptr(void);
12881290

12891291
const ref DataDom = getDomain(e);
12901292

1291-
for (off, filedom, filename) in zip(this.offsets, subdoms, this.filenames) {
1293+
forall (off, filedom, filename) in zip(this.offsets, subdoms, this.filenames) with (ref this) {
1294+
var CPtrsToData: [e.domain] c_ptr(void);
1295+
var CPtrsToWhereNulls: [e.domain] c_ptr(void);
12921296
for locdom in DataDom.localSubdomains() {
12931297
const intersection = domain_intersection(locdom, filedom);
12941298
if intersection.size > 0 {
12951299
for colIdx in e.domain {
12961300
pqLogger.debug(getM(), getR(), getL(), "Locale " + here.id:string +
1297-
" will read " + intersection:string);
1301+
" will read " + intersection:string, " for column " + colIdx:string);
12981302
pqLogger.debug(getM(), getR(), getL(), "\tCTypes %?\n".format(LocTypes));
12991303
pqLogger.debug(getM(), getR(), getL(), "\tnullMode %?\n".format(nullMode));
13001304
CPtrsToData[colIdx] = getPtr(e=e[colIdx],
@@ -1308,6 +1312,9 @@ module ParquetMsg {
13081312
}
13091313

13101314
var pqErr = new parquetErrorMsg();
1315+
const startIdx = intersection.low - off;
1316+
pqLogger.debug(getM(), getR(), getL(), "about to call c_readAllCols for locale %? with filename=%?, startIdx=%?, ptrs=%?"
1317+
.format(here.id, filename, startIdx, CPtrsToData));
13111318
if c_readAllCols(filename.localize().c_str(),
13121319
c_ptrTo(CPtrsToData), c_ptrToConst(LocTypes),
13131320
c_ptrTo(CPtrsToWhereNulls),

0 commit comments

Comments
 (0)