Skip to content

Conversation

@tabVersion
Copy link

WIP

@tabVersion tabVersion requested a review from Copilot August 27, 2025 06:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new real-time promotion rule engine solution demo that processes casino member events through Kafka and RisingWave to match against configurable promotion rules and calculate rewards.

Key changes:

  • Implements a complete SQL-based promotion rule engine with event matching and reward calculation
  • Adds a Python Kafka producer for generating realistic casino events at configurable QPS
  • Provides comprehensive documentation for the promotion engine architecture and usage

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
pipeline.sql Complete RisingWave SQL implementation with materialized views for event processing, rule matching, and reward calculation
event_producer.py Python Kafka producer that generates realistic casino events with member profiles and configurable throughput
promotion_rule_engine/README.md Documentation explaining the architecture, data model, and usage instructions
03-solution-demos/README.md Updates main demos index to include the new promotion rule engine

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

metadata JSONB
) WITH (
connector = 'kafka',
topic = 'user_events',
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

The Kafka topic name 'user_events' doesn't match the table name 'events'. This inconsistency could cause confusion during debugging and maintenance.

Suggested change
topic = 'user_events',
topic = 'events',

Copilot uses AI. Check for mistakes.
logger = logging.getLogger(__name__)

class CasinoKafkaProducer:
def __init__(self, bootstrap_servers='localhost:9092', topic='casino_events'):
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

The default topic 'casino_events' in the Python producer doesn't match the topic 'user_events' configured in the SQL pipeline, which could lead to events being produced to the wrong topic.

Suggested change
def __init__(self, bootstrap_servers='localhost:9092', topic='casino_events'):
def __init__(self, bootstrap_servers='localhost:9092', topic='user_events'):

Copilot uses AI. Check for mistakes.
ELSE 1.0
END AS dynamic_multiplier,
-- Calculate raw reward
reward_value *
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

The reward calculation logic is duplicated multiple times (lines 270-284, 287-301). Consider extracting this into a function or using a WITH clause to improve maintainability.

Copilot uses AI. Check for mistakes.
tabVersion and others added 2 commits August 27, 2025 15:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@hengm3467
Copy link
Contributor

@tabVersion is this finished? :)

@tabVersion
Copy link
Author

@tabVersion is this finished? :)

Not yet, we need another table def and sql. Let me mark as draft for now.

@tabVersion tabVersion marked this pull request as draft September 22, 2025 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants