Skip to content

Commit a24dbe5

Browse files
han-yan01facebook-github-bot
authored andcommitted
Add name() static method to VectorSerde classes (facebookincubator#16757)
Summary: Add static name() method to PrestoVectorSerde, CompactRowVectorSerde, and UnsafeRowVectorSerde to provide a compile-time serde name accessor. This allows callers to reference serde names without hardcoding strings. This is extracted from D96046667 as a minimal API addition to unblock axiom migration (D96254285) while the full refactor is reviewed. Reviewed By: xiaoxmeng Differential Revision: D96412951
1 parent e84a676 commit a24dbe5

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

velox/serializers/CompactRowSerializer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ namespace facebook::velox::serializer {
2222

2323
class CompactRowVectorSerde : public VectorSerde {
2424
public:
25-
CompactRowVectorSerde() : VectorSerde("CompactRow") {}
25+
CompactRowVectorSerde() : VectorSerde(name()) {}
26+
27+
static const std::string& name() {
28+
static const std::string kName{"CompactRow"};
29+
return kName;
30+
}
2631

2732
void estimateSerializedSize(
2833
const row::CompactRow* compactRow,

velox/serializers/PrestoSerializer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ class PrestoVectorSerde : public VectorSerde {
8888
bool preserveEncodings{false};
8989
};
9090

91-
PrestoVectorSerde() : VectorSerde("Presto") {}
91+
PrestoVectorSerde() : VectorSerde(name()) {}
92+
93+
static const std::string& name() {
94+
static const std::string kName{"Presto"};
95+
return kName;
96+
}
9297

9398
/// Adds the serialized sizes of the rows of 'vector' in 'ranges[i]' to
9499
/// '*sizes[i]'.

velox/serializers/UnsafeRowSerializer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ namespace facebook::velox::serializer::spark {
2121

2222
class UnsafeRowVectorSerde : public VectorSerde {
2323
public:
24-
UnsafeRowVectorSerde() : VectorSerde("UnsafeRow") {}
24+
UnsafeRowVectorSerde() : VectorSerde(name()) {}
25+
26+
static const std::string& name() {
27+
static const std::string kName{"UnsafeRow"};
28+
return kName;
29+
}
2530

2631
void estimateSerializedSize(
2732
const row::UnsafeRowFast* unsafeRow,

0 commit comments

Comments
 (0)