mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 05:00:47 +00:00
Merge remote-tracking branch 'ianton-ru/MDB-15474' into ianton-ru-MDB-15474
This commit is contained in:
commit
b426cc48d7
@ -186,7 +186,7 @@ $ echo "SELECT 1" | gzip -c | \
|
|||||||
```
|
```
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
# Receiving compressed data from the server
|
# Receiving compressed data archive from the server
|
||||||
$ curl -vsS "http://localhost:8123/?enable_http_compression=1" \
|
$ curl -vsS "http://localhost:8123/?enable_http_compression=1" \
|
||||||
-H 'Accept-Encoding: gzip' --output result.gz -d 'SELECT number FROM system.numbers LIMIT 3'
|
-H 'Accept-Encoding: gzip' --output result.gz -d 'SELECT number FROM system.numbers LIMIT 3'
|
||||||
$ zcat result.gz
|
$ zcat result.gz
|
||||||
@ -195,6 +195,15 @@ $ zcat result.gz
|
|||||||
2
|
2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Receiving compressed data from the server and using the gunzip to receive decompressed data
|
||||||
|
$ curl -sS "http://localhost:8123/?enable_http_compression=1" \
|
||||||
|
-H 'Accept-Encoding: gzip' -d 'SELECT number FROM system.numbers LIMIT 3' | gunzip -
|
||||||
|
0
|
||||||
|
1
|
||||||
|
2
|
||||||
|
```
|
||||||
|
|
||||||
## Default Database {#default-database}
|
## Default Database {#default-database}
|
||||||
|
|
||||||
You can use the ‘database’ URL parameter or the ‘X-ClickHouse-Database’ header to specify the default database.
|
You can use the ‘database’ URL parameter or the ‘X-ClickHouse-Database’ header to specify the default database.
|
||||||
|
@ -39,7 +39,7 @@ BrotliReadBuffer::BrotliReadBuffer(std::unique_ptr<ReadBuffer> in_, size_t buf_s
|
|||||||
, in_data(nullptr)
|
, in_data(nullptr)
|
||||||
, out_capacity(0)
|
, out_capacity(0)
|
||||||
, out_data(nullptr)
|
, out_data(nullptr)
|
||||||
, eof(false)
|
, eof_flag(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ BrotliReadBuffer::~BrotliReadBuffer() = default;
|
|||||||
|
|
||||||
bool BrotliReadBuffer::nextImpl()
|
bool BrotliReadBuffer::nextImpl()
|
||||||
{
|
{
|
||||||
if (eof)
|
if (eof_flag)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!in_available)
|
if (!in_available)
|
||||||
@ -74,7 +74,7 @@ bool BrotliReadBuffer::nextImpl()
|
|||||||
{
|
{
|
||||||
if (in->eof())
|
if (in->eof())
|
||||||
{
|
{
|
||||||
eof = true;
|
eof_flag = true;
|
||||||
return !working_buffer.empty();
|
return !working_buffer.empty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -32,7 +32,7 @@ private:
|
|||||||
size_t out_capacity;
|
size_t out_capacity;
|
||||||
uint8_t * out_data;
|
uint8_t * out_data;
|
||||||
|
|
||||||
bool eof;
|
bool eof_flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ Bzip2ReadBuffer::Bzip2ReadBuffer(std::unique_ptr<ReadBuffer> in_, size_t buf_siz
|
|||||||
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment)
|
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment)
|
||||||
, in(std::move(in_))
|
, in(std::move(in_))
|
||||||
, bz(std::make_unique<Bzip2StateWrapper>())
|
, bz(std::make_unique<Bzip2StateWrapper>())
|
||||||
, eof(false)
|
, eof_flag(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ Bzip2ReadBuffer::~Bzip2ReadBuffer() = default;
|
|||||||
|
|
||||||
bool Bzip2ReadBuffer::nextImpl()
|
bool Bzip2ReadBuffer::nextImpl()
|
||||||
{
|
{
|
||||||
if (eof)
|
if (eof_flag)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!bz->stream.avail_in)
|
if (!bz->stream.avail_in)
|
||||||
@ -72,7 +72,7 @@ bool Bzip2ReadBuffer::nextImpl()
|
|||||||
{
|
{
|
||||||
if (in->eof())
|
if (in->eof())
|
||||||
{
|
{
|
||||||
eof = true;
|
eof_flag = true;
|
||||||
return !working_buffer.empty();
|
return !working_buffer.empty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -91,7 +91,7 @@ bool Bzip2ReadBuffer::nextImpl()
|
|||||||
|
|
||||||
if (in->eof())
|
if (in->eof())
|
||||||
{
|
{
|
||||||
eof = true;
|
eof_flag = true;
|
||||||
throw Exception(ErrorCodes::UNEXPECTED_END_OF_FILE, "Unexpected end of bzip2 archive");
|
throw Exception(ErrorCodes::UNEXPECTED_END_OF_FILE, "Unexpected end of bzip2 archive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ private:
|
|||||||
class Bzip2StateWrapper;
|
class Bzip2StateWrapper;
|
||||||
std::unique_ptr<Bzip2StateWrapper> bz;
|
std::unique_ptr<Bzip2StateWrapper> bz;
|
||||||
|
|
||||||
bool eof;
|
bool eof_flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace ErrorCodes
|
|||||||
extern const int LZMA_STREAM_DECODER_FAILED;
|
extern const int LZMA_STREAM_DECODER_FAILED;
|
||||||
}
|
}
|
||||||
LZMAInflatingReadBuffer::LZMAInflatingReadBuffer(std::unique_ptr<ReadBuffer> in_, size_t buf_size, char * existing_memory, size_t alignment)
|
LZMAInflatingReadBuffer::LZMAInflatingReadBuffer(std::unique_ptr<ReadBuffer> in_, size_t buf_size, char * existing_memory, size_t alignment)
|
||||||
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment), in(std::move(in_)), eof(false)
|
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment), in(std::move(in_)), eof_flag(false)
|
||||||
{
|
{
|
||||||
lstr = LZMA_STREAM_INIT;
|
lstr = LZMA_STREAM_INIT;
|
||||||
lstr.allocator = nullptr;
|
lstr.allocator = nullptr;
|
||||||
@ -36,7 +36,7 @@ LZMAInflatingReadBuffer::~LZMAInflatingReadBuffer()
|
|||||||
|
|
||||||
bool LZMAInflatingReadBuffer::nextImpl()
|
bool LZMAInflatingReadBuffer::nextImpl()
|
||||||
{
|
{
|
||||||
if (eof)
|
if (eof_flag)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lzma_action action = LZMA_RUN;
|
lzma_action action = LZMA_RUN;
|
||||||
@ -64,7 +64,7 @@ bool LZMAInflatingReadBuffer::nextImpl()
|
|||||||
{
|
{
|
||||||
if (in->eof())
|
if (in->eof())
|
||||||
{
|
{
|
||||||
eof = true;
|
eof_flag = true;
|
||||||
return !working_buffer.empty();
|
return !working_buffer.empty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -25,7 +25,7 @@ private:
|
|||||||
std::unique_ptr<ReadBuffer> in;
|
std::unique_ptr<ReadBuffer> in;
|
||||||
lzma_stream lstr;
|
lzma_stream lstr;
|
||||||
|
|
||||||
bool eof;
|
bool eof_flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ Lz4InflatingReadBuffer::~Lz4InflatingReadBuffer()
|
|||||||
|
|
||||||
bool Lz4InflatingReadBuffer::nextImpl()
|
bool Lz4InflatingReadBuffer::nextImpl()
|
||||||
{
|
{
|
||||||
if (eof)
|
if (eof_flag)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!in_available)
|
if (!in_available)
|
||||||
@ -66,7 +66,7 @@ bool Lz4InflatingReadBuffer::nextImpl()
|
|||||||
|
|
||||||
if (in->eof())
|
if (in->eof())
|
||||||
{
|
{
|
||||||
eof = true;
|
eof_flag = true;
|
||||||
return !working_buffer.empty();
|
return !working_buffer.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ private:
|
|||||||
size_t in_available;
|
size_t in_available;
|
||||||
size_t out_available;
|
size_t out_available;
|
||||||
|
|
||||||
bool eof = false;
|
bool eof_flag = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ ZlibInflatingReadBuffer::ZlibInflatingReadBuffer(
|
|||||||
size_t alignment)
|
size_t alignment)
|
||||||
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment)
|
: BufferWithOwnMemory<ReadBuffer>(buf_size, existing_memory, alignment)
|
||||||
, in(std::move(in_))
|
, in(std::move(in_))
|
||||||
, eof(false)
|
, eof_flag(false)
|
||||||
{
|
{
|
||||||
zstr.zalloc = nullptr;
|
zstr.zalloc = nullptr;
|
||||||
zstr.zfree = nullptr;
|
zstr.zfree = nullptr;
|
||||||
@ -54,7 +54,7 @@ bool ZlibInflatingReadBuffer::nextImpl()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
/// if we already found eof, we shouldn't do anything
|
/// if we already found eof, we shouldn't do anything
|
||||||
if (eof)
|
if (eof_flag)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/// if there is no available bytes in zstr, move ptr to next available data
|
/// if there is no available bytes in zstr, move ptr to next available data
|
||||||
@ -83,7 +83,7 @@ bool ZlibInflatingReadBuffer::nextImpl()
|
|||||||
/// * false if there is no data in working buffer
|
/// * false if there is no data in working buffer
|
||||||
if (in->eof())
|
if (in->eof())
|
||||||
{
|
{
|
||||||
eof = true;
|
eof_flag = true;
|
||||||
return !working_buffer.empty();
|
return !working_buffer.empty();
|
||||||
}
|
}
|
||||||
/// If it is not end of file, we need to reset zstr and return true, because we still have some data to read
|
/// If it is not end of file, we need to reset zstr and return true, because we still have some data to read
|
||||||
|
@ -33,7 +33,7 @@ private:
|
|||||||
|
|
||||||
std::unique_ptr<ReadBuffer> in;
|
std::unique_ptr<ReadBuffer> in;
|
||||||
z_stream zstr;
|
z_stream zstr;
|
||||||
bool eof;
|
bool eof_flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ bool ZstdInflatingReadBuffer::nextImpl()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
// If it is known that end of file was reached, return false
|
// If it is known that end of file was reached, return false
|
||||||
if (eof)
|
if (eof_flag)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/// If end was reached, get next part
|
/// If end was reached, get next part
|
||||||
@ -64,7 +64,7 @@ bool ZstdInflatingReadBuffer::nextImpl()
|
|||||||
/// If end of file is reached, fill eof variable and return true if there is some data in buffer, otherwise return false
|
/// If end of file is reached, fill eof variable and return true if there is some data in buffer, otherwise return false
|
||||||
if (in->eof())
|
if (in->eof())
|
||||||
{
|
{
|
||||||
eof = true;
|
eof_flag = true;
|
||||||
return !working_buffer.empty();
|
return !working_buffer.empty();
|
||||||
}
|
}
|
||||||
/// It is possible, that input buffer is not at eof yet, but nothing was decompressed in current iteration.
|
/// It is possible, that input buffer is not at eof yet, but nothing was decompressed in current iteration.
|
||||||
|
@ -31,7 +31,7 @@ private:
|
|||||||
ZSTD_DCtx * dctx;
|
ZSTD_DCtx * dctx;
|
||||||
ZSTD_inBuffer input;
|
ZSTD_inBuffer input;
|
||||||
ZSTD_outBuffer output;
|
ZSTD_outBuffer output;
|
||||||
bool eof = false;
|
bool eof_flag = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user