@@ -150,6 +150,12 @@ struct TS3ReadError : public yexception {
150
150
using yexception::yexception;
151
151
};
152
152
153
+ void ThrowParquetNotOk(arrow::Status status) {
154
+ if (!status.ok()) {
155
+ throw parquet::ParquetException(status.ToString());
156
+ }
157
+ }
158
+
153
159
using namespace NKikimr::NMiniKQL;
154
160
155
161
ui64 SubtractSaturating(ui64 lhs, ui64 rhs) {
@@ -641,8 +647,8 @@ class TS3ReadCoroImpl : public TActorCoroImpl {
641
647
642
648
// init the 1st reader, get meta/rg count
643
649
readers.resize(1);
644
- THROW_ARROW_NOT_OK (builder.Open(std::make_shared<THttpRandomAccessFile>(this, RetryStuff->SizeLimit)));
645
- THROW_ARROW_NOT_OK (builder.Build(&readers[0]));
650
+ ThrowParquetNotOk (builder.Open(std::make_shared<THttpRandomAccessFile>(this, RetryStuff->SizeLimit)));
651
+ ThrowParquetNotOk (builder.Build(&readers[0]));
646
652
auto fileMetadata = readers[0]->parquet_reader()->metadata();
647
653
648
654
bool hasPredicate = ReadSpec->Predicate.payload_case() != NYql::NConnector::NApi::TPredicate::PayloadCase::PAYLOAD_NOT_SET;
@@ -651,7 +657,7 @@ class TS3ReadCoroImpl : public TActorCoroImpl {
651
657
652
658
if (numGroups) {
653
659
std::shared_ptr<arrow::Schema> schema;
654
- THROW_ARROW_NOT_OK (readers[0]->GetSchema(&schema));
660
+ ThrowParquetNotOk (readers[0]->GetSchema(&schema));
655
661
std::vector<int> columnIndices;
656
662
std::vector<TColumnConverter> columnConverters;
657
663
@@ -688,17 +694,17 @@ class TS3ReadCoroImpl : public TActorCoroImpl {
688
694
// init other readers if any
689
695
readers.resize(readerCount);
690
696
for (ui64 i = 1; i < readerCount; i++) {
691
- THROW_ARROW_NOT_OK (builder.Open(std::make_shared<THttpRandomAccessFile>(this, RetryStuff->SizeLimit),
697
+ ThrowParquetNotOk (builder.Open(std::make_shared<THttpRandomAccessFile>(this, RetryStuff->SizeLimit),
692
698
parquet::default_reader_properties(),
693
699
fileMetadata));
694
- THROW_ARROW_NOT_OK (builder.Build(&readers[i]));
700
+ ThrowParquetNotOk (builder.Build(&readers[i]));
695
701
}
696
702
}
697
703
698
704
for (ui64 i = 0; i < readerCount; i++) {
699
705
if (!columnIndices.empty()) {
700
706
CurrentRowGroupIndex = i;
701
- THROW_ARROW_NOT_OK (readers[i]->WillNeedRowGroups({ hasPredicate ? static_cast<int>(matchedRowGroups[i]) : static_cast<int>(i) }, columnIndices));
707
+ ThrowParquetNotOk (readers[i]->WillNeedRowGroups({ hasPredicate ? static_cast<int>(matchedRowGroups[i]) : static_cast<int>(i) }, columnIndices));
702
708
SourceContext->IncChunkCount();
703
709
}
704
710
RowGroupReaderIndex[i] = i;
@@ -740,7 +746,7 @@ class TS3ReadCoroImpl : public TActorCoroImpl {
740
746
std::shared_ptr<arrow::Table> table;
741
747
742
748
LOG_CORO_D(" Decode RowGroup " << readyGroupIndex << " of " << numGroups << " from reader " << readyReaderIndex);
743
- THROW_ARROW_NOT_OK (readers[readyReaderIndex]->DecodeRowGroups({ hasPredicate ? static_cast<int>(matchedRowGroups[readyGroupIndex]) : static_cast<int>(readyGroupIndex) }, columnIndices, &table));
749
+ ThrowParquetNotOk (readers[readyReaderIndex]->DecodeRowGroups({ hasPredicate ? static_cast<int>(matchedRowGroups[readyGroupIndex]) : static_cast<int>(readyGroupIndex) }, columnIndices, &table));
744
750
readyGroupCount++;
745
751
746
752
auto downloadedBytes = ReadInflightSize[readyGroupIndex];
@@ -776,7 +782,7 @@ class TS3ReadCoroImpl : public TActorCoroImpl {
776
782
if (nextGroup < numGroups) {
777
783
if (!columnIndices.empty()) {
778
784
CurrentRowGroupIndex = nextGroup;
779
- THROW_ARROW_NOT_OK (readers[readyReaderIndex]->WillNeedRowGroups({ hasPredicate ? static_cast<int>(nextGroup) : static_cast<int>(nextGroup) }, columnIndices));
785
+ ThrowParquetNotOk (readers[readyReaderIndex]->WillNeedRowGroups({ hasPredicate ? static_cast<int>(nextGroup) : static_cast<int>(nextGroup) }, columnIndices));
780
786
SourceContext->IncChunkCount();
781
787
}
782
788
RowGroupReaderIndex[nextGroup] = readyReaderIndex;
@@ -810,11 +816,11 @@ class TS3ReadCoroImpl : public TActorCoroImpl {
810
816
properties.set_cache_options(arrow::io::CacheOptions::LazyDefaults());
811
817
properties.set_pre_buffer(true);
812
818
builder.properties(properties);
813
- THROW_ARROW_NOT_OK (builder.Open(arrowFile));
814
- THROW_ARROW_NOT_OK (builder.Build(&fileReader));
819
+ ThrowParquetNotOk (builder.Open(arrowFile));
820
+ ThrowParquetNotOk (builder.Build(&fileReader));
815
821
816
822
std::shared_ptr<arrow::Schema> schema;
817
- THROW_ARROW_NOT_OK (fileReader->GetSchema(&schema));
823
+ ThrowParquetNotOk (fileReader->GetSchema(&schema));
818
824
std::vector<int> columnIndices;
819
825
std::vector<TColumnConverter> columnConverters;
820
826
@@ -833,7 +839,7 @@ class TS3ReadCoroImpl : public TActorCoroImpl {
833
839
834
840
std::shared_ptr<arrow::Table> table;
835
841
ui64 ingressBytes = IngressBytes;
836
- THROW_ARROW_NOT_OK (fileReader->ReadRowGroup(group, columnIndices, &table));
842
+ ThrowParquetNotOk (fileReader->ReadRowGroup(group, columnIndices, &table));
837
843
ui64 downloadedBytes = IngressBytes - ingressBytes;
838
844
auto reader = std::make_unique<arrow::TableBatchReader>(*table);
839
845
0 commit comments