-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
121 changed files
with
1,279 additions
and
1,978 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "serialization.h" | ||
#include <ydb/core/formats/arrow/switch/switch_type.h> | ||
#include <ydb/library/actors/core/log.h> | ||
|
||
namespace NKikimr::NArrow::NScalar { | ||
|
||
TConclusion<TString> TSerializer::SerializePayloadToString(const std::shared_ptr<arrow::Scalar>& scalar) { | ||
TString resultString; | ||
const bool resultFlag = NArrow::SwitchType(scalar->type->id(), [&](const auto& type) { | ||
using TWrap = std::decay_t<decltype(type)>; | ||
if constexpr (arrow::has_c_type<typename TWrap::T>()) { | ||
using CType = typename TWrap::T::c_type; | ||
using ScalarType = typename arrow::TypeTraits<typename TWrap::T>::ScalarType; | ||
const ScalarType* scalarTyped = static_cast<const ScalarType*>(scalar.get()); | ||
resultString = TString(sizeof(CType), '\0'); | ||
memcpy(&resultString[0], scalarTyped->data(), sizeof(CType)); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
if (!resultFlag) { | ||
return TConclusionStatus::Fail("incorrect scalar type for payload serialization: " + scalar->type->ToString()); | ||
} | ||
return resultString; | ||
} | ||
|
||
TConclusion<std::shared_ptr<arrow::Scalar>> TSerializer::DeserializeFromStringWithPayload(const TString& data, const std::shared_ptr<arrow::DataType>& dataType) { | ||
AFL_VERIFY(dataType); | ||
std::shared_ptr<arrow::Scalar> result; | ||
const bool resultFlag = NArrow::SwitchType(dataType->id(), [&](const auto& type) { | ||
using TWrap = std::decay_t<decltype(type)>; | ||
if constexpr (arrow::has_c_type<typename TWrap::T>()) { | ||
using CType = typename TWrap::T::c_type; | ||
AFL_VERIFY(data.size() == sizeof(CType)); | ||
using ScalarType = typename arrow::TypeTraits<typename TWrap::T>::ScalarType; | ||
result = std::make_shared<ScalarType>(*(CType*)&data[0], dataType); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
if (!resultFlag) { | ||
return TConclusionStatus::Fail("incorrect scalar type for payload deserialization: " + dataType->ToString()); | ||
} | ||
return result; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#include <ydb/library/conclusion/result.h> | ||
|
||
#include <contrib/libs/apache/arrow/cpp/src/arrow/scalar.h> | ||
#include <contrib/libs/apache/arrow/cpp/src/arrow/type.h> | ||
|
||
#include <util/generic/string.h> | ||
|
||
namespace NKikimr::NArrow::NScalar { | ||
class TSerializer { | ||
public: | ||
static TConclusion<TString> SerializePayloadToString(const std::shared_ptr<arrow::Scalar>& scalar); | ||
static TConclusion<std::shared_ptr<arrow::Scalar>> DeserializeFromStringWithPayload(const TString& data, const std::shared_ptr<arrow::DataType>& dataType); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
LIBRARY() | ||
|
||
PEERDIR( | ||
contrib/libs/apache/arrow | ||
ydb/library/conclusion | ||
ydb/core/formats/arrow/switch | ||
ydb/library/actors/core | ||
) | ||
|
||
SRCS( | ||
serialization.cpp | ||
) | ||
|
||
END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_stat.cpp
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_stat.h
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
ydb/core/kqp/gateway/behaviour/tablestore/operations/upsert_stat.cpp
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
ydb/core/kqp/gateway/behaviour/tablestore/operations/upsert_stat.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.