Copilot commented on code in PR #2518:
URL: https://github.com/apache/sedona/pull/2518#discussion_r2554637401
##########
.github/workflows/docker-build.yml:
##########
@@ -46,14 +46,14 @@ jobs:
fail-fast: true
matrix:
os: ['ubuntu-latest']
- spark: ['3.5.1', '3.4.3']
+ spark: ['4.0.1']
include:
- - spark: 3.5.1
+ - spark: 4.0.1
sedona: 'latest'
- geotools: '33.1-rc1'
- - spark: 3.4.3
- sedona: 1.6.0
- geotools: 28.2
+ geotools: '33.1'
+ - spark: 4.0.1
+ sedona: 1.8.0
+ geotools: '33.1'
Review Comment:
The matrix includes duplicate entries with identical spark/geotools versions
(lines 51-53 and 54-56). This will cause the same job to run twice
unnecessarily. Remove the duplicate entry.
```suggestion
```
##########
docker/test-notebooks.sh:
##########
@@ -0,0 +1,227 @@
+#!/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 the 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.
+
+set -e
+
+# Set up environment variables if not already set
+export SPARK_HOME=${SPARK_HOME:-/opt/spark}
+export PYSPARK_PYTHON=${PYSPARK_PYTHON:-python3}
+export PYSPARK_DRIVER_PYTHON=${PYSPARK_DRIVER_PYTHON:-python3}
+# Add py4j to PYTHONPATH (it's in Spark's python/lib directory)
+PY4J_ZIP=$(find "$SPARK_HOME/python/lib" -name "py4j-*.zip" | head -1)
+if [ -n "$PY4J_ZIP" ]; then
+ export PYTHONPATH=${SPARK_HOME}/python:${PY4J_ZIP}:${PYTHONPATH}
+else
+ export PYTHONPATH=${SPARK_HOME}/python:${PYTHONPATH}
+fi
+
+# Configure Spark to run in local mode (no cluster needed for testing)
+export SPARK_MASTER=${SPARK_MASTER:-local[*]}
+
+EXAMPLES_DIR="/opt/workspace/examples"
+FAILED_TESTS=0
+PASSED_TESTS=0
+
+echo "========================================="
+echo "Testing Jupyter Notebooks"
+echo "========================================="
+
+# Check if examples directory exists
+if [ ! -d "$EXAMPLES_DIR" ]; then
+ echo "Error: Examples directory $EXAMPLES_DIR does not exist"
+ exit 1
+fi
+
+# Find all .ipynb files only in the root level (exclude subdirectories like
contrib)
+NOTEBOOK_FILES=$(find "$EXAMPLES_DIR" -maxdepth 1 -name "*.ipynb" -type f)
+
+if [ -z "$NOTEBOOK_FILES" ]; then
+ echo "No .ipynb files found in $EXAMPLES_DIR (root level only)"
+ exit 0
+fi
+
+NOTEBOOK_COUNT=$(echo "$NOTEBOOK_FILES" | grep -c . || echo "0")
Review Comment:
The grep -c command will fail if NOTEBOOK_FILES is empty or contains only
whitespace, causing the || fallback to execute. However, if NOTEBOOK_FILES has
content but grep fails for another reason, the error will be silently masked.
Use wc -l instead: `NOTEBOOK_COUNT=$(echo \"$NOTEBOOK_FILES\" | wc -l)`
```suggestion
NOTEBOOK_COUNT=$(echo "$NOTEBOOK_FILES" | wc -l)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]