Skip to content

Commit fd8f312

Browse files
committed
start the CArrowTableIterator work
1 parent d993224 commit fd8f312

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

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

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define PC_ARROWTABLEITERATOR_HPP
77

88
#include "CArrowIterator.hpp"
9+
#include "nanoarrow.h"
10+
#include "nanoarrow.hpp"
911
#include <string>
1012
#include <memory>
1113
#include <vector>
@@ -84,6 +86,16 @@ class CArrowTableIterator : public CArrowIterator
8486
bool& needsRebuild
8587
);
8688

89+
void replaceColumn_nanoarrow(
90+
const unsigned int batchIdx,
91+
const int colIdx,
92+
ArrowSchemaView* newField,
93+
ArrowArrayView* newColumn,
94+
std::vector<ArrowSchemaView*>& futureFields,
95+
std::vector<ArrowArrayView*>& futureColumns,
96+
bool& needsRebuild
97+
);
98+
8799
/**
88100
* convert scaled fixed number column to Decimal, or Double column based on setting
89101
*/
@@ -98,6 +110,17 @@ class CArrowTableIterator : public CArrowIterator
98110
bool& needsRebuild
99111
);
100112

113+
void convertScaledFixedNumberColumn_nanoarrow(
114+
const unsigned int batchIdx,
115+
const int colIdx,
116+
ArrowSchemaView* field,
117+
ArrowArrayView* columnArray,
118+
const unsigned int scale,
119+
std::vector<ArrowSchemaView*>& futureFields,
120+
std::vector<ArrowArrayView*>& futureColumns,
121+
bool& needsRebuild
122+
);
123+
101124
/**
102125
* convert scaled fixed number column to Decimal column
103126
*/
@@ -112,6 +135,17 @@ class CArrowTableIterator : public CArrowIterator
112135
bool& needsRebuild
113136
);
114137

138+
void convertScaledFixedNumberColumnToDecimalColumn_nanoarrow(
139+
const unsigned int batchIdx,
140+
const int colIdx,
141+
ArrowSchemaView* field,
142+
ArrowArrayView* columnArray,
143+
const unsigned int scale,
144+
std::vector<ArrowSchemaView*>& futureFields,
145+
std::vector<ArrowArrayView*>& futureColumns,
146+
bool& needsRebuild
147+
);
148+
115149
/**
116150
* convert scaled fixed number column to Double column
117151
*/
@@ -126,6 +160,17 @@ class CArrowTableIterator : public CArrowIterator
126160
bool& needsRebuild
127161
);
128162

163+
void convertScaledFixedNumberColumnToDoubleColumn_nanoarrow(
164+
const unsigned int batchIdx,
165+
const int colIdx,
166+
ArrowSchemaView* field,
167+
ArrowArrayView* columnArray,
168+
const unsigned int scale,
169+
std::vector<ArrowSchemaView*>& futureFields,
170+
std::vector<ArrowArrayView*>& futureColumns,
171+
bool& needsRebuild
172+
);
173+
129174
/**
130175
* convert Snowflake Time column (Arrow int32/int64) to Arrow Time column
131176
* Since Python/Pandas Time does not support nanoseconds, this function truncates values to microseconds if necessary
@@ -141,6 +186,17 @@ class CArrowTableIterator : public CArrowIterator
141186
bool& needsRebuild
142187
);
143188

189+
void convertTimeColumn_nanoarrow(
190+
const unsigned int batchIdx,
191+
const int colIdx,
192+
ArrowSchemaView* field,
193+
ArrowArrayView* columnArray,
194+
const int scale,
195+
std::vector<ArrowSchemaView*>& futureFields,
196+
std::vector<ArrowArrayView*>& futureColumns,
197+
bool& needsRebuild
198+
);
199+
144200
/**
145201
* convert Snowflake TimestampNTZ/TimestampLTZ column to Arrow Timestamp column
146202
*/
@@ -156,6 +212,18 @@ class CArrowTableIterator : public CArrowIterator
156212
const std::string timezone=""
157213
);
158214

215+
void convertTimestampColumn_nanoarrow(
216+
const unsigned int batchIdx,
217+
const int colIdx,
218+
ArrowSchemaView* field,
219+
ArrowArrayView* columnArray,
220+
const int scale,
221+
std::vector<ArrowSchemaView*>& futureFields,
222+
std::vector<ArrowArrayView*>& futureColumns,
223+
bool& needsRebuild,
224+
const std::string timezone=""
225+
);
226+
159227
/**
160228
* convert Snowflake TimestampTZ column to Arrow Timestamp column in UTC
161229
* Arrow Timestamp does not support time zone info in each value, so this method convert TimestampTZ to Arrow
@@ -174,6 +242,19 @@ class CArrowTableIterator : public CArrowIterator
174242
const std::string timezone
175243
);
176244

245+
void convertTimestampTZColumn_nanoarrow(
246+
const unsigned int batchIdx,
247+
const int colIdx,
248+
ArrowSchemaView* field,
249+
ArrowArrayView* columnArray,
250+
const int scale,
251+
const int byteLength,
252+
std::vector<ArrowSchemaView*>& futureFields,
253+
std::vector<ArrowArrayView*>& futureColumns,
254+
bool& needsRebuild,
255+
const std::string timezone
256+
);
257+
177258
/**
178259
* convert scaled fixed number to double
179260
* if scale is small, then just divide based on the scale; otherwise, convert the value to string first and then

0 commit comments

Comments
 (0)