Skip to content

Commit

Permalink
YTORM-1187: Fix IN and BETWEEN expression work with indexes
Browse files Browse the repository at this point in the history
commit_hash:12d86de033f73ea238ebde7f47b689d30014119a
  • Loading branch information
Disadvantaged committed Oct 17, 2024
1 parent 816140d commit 6d2b9a9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
32 changes: 16 additions & 16 deletions library/cpp/yt/string/string-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "string.h"
#endif

#include "format.h"
#include "string_builder.h"

namespace NYT {

Expand All @@ -19,7 +19,7 @@ namespace NYT {
* \param delimiter A delimiter to be inserted between items: ", " by default.
* \return The resulting combined string.
*/
template <class TIterator, class TFormatter>
template <std::forward_iterator TIterator, class TFormatter>
void JoinToString(
TStringBuilderBase* builder,
const TIterator& begin,
Expand All @@ -35,7 +35,7 @@ void JoinToString(
}
}

template <class TIterator, class TFormatter>
template <std::forward_iterator TIterator, class TFormatter>
TString JoinToString(
const TIterator& begin,
const TIterator& end,
Expand All @@ -48,7 +48,7 @@ TString JoinToString(
}

//! A handy shortcut with default formatter.
template <class TIterator>
template <std::forward_iterator TIterator>
TString JoinToString(
const TIterator& begin,
const TIterator& end,
Expand All @@ -63,9 +63,9 @@ TString JoinToString(
* \param formatter Formatter to apply to the items.
* \param delimiter A delimiter to be inserted between items; ", " by default.
*/
template <class TCollection, class TFormatter>
template <std::ranges::range TCollection, class TFormatter>
TString JoinToString(
const TCollection& collection,
TCollection&& collection,
const TFormatter& formatter,
TStringBuf delimiter)
{
Expand All @@ -75,12 +75,12 @@ TString JoinToString(
}

//! A handy shortcut with the default formatter.
template <class TCollection>
template <std::ranges::range TCollection>
TString JoinToString(
const TCollection& collection,
TCollection&& collection,
TStringBuf delimiter)
{
return JoinToString(collection, TDefaultFormatter(), delimiter);
return JoinToString(std::forward<TCollection>(collection), TDefaultFormatter(), delimiter);
}

//! Concatenates a bunch of TStringBuf-like instances into TString.
Expand All @@ -98,7 +98,7 @@ TString ConcatToString(Ts... args)
}

//! Converts a range of items into strings.
template <class TIter, class TFormatter>
template <std::forward_iterator TIter, class TFormatter>
std::vector<TString> ConvertToStrings(
const TIter& begin,
const TIter& end,
Expand All @@ -118,7 +118,7 @@ std::vector<TString> ConvertToStrings(
}

//! A handy shortcut with the default formatter.
template <class TIter>
template <std::forward_iterator TIter>
std::vector<TString> ConvertToStrings(
const TIter& begin,
const TIter& end,
Expand All @@ -133,9 +133,9 @@ std::vector<TString> ConvertToStrings(
* \param formatter Formatter to apply to the items.
* \param maxSize Size limit for the resulting vector.
*/
template <class TCollection, class TFormatter>
template <std::ranges::range TCollection, class TFormatter>
std::vector<TString> ConvertToStrings(
const TCollection& collection,
TCollection&& collection,
const TFormatter& formatter,
size_t maxSize)
{
Expand All @@ -145,12 +145,12 @@ std::vector<TString> ConvertToStrings(
}

//! A handy shortcut with default formatter.
template <class TCollection>
template <std::ranges::range TCollection>
std::vector<TString> ConvertToStrings(
const TCollection& collection,
TCollection&& collection,
size_t maxSize)
{
return ConvertToStrings(collection, TDefaultFormatter(), maxSize);
return ConvertToStrings(std::forward<TCollection>(collection), TDefaultFormatter(), maxSize);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
28 changes: 13 additions & 15 deletions library/cpp/yt/string/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <util/string/strip.h>

#include <vector>
#include <set>
#include <map>

namespace NYT {

Expand Down Expand Up @@ -65,23 +63,23 @@ static constexpr TStringBuf IntToHexUppercase = "0123456789ABCDEF";
* \param delimiter A delimiter to be inserted between items: ", " by default.
* \return The resulting combined string.
*/
template <class TIterator, class TFormatter>
template <std::forward_iterator TIterator, class TFormatter>
void JoinToString(
TStringBuilderBase* builder,
const TIterator& begin,
const TIterator& end,
const TFormatter& formatter,
TStringBuf delimiter = DefaultJoinToStringDelimiter);

template <class TIterator, class TFormatter>
template <std::forward_iterator TIterator, class TFormatter>
TString JoinToString(
const TIterator& begin,
const TIterator& end,
const TFormatter& formatter,
TStringBuf delimiter = DefaultJoinToStringDelimiter);

//! A handy shortcut with default formatter.
template <class TIterator>
template <std::forward_iterator TIterator>
TString JoinToString(
const TIterator& begin,
const TIterator& end,
Expand All @@ -93,32 +91,32 @@ TString JoinToString(
* \param formatter Formatter to apply to the items.
* \param delimiter A delimiter to be inserted between items; ", " by default.
*/
template <class TCollection, class TFormatter>
template <std::ranges::range TCollection, class TFormatter>
TString JoinToString(
const TCollection& collection,
TCollection&& collection,
const TFormatter& formatter,
TStringBuf delimiter = DefaultJoinToStringDelimiter);

//! A handy shortcut with the default formatter.
template <class TCollection>
template <std::ranges::range TCollection>
TString JoinToString(
const TCollection& collection,
TCollection&& collection,
TStringBuf delimiter = DefaultJoinToStringDelimiter);

//! Concatenates a bunch of TStringBuf-like instances into TString.
template <class... Ts>
TString ConcatToString(Ts... args);

//! Converts a range of items into strings.
template <class TIter, class TFormatter>
template <std::forward_iterator TIter, class TFormatter>
std::vector<TString> ConvertToStrings(
const TIter& begin,
const TIter& end,
const TFormatter& formatter,
size_t maxSize = std::numeric_limits<size_t>::max());

//! A handy shortcut with the default formatter.
template <class TIter>
template <std::forward_iterator TIter>
std::vector<TString> ConvertToStrings(
const TIter& begin,
const TIter& end,
Expand All @@ -130,16 +128,16 @@ std::vector<TString> ConvertToStrings(
* \param formatter Formatter to apply to the items.
* \param maxSize Size limit for the resulting vector.
*/
template <class TCollection, class TFormatter>
template <std::ranges::range TCollection, class TFormatter>
std::vector<TString> ConvertToStrings(
const TCollection& collection,
TCollection&& collection,
const TFormatter& formatter,
size_t maxSize = std::numeric_limits<size_t>::max());

//! A handy shortcut with default formatter.
template <class TCollection>
template <std::ranges::range TCollection>
std::vector<TString> ConvertToStrings(
const TCollection& collection,
TCollection&& collection,
size_t maxSize = std::numeric_limits<size_t>::max());

////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 6d2b9a9

Please sign in to comment.