#!/usr/bin/env bash

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh

$CLICKHOUSE_CLIENT -q "DROP TABLE IF EXISTS test_02250"

$CLICKHOUSE_CLIENT -q "CREATE TABLE test_02250
(
    field_1 Int32,
    field_2 Int32,
    field_3 Int32,
    field_4 Int32,
    field_5 Int32,
    field_6 Int32,
    field_7 Int32,
    field_8 Int32,
    field_9 Int32,
    field_10 Int32,
    field_11 Int32,
    field_12 Int32,
    field_13 Int32,
    field_14 Int32,
    field_15 Int32,
    field_16 Int32,
    field_17 Int32,
    field_18 Int32,
    field_19 Int32,
    field_20 Int32,
    field_21 Int32,
    field_22 Int32,
    field_23 Int32,
    field_24 Int32,
    field_25 Int32,
    field_26 Int32,
    field_27 Int32,
    field_28 Int32,
    field_29 Int32,
    field_30 Int32,
    field_31 Int32,
    field_32 Int32,
    field_33 Int32,
    field_34 Int32,
    field_35 Int32,
    field_36 Int32,
    field_37 Int32,
    field_38 Int32,
    field_39 Int32,
    field_40 Int32,
    field_41 Int32,
    field_42 Int32,
    field_43 Int32,
    field_44 Int32,
    field_45 Int32,
    field_46 Int32,
    field_47 Int32,
    field_48 Int32,
    field_49 Int32,
    field_50 Int32,
    field_51 Int32,
    field_52 Int32,
    field_53 Int32,
    field_54 Int32,
    field_55 Int32,
    field_56 Int32,
    field_57 Int32,
    field_58 Int32,
    field_59 Int32,
    field_60 Int32,
    field_61 Int32,
    field_62 Int32,
    field_63 Int32,
    field_64 Int32,
    field_65 Int32,
    field_66 Int32,
    field_67 Int32,
    field_68 Int32,
    field_69 Int32,
    field_70 Int32,
    field_71 Int32,
    field_72 Int32,
    field_73 Int32,
    field_74 Int32,
    field_75 Int32,
    field_76 Int32,
    field_77 Int32,
    field_78 Int32,
    field_79 Int32,
    field_80 Int32,
    field_81 Int32,
    field_82 Int32,
    field_83 Int32,
    field_84 Int32,
    field_85 Int32,
    field_86 Int32,
    field_87 Int32,
    field_88 Int32,
    field_89 Int32,
    field_90 Int32,
    field_91 Int32,
    field_92 Int32,
    field_93 Int32,
    field_94 Int32,
    field_95 Int32,
    field_96 Int32,
    field_97 Int32,
    field_98 Int32,
    field_99 Int32,
    field_100 Int32,
    field_101 Int32,
    field_102 Int32,
    field_103 Int32,
    field_104 Int32,
    field_105 Int32,
    field_106 Int32,
    field_107 Int32,
    field_108 Int32,
    field_109 Int32,
    field_110 Int32,
    field_111 Int32,
    field_112 Int32,
    field_113 Int32,
    field_114 Int32,
    field_115 Int32,
    field_116 Int32,
    field_117 Int32,
    field_118 Int32,
    field_119 Int32,
    field_120 Int32,
    field_121 Int32,
    field_122 Int32,
    field_123 Int32,
    field_124 Int32,
    field_125 Int32,
    field_126 Int32,
    field_127 Int32,
    field_128 Int32,
    field_129 Int32,
    field_130 Int32,
    field_131 Int32,
    field_132 Int32,
    field_133 Int32,
    field_134 Int32,
    field_135 Int32,
    field_136 Int32,
    field_137 Int32,
    field_138 Int32,
    field_139 Int32,
    field_140 Int32,
    field_141 Int32,
    field_142 Int32,
    field_143 Int32,
    field_144 Int32,
    field_145 Int32,
    field_146 Int32,
    field_147 Int32,
    field_148 Int32,
    field_149 Int32,
    field_150 Int32,
    field_151 Int32,
    field_152 Int32,
    field_153 Int32,
    field_154 Int32,
    field_155 Int32,
    field_156 Int32,
    field_157 Int32,
    field_158 Int32,
    field_159 Int32,
    field_160 Int32,
    field_161 Int32,
    field_162 Int32,
    field_163 Int32,
    field_164 Int32,
    field_165 Int32,
    field_166 Int32,
    field_167 Int32,
    field_168 Int32,
    field_169 Int32,
    field_170 Int32,
    field_171 Int32,
    field_172 Int32,
    field_173 Int32,
    field_174 Int32,
    field_175 Int32,
    field_176 Int32,
    field_177 Int32,
    field_178 Int32,
    field_179 Int32,
    field_180 Int32,
    field_181 Int32,
    field_182 Int32,
    field_183 Int32,
    field_184 Int32,
    field_185 Int32,
    field_186 Int32,
    field_187 Int32,
    field_188 Int32,
    field_189 Int32,
    field_190 Int32,
    field_191 Int32,
    field_192 Int32,
    field_193 Int32,
    field_194 Int32,
    field_195 Int32,
    field_196 Int32,
    field_197 Int32,
    field_198 Int32,
    field_199 Int32,
    field_200 Int32,
    field_201 Int32,
    field_202 Int32,
    field_203 Int32,
    field_204 Int32,
    field_205 Int32,
    field_206 Int32,
    field_207 Int32,
    field_208 Int32,
    field_209 Int32,
    field_210 Int32,
    field_211 Int32,
    field_212 Int32,
    field_213 Int32,
    field_214 Int32,
    field_215 Int32,
    field_216 Int32,
    field_217 Int32,
    field_218 Int32,
    field_219 Int32,
    field_220 Int32,
    field_221 Int32,
    field_222 Int32,
    field_223 Int32,
    field_224 Int32,
    field_225 Int32,
    field_226 Int32,
    field_227 Int32,
    field_228 Int32,
    field_229 Int32,
    field_230 Int32,
    field_231 Int32,
    field_232 Int32,
    field_233 Int32,
    field_234 Int32,
    field_235 Int32,
    field_236 Int32,
    field_237 Int32,
    field_238 Int32,
    field_239 Int32,
    field_240 Int32,
    field_241 Int32,
    field_242 Int32,
    field_243 Int32,
    field_244 Int32,
    field_245 Int32,
    field_246 Int32,
    field_247 Int32,
    field_248 Int32,
    field_249 Int32,
    field_250 Int32,
    field_251 Int32,
    field_252 Int32,
    field_253 Int32,
    field_254 Int32,
    field_255 Int32,
    field_256 Int32,
    field_257 Int32
)
ENGINE = MergeTree
ORDER BY tuple()"

echo -e "field_1\n42" | $CLICKHOUSE_CLIENT -q "INSERT INTO test_02250 FORMAT CSVWithNames" --input_format_with_names_use_header 1
$CLICKHOUSE_CLIENT -q "SELECT * FROM test_02250" 
$CLICKHOUSE_CLIENT -q "DROP TABLE test_02250"
