diff --git a/velox/type/Subfield.h b/velox/type/Subfield.h index c569640975498..5d65c15134f1c 100644 --- a/velox/type/Subfield.h +++ b/velox/type/Subfield.h @@ -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& default() { + static const std::shared_ptr instance{new Separators()}; + return instance; + } + bool isSeparator(char c) const { return ( c == closeBracket || c == dot || c == openBracket || c == quote || @@ -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 = - std::make_shared()); + const std::shared_ptr& separators = Separators::default()); explicit Subfield(std::vector>&& path);