Fix compile errors with WriteBuffer

This commit is contained in:
l1tsolaiki 2021-06-18 10:07:53 +03:00
parent 1863a9beb0
commit a5d3600f20
6 changed files with 15 additions and 11 deletions

View File

@ -2,6 +2,8 @@
#include <Common/Exception.h>
#include <common/types.h>
#include <IO/WriteBufferFromString.h>
#include <IO/Operators.h>
namespace DB
{
@ -40,7 +42,7 @@ struct DummyJSONParser
Array getArray() const { return {}; }
Object getObject() const { return {}; }
Element getElement() { return {}; }
ALWAYS_INLINE Element getUnderlyingElement() const { return {}; }
};
/// References an array in a JSON document.
@ -99,7 +101,7 @@ struct DummyJSONParser
#endif
};
inline ALWAYS_INLINE std::ostream& operator<<(std::ostream& out, DummyJSONParser::Element)
inline ALWAYS_INLINE WriteBufferFromString& operator<<(WriteBufferFromString& out, const DB::DummyJSONParser::Element &)
{
return out;
}

View File

@ -283,7 +283,7 @@ public:
String result;
WriteBufferFromString out(result);
out << current_element.getElement();
out << current_element;
ColumnString & col_str = assert_cast<ColumnString &>(dest);
col_str.insertData(result.data(), result.size());
return true;
@ -324,7 +324,7 @@ public:
out << ", ";
}
success = true;
out << current_element.getElement();
out << current_element;
}
else if (status == VisitorStatus::Error)
{

View File

@ -55,7 +55,8 @@ bool ParserJSONPathRange::parseImpl(Pos & pos, ASTPtr & node, Expected & expecte
}
else if (pos->type == TokenType::BareWord)
{
if (!ParserKeyword("TO").ignore(pos, expected)) {
if (!ParserKeyword("TO").ignore(pos, expected))
{
return false;
}
if (!number_p.parse(pos, number_ptr, expected))

View File

@ -19,8 +19,7 @@ bool ParserJSONPathRoot::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
expected.add(pos, "dollar sign (start of jsonpath)");
return false;
}
auto path_root = std::make_shared<ASTJSONPathRoot>();
node = path_root;
node = std::make_shared<ASTJSONPathRoot>();
++pos;
return true;
}

View File

@ -6,7 +6,6 @@ namespace DB
{
bool ParserJSONPathStar::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
if (pos->type != TokenType::OpeningSquareBracket)
{
return false;
@ -22,8 +21,7 @@ bool ParserJSONPathStar::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
}
++pos;
auto star = std::make_shared<ASTJSONPathStar>();
node = star;
node = std::make_shared<ASTJSONPathStar>();
return true;
}

View File

@ -50,7 +50,7 @@ struct SimdJSONParser
ALWAYS_INLINE Array getArray() const;
ALWAYS_INLINE Object getObject() const;
ALWAYS_INLINE simdjson::dom::element getElement() const { return element; }
ALWAYS_INLINE simdjson::dom::element getUnderlyingElement() const { return element; }
private:
simdjson::dom::element element;
@ -165,6 +165,10 @@ inline ALWAYS_INLINE SimdJSONParser::Object SimdJSONParser::Element::getObject()
return element.get_object().value_unsafe();
}
inline ALWAYS_INLINE WriteBuffer& operator<<(WriteBuffer& out, const DB::SimdJSONParser::Element & element) {
return out << element.getUnderlyingElement();
}
}
#endif