Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,11 @@ jobs:
# If you encounter an error, run './dev/update_function_docs.sh' and commit
./dev/update_function_docs.sh
git diff --exit-code
- name: Check if metrics.md has been modified
run: |
# If you encounter an error, run './dev/update_metric_docs.sh' and commit
./dev/update_metric_docs.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also include this step to ./dev/rust_lint.rs for local non-functional check? Ideally we can have a version that only do the checks, but won't update the files.

git diff --exit-code

examples-docs-check:
name: check example README is up-to-date
Expand Down
53 changes: 53 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions ci/scripts/check_metric_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under this License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"

echo "$SCRIPT_PATH: Checking if metrics.md is up-to-date"

# Ensure we're in the project root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"

METRICS_FILE="docs/source/user-guide/metrics.md"
METRICS_BACKUP=$(mktemp)

if [ ! -f "$METRICS_FILE" ]; then
echo "Warning: $METRICS_FILE not found, skipping check." >&2
rm -f "$METRICS_BACKUP"
exit 0
fi

# Backup the current file
cp "$METRICS_FILE" "$METRICS_BACKUP"

# Run the update script (this will modify the file)
# Suppress output but capture exit code
if ! ./dev/update_metric_docs.sh > /dev/null 2>&1; then
echo "Error: Failed to run update_metric_docs.sh. Check permissions and try again." >&2
# Restore the original file
mv "$METRICS_BACKUP" "$METRICS_FILE"
exit 1
fi

# Compare the updated file with the backup
if ! diff -q "$METRICS_BACKUP" "$METRICS_FILE" > /dev/null; then
echo "Error: metrics.md is not up-to-date. Run './dev/update_metric_docs.sh' and commit the changes." >&2
# Restore the original file
mv "$METRICS_BACKUP" "$METRICS_FILE"
exit 1
fi

# Clean up the backup file
rm -f "$METRICS_BACKUP"
exit 0

2 changes: 1 addition & 1 deletion ci/scripts/doc_prettier_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if ! command -v npx >/dev/null 2>&1; then
fi

# Ignore subproject CHANGELOG.md because it is machine generated
npx prettier@2.7.1 $MODE \
npx prettier@3.7.4 $MODE \
'{datafusion,datafusion-cli,datafusion-examples,dev,docs}/**/*.md' \
'!datafusion/CHANGELOG.md' \
README.md \
Expand Down
6 changes: 5 additions & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ unicode_expressions = [
"datafusion-sql?/unicode_expressions",
"datafusion-functions/unicode_expressions",
]
docs = []
extended_tests = []

[dependencies]
Expand Down Expand Up @@ -167,8 +168,8 @@ criterion = { workspace = true, features = ["async_tokio", "async_futures"] }
ctor = { workspace = true }
dashmap = "6.1.0"
datafusion-doc = { workspace = true }
datafusion-functions-window-common = { workspace = true }
datafusion-macros = { workspace = true }
datafusion-functions-window-common = { workspace = true }
datafusion-physical-optimizer = { workspace = true }
doc-comment = { workspace = true }
env_logger = { workspace = true }
Expand All @@ -184,6 +185,9 @@ sysinfo = "0.37.2"
test-utils = { path = "../../test-utils" }
tokio = { workspace = true, features = ["rt-multi-thread", "parking_lot", "fs"] }

[build-dependencies]
toml = "0.9"

[package.metadata.cargo-machete]
ignored = ["datafusion-doc", "datafusion-macros", "dashmap"]

Expand Down
Loading