mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Renamed CapnProtoInputStream to CapnProtoRowInputStream.
This commit is contained in:
parent
08d6051f5d
commit
c44e3e76c8
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <Core/Block.h>
|
#include <Core/Block.h>
|
||||||
#include <IO/ReadBuffer.h>
|
#include <IO/ReadBuffer.h>
|
||||||
#include <DataStreams/CapnProtoInputStream.h>
|
#include <DataStreams/CapnProtoRowInputStream.h>
|
||||||
|
|
||||||
#include <capnp/serialize.h>
|
#include <capnp/serialize.h>
|
||||||
#include <capnp/dynamic.h>
|
#include <capnp/dynamic.h>
|
||||||
@ -15,9 +15,9 @@ namespace DB
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
CapnProtoInputStream::NestedField split(const Block & sample, size_t i)
|
CapnProtoRowInputStream::NestedField split(const Block & sample, size_t i)
|
||||||
{
|
{
|
||||||
CapnProtoInputStream::NestedField field = {{}, i};
|
CapnProtoRowInputStream::NestedField field = {{}, i};
|
||||||
|
|
||||||
// Remove leading dot in field definition, e.g. ".msg" -> "msg"
|
// Remove leading dot in field definition, e.g. ".msg" -> "msg"
|
||||||
String name(sample.safeGetByPosition(i).name);
|
String name(sample.safeGetByPosition(i).name);
|
||||||
@ -81,7 +81,7 @@ capnp::StructSchema::Field getFieldOrThrow(capnp::StructSchema node, const std::
|
|||||||
throw Exception("Field " + field + " doesn't exist in schema.");
|
throw Exception("Field " + field + " doesn't exist in schema.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CapnProtoInputStream::createActions(const NestedFieldList & sortedFields, capnp::StructSchema reader)
|
void CapnProtoRowInputStream::createActions(const NestedFieldList & sortedFields, capnp::StructSchema reader)
|
||||||
{
|
{
|
||||||
String last;
|
String last;
|
||||||
size_t level = 0;
|
size_t level = 0;
|
||||||
@ -110,7 +110,7 @@ void CapnProtoInputStream::createActions(const NestedFieldList & sortedFields, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CapnProtoInputStream::CapnProtoInputStream(ReadBuffer & istr_, const Block & sample_, const String & schema_file, const String & root_object)
|
CapnProtoRowInputStream::CapnProtoRowInputStream(ReadBuffer & istr_, const Block & sample_, const String & schema_file, const String & root_object)
|
||||||
: istr(istr_), sample(sample_), parser(std::make_shared<SchemaParser>())
|
: istr(istr_), sample(sample_), parser(std::make_shared<SchemaParser>())
|
||||||
{
|
{
|
||||||
// Parse the schema and fetch the root object
|
// Parse the schema and fetch the root object
|
||||||
@ -139,7 +139,7 @@ CapnProtoInputStream::CapnProtoInputStream(ReadBuffer & istr_, const Block & sam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CapnProtoInputStream::read(Block & block)
|
bool CapnProtoRowInputStream::read(Block & block)
|
||||||
{
|
{
|
||||||
if (istr.eof())
|
if (istr.eof())
|
||||||
return false;
|
return false;
|
@ -16,7 +16,7 @@ class ReadBuffer;
|
|||||||
* The schema in this case cannot be compiled in, so it uses a runtime schema parser.
|
* The schema in this case cannot be compiled in, so it uses a runtime schema parser.
|
||||||
* See https://capnproto.org/cxx.html
|
* See https://capnproto.org/cxx.html
|
||||||
*/
|
*/
|
||||||
class CapnProtoInputStream : public IRowInputStream
|
class CapnProtoRowInputStream : public IRowInputStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct NestedField
|
struct NestedField
|
||||||
@ -29,7 +29,7 @@ public:
|
|||||||
/** schema_file - location of the capnproto schema, e.g. "schema.canpn"
|
/** schema_file - location of the capnproto schema, e.g. "schema.canpn"
|
||||||
* root_object - name to the root object, e.g. "Message"
|
* root_object - name to the root object, e.g. "Message"
|
||||||
*/
|
*/
|
||||||
CapnProtoInputStream(ReadBuffer & istr_, const Block & sample_, const String & schema_file, const String & root_object);
|
CapnProtoRowInputStream(ReadBuffer & istr_, const Block & sample_, const String & schema_file, const String & root_object);
|
||||||
|
|
||||||
bool read(Block & block) override;
|
bool read(Block & block) override;
|
||||||
|
|
@ -32,7 +32,7 @@
|
|||||||
#include <DataStreams/SquashingBlockOutputStream.h>
|
#include <DataStreams/SquashingBlockOutputStream.h>
|
||||||
#include <DataTypes/FormatSettingsJSON.h>
|
#include <DataTypes/FormatSettingsJSON.h>
|
||||||
#if USE_CAPNP
|
#if USE_CAPNP
|
||||||
#include <DataStreams/CapnProtoInputStream.h>
|
#include <DataStreams/CapnProtoRowInputStream.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
@ -107,7 +107,7 @@ BlockInputStreamPtr FormatFactory::getInput(const String & name, ReadBuffer & bu
|
|||||||
if (tokens.size() != 2)
|
if (tokens.size() != 2)
|
||||||
throw Exception("Format CapnProto requires 'format_schema' setting to have schema_file:root_object format, e.g. 'schema.capnp:Message'");
|
throw Exception("Format CapnProto requires 'format_schema' setting to have schema_file:root_object format, e.g. 'schema.capnp:Message'");
|
||||||
|
|
||||||
return wrap_row_stream(std::make_shared<CapnProtoInputStream>(buf, sample, tokens[0], tokens[1]));
|
return wrap_row_stream(std::make_shared<CapnProtoRowInputStream>(buf, sample, tokens[0], tokens[1]));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (name == "TabSeparatedRaw"
|
else if (name == "TabSeparatedRaw"
|
||||||
|
Loading…
Reference in New Issue
Block a user