This commit is contained in:
avogar 2022-09-09 15:01:45 +00:00
parent ae7f9abd32
commit ad68b7be0f
12 changed files with 31 additions and 13 deletions

View File

@ -1129,6 +1129,7 @@ void ClientBase::processInsertQuery(const String & query_to_execute, ASTPtr pars
{
/// If structure was received (thus, server has not thrown an exception),
/// send our data with that structure.
std::cerr << "database: " << global_context->resolveStorageID(parsed_insert_query.table_id).getDatabaseName() << "\n";
sendData(sample, columns_description, parsed_query);
receiveEndOfQuery();
}

View File

@ -757,7 +757,7 @@ static constexpr UInt64 operator""_GiB(unsigned long long value)
M(Bool, output_format_json_escape_forward_slashes, true, "Controls escaping forward slashes for string outputs in JSON output format. This is intended for compatibility with JavaScript. Don't confuse with backslashes that are always escaped.", 0) \
M(Bool, output_format_json_named_tuples_as_objects, true, "Serialize named tuple columns as JSON objects.", 0) \
M(Bool, output_format_json_array_of_rows, false, "Output a JSON array of all rows in JSONEachRow(Compact) format.", 0) \
M(Bool, output_format_json_validate_utf8, false, "Validate UTF-8 sequences in JSON output formats, don't impact formats JSON/JSONCompact/JSONColumnsWithMetadata, they always validate utf8 ", 0) \
M(Bool, output_format_json_validate_utf8, false, "Validate UTF-8 sequences in JSON output formats, doesn't impact formats JSON/JSONCompact/JSONColumnsWithMetadata, they always validate utf8", 0) \
\
M(UInt64, output_format_pretty_max_rows, 10000, "Rows limit for Pretty formats.", 0) \
M(UInt64, output_format_pretty_max_column_pad_width, 250, "Maximum width to pad all values in a column in Pretty formats.", 0) \

View File

@ -21,6 +21,11 @@
namespace DB
{
namespace ErrorCodes
{
extern const int INCORRECT_DATA;
}
void SerializationString::serializeBinary(const Field & field, WriteBuffer & ostr) const
{
const String & s = get<const String &>(field);

View File

@ -383,8 +383,6 @@ void transformInferredTypesIfNeededImpl(DataTypes & types, const FormatSettings
}
}
}
};
auto transform_complex_types = [&](DataTypes & data_types)

View File

@ -544,9 +544,15 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
if (insert_query)
{
if (insert_query->table_id)
{
insert_query->table_id = context->resolveStorageID(insert_query->table_id);
LOG_DEBUG(&Poco::Logger::get("executeQuery"), "2) database: {}", insert_query->table_id.getDatabaseName());
}
else if (auto table = insert_query->getTable(); !table.empty())
{
insert_query->table_id = context->resolveStorageID(StorageID{insert_query->getDatabase(), table});
LOG_DEBUG(&Poco::Logger::get("executeQuery"), "2) database: {}", insert_query->table_id.getDatabaseName());
}
}
if (insert_query && insert_query->select)

View File

@ -7,6 +7,11 @@
namespace DB
{
namespace ErrorCodes
{
extern const int INCORRECT_DATA;
}
JSONColumnsWithMetadataReader::JSONColumnsWithMetadataReader(ReadBuffer & in_, const Block & header_, const FormatSettings & settings)
: JSONColumnsReader(in_), header(header_), use_metadata(settings.json.use_metadata)
{

View File

@ -6,13 +6,6 @@
namespace DB
{
/* Format JSONCompactColumns reads each block of data in the next format:
* [
* [value1, value2, value3, ...],
* [value1, value2m value3, ...],
* ...
* ]
*/
class JSONColumnsWithMetadataReader : public JSONColumnsReader
{
public:

View File

@ -29,8 +29,6 @@ private:
void readSuffix() override {}
void readRowStart() override;
bool checkEndOfData(bool is_first_row) override;
// size_t row = 0;
};

View File

@ -9,6 +9,14 @@
namespace DB
{
/* Outputs data as a single JSON Object with rows as fields:
* {
* "row_1": {"num": 42, "str": "hello", "arr": [0,1]},
* "row_2": {"num": 43, "str": "hello", "arr": [0,1,2]},
* "row_3": {"num": 44, "str": "hello", "arr": [0,1,2,3]},
* }
*/
class JSONObjectEachRowRowOutputFormat : public JSONEachRowRowOutputFormat
{
public:

View File

@ -4,7 +4,6 @@
#include <Processors/Formats/Impl/JSONEachRowRowInputFormat.h>
#include <Processors/Formats/ISchemaReader.h>
#include <Formats/FormatSettings.h>
#include <Common/HashTable/HashMap.h>
namespace DB

View File

@ -1,3 +1,6 @@
-- Tags: no-fasttest
select * from format(JSONEachRow, '{"x" : 123}\n{"x" : "str"}');
select * from format(JSONEachRow, '{"x" : [123, "str"]}');
select * from format(JSONEachRow, '{"x" : [123, "456"]}\n{"x" : ["str", "rts"]}');

View File

@ -64,6 +64,7 @@ JSONCompactStringsEachRowWithNames
JSONCompactStringsEachRowWithNamesAndTypes
JSONEachRow
JSONEachRowWithProgress
JSONObjectEachRow
JSONStrings
JSONStringsEachRow
JSONStringsEachRowWithProgress
@ -299,6 +300,7 @@ jsoncompactstringseachrowwithnames
jsoncompactstringseachrowwithnamesandtypes
jsoneachrow
jsoneachrowwithprogress
jsonobjecteachrow
jsonstrings
jsonstringseachrow
jsonstringseachrowwithprogress