Skip to content

Commit

Permalink
ogr2ogr: remove hack related to Parquet dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Sep 4, 2024
1 parent eb2160e commit b81ef1c
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions apps/ogr2ogr_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5747,46 +5747,6 @@ bool LayerTranslator::TranslateArrow(

schema.release(&schema);

// Ugly hack to work around https://github.com/OSGeo/gdal/issues/9497
// Deleting a RecordBatchReader obtained from arrow::dataset::Scanner.ToRecordBatchReader()
// is a lengthy operation since all batches are read in its destructors.
// Here we ask to our custom I/O layer to return in error to short circuit
// that lengthy operation.
if (auto poDS = psInfo->m_poSrcLayer->GetDataset())
{
if (poDS->GetLayerCount() == 1 && poDS->GetDriver() &&
EQUAL(poDS->GetDriver()->GetDescription(), "PARQUET"))
{
bool bStopIO = false;
const char *pszArrowStopIO =
CPLGetConfigOption("OGR_ARROW_STOP_IO", nullptr);
if (pszArrowStopIO && CPLTestBool(pszArrowStopIO))
{
bStopIO = true;
}
else if (!pszArrowStopIO)
{
std::string osExePath;
osExePath.resize(1024);
if (CPLGetExecPath(osExePath.data(),
static_cast<int>(osExePath.size())))
{
osExePath.resize(strlen(osExePath.data()));
if (strcmp(CPLGetBasename(osExePath.data()), "ogr2ogr") ==
0)
{
bStopIO = true;
}
}
}
if (bStopIO)
{
CPLSetConfigOption("OGR_ARROW_STOP_IO", "YES");
CPLDebug("OGR2OGR", "Forcing interruption of Parquet I/O");
}
}
}

stream.release(&stream);
return bRet;
}
Expand Down

0 comments on commit b81ef1c

Please sign in to comment.