Skip to content

Commit 92061ce

Browse files
ritunjaymclaude
andcommitted
feat: add code coverage, Python linting, and Spark AQE optimization
- Code coverage: Codecov integration with XPlat collector + badge in README - Python linting: flake8 step in CI before tests, .flake8 config at repo root - Spark AQE: adaptive.enabled, coalescePartitions, skewJoin with inline comments explaining behavior at 100M+ record scale Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e9f00ae commit 92061ce

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

.flake8

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude =
4+
*_pb2.py
5+
*_pb2_grpc.py
6+
venv
7+
.git
8+
ignore = E203, W503

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ jobs:
4444
- name: Run unit tests
4545
run: dotnet test tests/VectorCatalog.Api.Tests/VectorCatalog.Api.Tests.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx"
4646

47+
- name: Test with coverage
48+
run: dotnet test --configuration Release --collect:"XPlat Code Coverage" --results-directory ./coverage
49+
50+
- name: Upload coverage to Codecov
51+
uses: codecov/codecov-action@v4
52+
with:
53+
directory: ./coverage
54+
fail_ci_if_error: false
55+
4756
- name: Publish test results
4857
uses: dorny/test-reporter@v1
4958
if: always()
@@ -70,6 +79,11 @@ jobs:
7079
python-version: ${{ env.PYTHON_VERSION }}
7180
cache: 'pip'
7281

82+
- name: Lint with flake8
83+
run: |
84+
pip install flake8
85+
flake8 sidecar/ spark/ scripts/ --max-line-length=120 --exclude=*_pb2*.py,*_pb2_grpc.py
86+
7387
- name: Install sidecar dependencies
7488
working-directory: ./sidecar
7589
run: |

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Vector Catalog Service
22

33
[![CI Pipeline](https://github.com/ritunjaym/vector-catalog-service/actions/workflows/ci.yml/badge.svg)](https://github.com/ritunjaym/vector-catalog-service/actions/workflows/ci.yml)
4+
[![codecov](https://codecov.io/gh/ritunjaym/vector-catalog-service/branch/main/graph/badge.svg)](https://codecov.io/gh/ritunjaym/vector-catalog-service)
45
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
56

67
> **Production-ready microservice for vector search over 100M+ NYC Taxi records**

spark/jobs/ingest_and_embed.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def generate_embedding(text):
7979

8080

8181
def create_spark_session():
82-
"""Create Spark session with Delta Lake support"""
82+
"""Create Spark session with Delta Lake support and AQE optimizations."""
8383
return (SparkSession.builder
8484
.appName("NYCTaxi-Ingestion-Embedding")
8585
.config("spark.jars.packages", "io.delta:delta-spark_2.12:3.1.0")
@@ -88,6 +88,16 @@ def create_spark_session():
8888
.config("spark.sql.shuffle.partitions", "8")
8989
.config("spark.executor.memory", "4g")
9090
.config("spark.driver.memory", "2g")
91+
# Adaptive Query Execution (AQE) — Spark 3.x:
92+
# Dynamically coalesces shuffle partitions to reduce small-file overhead
93+
# at 100M+ record scale where static partition counts cause imbalance.
94+
.config("spark.sql.adaptive.enabled", "true")
95+
# Merges small post-shuffle partitions into target size (~64MB default)
96+
# preventing thousands of tiny tasks on the taxi embedding pipeline.
97+
.config("spark.sql.adaptive.coalescePartitions.enabled", "true")
98+
# Splits skewed partitions (e.g., popular pickup zones with 10x more
99+
# records than average) to prevent stragglers from blocking the stage.
100+
.config("spark.sql.adaptive.skewJoin.enabled", "true")
91101
.getOrCreate())
92102

93103

0 commit comments

Comments
 (0)