-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace cast string to fixed function in driver.cpp #2221
Conversation
7274d49
to
8db586d
Compare
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2221 +/- ##
==========================================
- Coverage 89.57% 89.56% -0.02%
==========================================
Files 1006 1006
Lines 36273 36313 +40
==========================================
+ Hits 32493 32523 +30
- Misses 3780 3790 +10
☔ View full report in Codecov by Sentry. |
5ac6d5b
to
58641cf
Compare
|
||
template<> | ||
void copyStringToVector(ValueVector* vector, uint64_t rowToAdd, std::string_view strVal, | ||
const CSVReaderConfig& csvReaderConfig, int16_t value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The casting for numeric types are very similar: You can implement the casting for numeric types in the template function body, and use specialization for other types. So you don't need to duplicate the code for numeric type casting.
The numeric type casting:
if (strVal.empty() || isNull(strVal)) {
vector->setNull(rowToAdd, true /* isNull */);
return;
} else {
vector->setNull(rowToAdd, false /* isNull */);
}
function::simpleIntegerCast<T>(
strVal.data(), strVal.length(), value, vector->getDataType());
vector->setValue(rowToAdd, value);
Using this generic templated numeric type casting function, you don't need to duplicate the common code for all numeric types.
Anyways, feel free to ping me if you have questions regarding to the refactor. Or you can leave it to me.
b67e29d
to
b5673fe
Compare
ToDo
add more testsfixed float conversion bug (probably just because the digits are full)error messageFLOAT(20)
x 100000