@@ -224,16 +224,15 @@ if ! $INSTALL_SUCCESS; then
224
224
fi
225
225
226
226
# --- Auto-generate Settings Documentation ---
227
- # Source files are assumed to be present in the CWD ($tmp_dir) by copy-clickhouse-repo-docs
228
227
echo " [$SCRIPT_NAME ] Auto-generating settings markdown pages..."
229
- # $target_dir is the project root (clickhouse-docs)
230
228
231
- sql_files_found=$( find " $SCRIPT_DIR " -maxdepth 1 -name ' *.sql' -print -quit)
229
+ # Process other SQL files first (non-function related)
230
+ sql_files_found=$( find " $SCRIPT_DIR " -maxdepth 1 -name ' *.sql' ! -name ' generate-functions.sql' -print -quit)
232
231
if [ -z " $sql_files_found " ]; then
233
- echo " [$SCRIPT_NAME ] Warning: No *.sql files found in $SCRIPT_DIR to process."
232
+ echo " [$SCRIPT_NAME ] Warning: No non-function *.sql files found in $SCRIPT_DIR to process."
234
233
else
235
234
for SQL_FILE in " $SCRIPT_DIR " /* .sql; do
236
- if [ -f " $SQL_FILE " ]; then
235
+ if [ -f " $SQL_FILE " ] && [ " $( basename " $SQL_FILE " ) " != " generate-functions.sql " ] ; then
237
236
echo " [$SCRIPT_NAME ] Processing SQL file: $SQL_FILE "
238
237
# Run ClickHouse from CWD ($tmp_dir), passing absolute path to SQL file
239
238
" $script_path " --queries-file " $SQL_FILE " || {
@@ -246,6 +245,39 @@ else
246
245
done
247
246
fi
248
247
248
+ # Generate function documentation using the consolidated SQL file
249
+ FUNCTION_SQL_FILE=" $SCRIPT_DIR /generate-functions.sql"
250
+ if [ -f " $FUNCTION_SQL_FILE " ]; then
251
+ echo " [$SCRIPT_NAME ] Generating function documentation using consolidated SQL file..."
252
+
253
+ # Define function categories to process
254
+ FUNCTION_CATEGORIES=(" Arithmetic" " Arrays" " Bit" " Bitmap" " Comparison" " Conditional" )
255
+
256
+ for CATEGORY in " ${FUNCTION_CATEGORIES[@]} " ; do
257
+ echo " [$SCRIPT_NAME ] Processing $CATEGORY functions..."
258
+ " $script_path " --param_category=" $CATEGORY " --queries-file " $FUNCTION_SQL_FILE " || {
259
+ echo " [$SCRIPT_NAME ] FATAL: Failed to execute queries for $CATEGORY functions." ;
260
+ echo " [$SCRIPT_NAME ] Attempting to re-run with output:"
261
+ " $script_path " --param_category=" $CATEGORY " --queries-file " $FUNCTION_SQL_FILE "
262
+ exit 1;
263
+ }
264
+
265
+ # Rename the temporary output file to the correct name
266
+ CATEGORY_LOWER=$( echo " $CATEGORY " | tr ' [:upper:]' ' [:lower:]' )
267
+ if [ -f " temp-functions.md" ]; then
268
+ mv " temp-functions.md" " ${CATEGORY_LOWER} -functions.md" || {
269
+ echo " [$SCRIPT_NAME ] Error: Failed to rename temp-functions.md to ${CATEGORY_LOWER} -functions.md"
270
+ exit 1
271
+ }
272
+ echo " [$SCRIPT_NAME ] Generated ${CATEGORY_LOWER} -functions.md"
273
+ else
274
+ echo " [$SCRIPT_NAME ] Warning: temp-functions.md not found after processing $CATEGORY functions"
275
+ fi
276
+ done
277
+ else
278
+ echo " [$SCRIPT_NAME ] Warning: Consolidated function SQL file not found at $FUNCTION_SQL_FILE "
279
+ fi
280
+
249
281
# --- temporary sed replacements ---
250
282
sed -i.bak \
251
283
-e ' s/Limit the max number of partitions that can be accessed in one query. <= 0 means unlimited./Limit the max number of partitions that can be accessed in one query. `<=` 0 means unlimited./g' \
314
346
insert_src_files=(
315
347
" experimental-beta-settings.md"
316
348
" arithmetic-functions.md"
317
- " array -functions.md"
349
+ " arrays -functions.md"
318
350
" bit-functions.md"
319
351
" bitmap-functions.md"
320
352
" comparison-functions.md"
0 commit comments