mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
remove reading_empty state
This commit is contained in:
parent
c677be1ccd
commit
662848fe76
@ -70,8 +70,6 @@ private:
|
|||||||
return value_state_handler.read(file, pos, value);
|
return value_state_handler.read(file, pos, value);
|
||||||
case State::READING_QUOTED_VALUE:
|
case State::READING_QUOTED_VALUE:
|
||||||
return value_state_handler.readQuoted(file, pos, value);
|
return value_state_handler.readQuoted(file, pos, value);
|
||||||
case State::READING_EMPTY_VALUE:
|
|
||||||
return value_state_handler.readEmpty(file, pos, value);
|
|
||||||
case State::FLUSH_PAIR:
|
case State::FLUSH_PAIR:
|
||||||
return flushPair(file, pos, key, value, keys, values, row_offset);
|
return flushPair(file, pos, key, value, keys, values, row_offset);
|
||||||
case END:
|
case END:
|
||||||
|
@ -15,14 +15,12 @@ enum State
|
|||||||
READING_QUOTED_KEY,
|
READING_QUOTED_KEY,
|
||||||
// Tries to read the key value pair delimiter. Might jump to WAITING_KEY, WAITING_VALUE or END.
|
// Tries to read the key value pair delimiter. Might jump to WAITING_KEY, WAITING_VALUE or END.
|
||||||
READING_KV_DELIMITER,
|
READING_KV_DELIMITER,
|
||||||
// Skip characters until it finds a valid first value character. Might jump to READING_QUOTED_VALUE, READING_EMPTY_VALUE or READING_VALUE.
|
// Skip characters until it finds a valid first value character. Might jump to READING_QUOTED_VALUE or READING_VALUE.
|
||||||
WAITING_VALUE,
|
WAITING_VALUE,
|
||||||
// Tries to read a value. Jumps to FLUSH_PAIR.
|
// Tries to read a value. Jumps to FLUSH_PAIR.
|
||||||
READING_VALUE,
|
READING_VALUE,
|
||||||
// Tries to read an quoted/ quoted value. Might jump to FLUSH_PAIR or END.
|
// Tries to read an quoted/ quoted value. Might jump to FLUSH_PAIR or END.
|
||||||
READING_QUOTED_VALUE,
|
READING_QUOTED_VALUE,
|
||||||
// "Reads" an empty value. Jumps to FLUSH_PAIR.
|
|
||||||
READING_EMPTY_VALUE,
|
|
||||||
// In this state, both key and value have already been collected and should be flushed. Might jump to WAITING_KEY or END.
|
// In this state, both key and value have already been collected and should be flushed. Might jump to WAITING_KEY or END.
|
||||||
FLUSH_PAIR,
|
FLUSH_PAIR,
|
||||||
END
|
END
|
||||||
|
@ -35,7 +35,6 @@ concept CInlineEscapingValueStateHandler = requires(ValueStateHandler handler)
|
|||||||
{ handler.wait(std::string_view {}, std::size_t {}) } -> std::same_as<NextState>;
|
{ handler.wait(std::string_view {}, std::size_t {}) } -> std::same_as<NextState>;
|
||||||
{ handler.read(std::string_view {}, std::size_t {}, std::declval<std::string &>()) } -> std::same_as<NextState>;
|
{ handler.read(std::string_view {}, std::size_t {}, std::declval<std::string &>()) } -> std::same_as<NextState>;
|
||||||
{ handler.readQuoted(std::string_view {}, std::size_t {}, std::declval<std::string &>()) } -> std::same_as<NextState>;
|
{ handler.readQuoted(std::string_view {}, std::size_t {}, std::declval<std::string &>()) } -> std::same_as<NextState>;
|
||||||
{ handler.readEmpty(std::string_view {}, std::size_t {}, std::declval<std::string &>()) } -> std::same_as<NextState>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename ValueStateHandler>
|
template <typename ValueStateHandler>
|
||||||
@ -44,7 +43,6 @@ concept CNoEscapingValueStateHandler = requires(ValueStateHandler handler)
|
|||||||
{ handler.wait(std::string_view {}, std::size_t {}) } -> std::same_as<NextState>;
|
{ handler.wait(std::string_view {}, std::size_t {}) } -> std::same_as<NextState>;
|
||||||
{ handler.read(std::string_view {}, std::size_t {}, std::declval<std::string_view &>()) } -> std::same_as<NextState>;
|
{ handler.read(std::string_view {}, std::size_t {}, std::declval<std::string_view &>()) } -> std::same_as<NextState>;
|
||||||
{ handler.readQuoted(std::string_view {}, std::size_t {}, std::declval<std::string_view &>()) } -> std::same_as<NextState>;
|
{ handler.readQuoted(std::string_view {}, std::size_t {}, std::declval<std::string_view &>()) } -> std::same_as<NextState>;
|
||||||
{ handler.readEmpty(std::string_view {}, std::size_t {}, std::declval<std::string_view &>()) } -> std::same_as<NextState>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -26,10 +26,6 @@ NextState InlineEscapingValueStateHandler::wait(std::string_view file, size_t po
|
|||||||
{
|
{
|
||||||
return {pos + 1u, State::READING_QUOTED_VALUE};
|
return {pos + 1u, State::READING_QUOTED_VALUE};
|
||||||
}
|
}
|
||||||
else if (std::find(pair_delimiters.begin(), pair_delimiters.end(), current_character) != pair_delimiters.end())
|
|
||||||
{
|
|
||||||
return {pos, State::READING_EMPTY_VALUE};
|
|
||||||
}
|
|
||||||
else if (key_value_delimiter == current_character)
|
else if (key_value_delimiter == current_character)
|
||||||
{
|
{
|
||||||
return {pos, State::WAITING_KEY};
|
return {pos, State::WAITING_KEY};
|
||||||
@ -40,7 +36,7 @@ NextState InlineEscapingValueStateHandler::wait(std::string_view file, size_t po
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {pos, State::READING_EMPTY_VALUE};
|
return {pos, State::READING_VALUE};
|
||||||
}
|
}
|
||||||
|
|
||||||
NextState InlineEscapingValueStateHandler::read(std::string_view file, size_t pos, ElementType & value) const
|
NextState InlineEscapingValueStateHandler::read(std::string_view file, size_t pos, ElementType & value) const
|
||||||
@ -164,10 +160,4 @@ NextState InlineEscapingValueStateHandler::readQuoted(std::string_view file, siz
|
|||||||
return {pos, State::END};
|
return {pos, State::END};
|
||||||
}
|
}
|
||||||
|
|
||||||
NextState InlineEscapingValueStateHandler::readEmpty(std::string_view, size_t pos, ElementType & value)
|
|
||||||
{
|
|
||||||
value.clear();
|
|
||||||
return {pos + 1, State::FLUSH_PAIR};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,6 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] NextState readQuoted(std::string_view file, size_t pos, ElementType & value) const;
|
[[nodiscard]] NextState readQuoted(std::string_view file, size_t pos, ElementType & value) const;
|
||||||
|
|
||||||
[[nodiscard]] static NextState readEmpty(std::string_view, size_t pos, ElementType & value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Configuration extractor_configuration;
|
Configuration extractor_configuration;
|
||||||
std::vector<char> read_needles;
|
std::vector<char> read_needles;
|
||||||
|
@ -25,10 +25,6 @@ NextState NoEscapingValueStateHandler::wait(std::string_view file, size_t pos) c
|
|||||||
{
|
{
|
||||||
return {pos + 1u, State::READING_QUOTED_VALUE};
|
return {pos + 1u, State::READING_QUOTED_VALUE};
|
||||||
}
|
}
|
||||||
else if (std::find(pair_delimiters.begin(), pair_delimiters.end(), current_character) != pair_delimiters.end())
|
|
||||||
{
|
|
||||||
return {pos, State::READING_EMPTY_VALUE};
|
|
||||||
}
|
|
||||||
else if (key_value_delimiter == current_character)
|
else if (key_value_delimiter == current_character)
|
||||||
{
|
{
|
||||||
return {pos, State::WAITING_KEY};
|
return {pos, State::WAITING_KEY};
|
||||||
@ -39,7 +35,7 @@ NextState NoEscapingValueStateHandler::wait(std::string_view file, size_t pos) c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {file.size(), State::READING_EMPTY_VALUE};
|
return {file.size(), State::READING_VALUE};
|
||||||
}
|
}
|
||||||
|
|
||||||
NextState NoEscapingValueStateHandler::read(std::string_view file, size_t pos, ElementType & value) const
|
NextState NoEscapingValueStateHandler::read(std::string_view file, size_t pos, ElementType & value) const
|
||||||
@ -107,10 +103,4 @@ NextState NoEscapingValueStateHandler::readQuoted(std::string_view file, size_t
|
|||||||
return {file.size(), State::END};
|
return {file.size(), State::END};
|
||||||
}
|
}
|
||||||
|
|
||||||
NextState NoEscapingValueStateHandler::readEmpty(std::string_view, size_t pos, ElementType & value)
|
|
||||||
{
|
|
||||||
value = {};
|
|
||||||
return {pos + 1, State::FLUSH_PAIR};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] NextState readQuoted(std::string_view file, size_t pos, ElementType & value) const;
|
[[nodiscard]] NextState readQuoted(std::string_view file, size_t pos, ElementType & value) const;
|
||||||
|
|
||||||
[[nodiscard]] static NextState readEmpty(std::string_view, size_t pos, ElementType & value);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Configuration extractor_configuration;
|
Configuration extractor_configuration;
|
||||||
std::vector<char> read_needles;
|
std::vector<char> read_needles;
|
||||||
|
Loading…
Reference in New Issue
Block a user