Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Sep 15, 2023
1 parent 4b3a800 commit 1884913
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions velox/type/Subfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace facebook::velox::common {
Subfield::Subfield(
const std::string& path,
const std::shared_ptr<Separators>& separators) {
auto instance = Separators::get();
Tokenizer tokenizer(path, separators);
VELOX_CHECK(tokenizer.hasNext(), "Column name is missing: {}", path);

Expand Down
10 changes: 7 additions & 3 deletions velox/type/Subfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ enum SubfieldKind {
kLongSubscript
};

// Contains field name separators to use in Tokenizer.
// Contains field name separators to be used in Tokenizer.
struct Separators {
static const std::shared_ptr<const Separators>& get() {
static const std::shared_ptr<const Separators> instance{new Separators()};
return instance;
}

bool isSeparator(char c) const {
return (
c == closeBracket || c == dot || c == openBracket || c == quote ||
Expand Down Expand Up @@ -213,8 +218,7 @@ class Subfield {
// Separators: the customized separators to tokenize field name.
explicit Subfield(
const std::string& path,
const std::shared_ptr<Separators>& separators =
std::make_shared<Separators>());
const std::shared_ptr<Separators>& separators = std::make_shared<Separators>());

explicit Subfield(std::vector<std::unique_ptr<PathElement>>&& path);

Expand Down

0 comments on commit 1884913

Please sign in to comment.