Skip to content
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

HPCC-30524 Parquet Strings cannot be converted to REAL #17909

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions plugins/parquet/parquetembed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,12 +956,44 @@ __int64 ParquetRowBuilder::getCurrIntValue(const RtlFieldInfo *field)
{
__int64 myint64 = 0;
auto scalar = getCurrView(field);
handleDeserializeOutcome(tokenDeserializer.deserialize(scalar.data(), myint64), "signed", scalar.data());
std::string scalarStr(scalar.data(), scalar.size());
handleDeserializeOutcome(tokenDeserializer.deserialize(scalarStr.c_str(), myint64), "signed", scalarStr.c_str());
return myint64;
}
}
}

double ParquetRowBuilder::getCurrRealValue(const RtlFieldInfo *field)
{
switch ((*array_visitor)->type)
{
case BoolType:
return (*array_visitor)->bool_arr->Value(currArrayIndex());
case IntType:
return getSigned(array_visitor, currArrayIndex());
case UIntType:
return getUnsigned(array_visitor, currArrayIndex());
case RealType:
return getReal(array_visitor, currArrayIndex());
case DateType:
return (*array_visitor)->size == 32 ? (*array_visitor)->date32_arr->Value(currArrayIndex()) : (*array_visitor)->date64_arr->Value(currArrayIndex());
case TimestampType:
return (*array_visitor)->timestamp_arr->Value(currArrayIndex());
case TimeType:
return (*array_visitor)->size == 32 ? (*array_visitor)->time32_arr->Value(currArrayIndex()) : (*array_visitor)->time64_arr->Value(currArrayIndex());
case DurationType:
return (*array_visitor)->duration_arr->Value(currArrayIndex());
default:
{
double mydouble = 0.0;
auto scalar = getCurrView(field);
std::string scalarStr(scalar.data(), scalar.size());
handleDeserializeOutcome(tokenDeserializer.deserialize(scalarStr.c_str(), mydouble), "real", scalarStr.c_str());
return mydouble;
}
}
}

/**
* @brief Gets a Boolean result for an ECL Row
*
Expand Down Expand Up @@ -1020,10 +1052,7 @@ double ParquetRowBuilder::getRealResult(const RtlFieldInfo *field)
return p.doubleResult;
}

if ((*array_visitor)->type == RealType)
return getReal(array_visitor, currArrayIndex());
else
return getCurrIntValue(field);
return getCurrRealValue(field);
}

/**
Expand Down
1 change: 1 addition & 0 deletions plugins/parquet/parquetembed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ class ParquetRowBuilder : public CInterfaceOf<IFieldSource>
const std::shared_ptr<arrow::Array> &getChunk(std::shared_ptr<arrow::ChunkedArray> *column);
std::string_view getCurrView(const RtlFieldInfo *field);
__int64 getCurrIntValue(const RtlFieldInfo *field);
double getCurrRealValue(const RtlFieldInfo *field);
void nextField(const RtlFieldInfo *field);
void nextFromStruct(const RtlFieldInfo *field);
void xpathOrName(StringBuffer &outXPath, const RtlFieldInfo *field) const;
Expand Down
Loading