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.
|
2021-02-10 18:09:13 +00:00
|
|
|
tr -cd 'a-z0-9' < /dev/urandom | head -c1M > ${CLICKHOUSE_TMP}/input
|
2020-12-29 20:10:51 +00:00
|
|
|
|
|
|
|
# stdin/stdout streams
|
2021-02-10 18:09:13 +00:00
|
|
|
$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
|
2021-02-10 18:09:13 +00:00
|
|
|
$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
|
2021-02-10 18:09:13 +00:00
|
|
|
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)
|