ClickHouse/tests/queries/0_stateless/01621_clickhouse_compressor.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
1.0 KiB
Bash
Raw Normal View History

2020-12-29 20:10:51 +00:00
#!/usr/bin/env bash
2020-12-30 17:55:10 +00:00
# shellcheck source=../shell_config.sh
2020-12-29 20:10:51 +00:00
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2020-12-30 15:53:33 +00:00
# shellcheck source=../shell_config.sh
2020-12-29 20:10:51 +00:00
. "$CURDIR"/../shell_config.sh
set -e
# This is random garbage, so compression ratio will be very low.
tr -cd 'a-z0-9' < /dev/urandom | head -c1M > ${CLICKHOUSE_TMP}/input
2020-12-29 20:10:51 +00:00
# stdin/stdout streams
$CLICKHOUSE_COMPRESSOR < ${CLICKHOUSE_TMP}/input > ${CLICKHOUSE_TMP}/output
diff -q <($CLICKHOUSE_COMPRESSOR --decompress < ${CLICKHOUSE_TMP}/output) ${CLICKHOUSE_TMP}/input
2020-12-29 20:10:51 +00:00
# positional arguments, and that fact that input/output will be overwritten
$CLICKHOUSE_COMPRESSOR ${CLICKHOUSE_TMP}/input ${CLICKHOUSE_TMP}/output
diff -q <($CLICKHOUSE_COMPRESSOR --decompress ${CLICKHOUSE_TMP}/output) ${CLICKHOUSE_TMP}/input
2020-12-29 20:10:51 +00:00
# --offset-in-decompressed-block
diff -q <($CLICKHOUSE_COMPRESSOR --decompress --offset-in-decompressed-block 10 ${CLICKHOUSE_TMP}/output) <(tail -c+$((10+1)) ${CLICKHOUSE_TMP}/input)
2020-12-29 20:10:51 +00:00
# TODO: --offset-in-compressed-file using some .bin file (via clickhouse-local + check-marks)