Skip to content

Commit d993224

Browse files
committed
code clean up
1 parent a0f9f88 commit d993224

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/snowflake/connector/cpp/ArrowIterator/CArrowChunkIterator.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ void CArrowChunkIterator::initColumnConverters()
149149
m_currentBatchConverters.clear();
150150
std::shared_ptr<arrow::RecordBatch> currentBatch =
151151
(*m_cRecordBatches)[m_currentBatchIndex];
152-
m_currentSchema = currentBatch->schema();
153152

154153
// Recommended path
155154
// TODO: Export is not needed when using nanoarrow IPC to read schema
@@ -538,15 +537,15 @@ DictCArrowChunkIterator::DictCArrowChunkIterator(PyObject* context,
538537
void DictCArrowChunkIterator::createRowPyObject()
539538
{
540539
m_latestReturnedRow.reset(PyDict_New());
541-
for (int i = 0; i < m_currentSchema->num_fields(); i++)
540+
for (int i = 0; i < m_arrowSchema->n_children; i++)
542541
{
543542
py::UniqueRef value(m_currentBatchConverters[i]->toPyObject(m_rowIndexInBatch));
544543
if (!value.empty())
545544
{
546545
// PyDict_SetItemString doesn't steal a reference to value.get().
547546
PyDict_SetItemString(
548547
m_latestReturnedRow.get(),
549-
m_currentSchema->field(i)->name().c_str(),
548+
m_arrowSchema->children[i]->name,
550549
value.get());
551550
}
552551
}

src/snowflake/connector/cpp/ArrowIterator/CArrowChunkIterator.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ class CArrowChunkIterator : public CArrowIterator
5353
/** row index inside current record batch (start from 0) */
5454
int m_rowIndexInBatch;
5555

56-
57-
/** schema of current record batch */
58-
std::shared_ptr<arrow::Schema> m_currentSchema;
59-
6056
/** nanoarrow data */
6157
nanoarrow::UniqueSchema m_arrowSchema;
6258
nanoarrow::UniqueArray m_arrowArray;

0 commit comments

Comments
 (0)