Repository: influxdata/influxdb
File: influxdb3_write/src/write_buffer/mod.rs (Rust)

Code before:
        })?;

        let buffer_filter = BufferFilter::new(&table_def, filters)
            .map_err(|error| DataFusionError::External(Box::new(error)))?;

        let mut chunks = self.buffer.get_table_chunks(
            Arc::clone(&db_schema),
            table_name,
            &buffer_filter,
            projection,
            ctx,
        )?;

        let parquet_files = self.persisted_files.get_files_filtered(
            db_schema.id,
            table_def.table_id,
            &buffer_filter,
        );

        if parquet_files.len() > self.file_num_limit {
            return Err(DataFusionError::External(
                format!(
                    "Query would exceed file limit of {} parquet files. \
                     Please specify a smaller time range for your \
                     query. You can increase the file limit with the \
                     `--file-limit` option in the serve command, however, \
                     query performance might suffer as a result",
                    self.file_num_limit
                )
                .into(),
            ));
        }

        let mut chunk_order = chunks.len() as i64;

        for parquet_file in parquet_files {
            let parquet_chunk = parquet_chunk_from_file(
                &parquet_file,
                &table_def.schema,
                self.persister.object_store_url().clone(),
                self.persister.object_store(),
                chunk_order,
            );

            chunk_order += 1;

            chunks.push(Arc::new(parquet_chunk));
        }

        Ok(chunks)
    }

Review comment (suggestion):
Update message to go with suggested option name `query-file-limit`

Code after:
        })?;

        let buffer_filter = BufferFilter::new(&table_def, filters)
            .map_err(|error| DataFusionError::External(Box::new(error)))?;

        let mut chunks = self.buffer.get_table_chunks(
            Arc::clone(&db_schema),
            table_name,
            &buffer_filter,
            projection,
            ctx,
        )?;

        let parquet_files = self.persisted_files.get_files_filtered(
            db_schema.id,
            table_def.table_id,
            &buffer_filter,
        );

        if parquet_files.len() > self.query_file_limit {
            return Err(DataFusionError::External(
                format!(
                    "Query would exceed file limit of {} parquet files. \
                     Please specify a smaller time range for your \
                     query. You can increase the file limit with the \
                     `--query-file-limit` option in the serve command, however, \
                     query performance will be slower and the server may get \
                     OOM killed or become unstable as a result",
                    self.query_file_limit
                )
                .into(),
            ));
        }

        let mut chunk_order = chunks.len() as i64;

        for parquet_file in parquet_files {
            let parquet_chunk = parquet_chunk_from_file(
                &parquet_file,
                &table_def.schema,
                self.persister.object_store_url().clone(),
                self.persister.object_store(),
                chunk_order,
            );

            chunk_order += 1;

            chunks.push(Arc::new(parquet_chunk));
        }

        Ok(chunks)