-
Notifications
You must be signed in to change notification settings - Fork 0
eval query support and a few fixes #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe pull request introduces enhancements to Chronon's interactive runner, focusing on updating documentation, improving the Changes
Sequence DiagramsequenceDiagram
participant User
participant Interactive as Interactive Runner
participant Evaluator
participant Spark
User->>Interactive: eval(source, limit=5)
Interactive->>Evaluator: evalQuery(source, limit)
Evaluator->>Spark: Execute SQL Query
Spark-->>Evaluator: Return DataFrame
Evaluator-->>Interactive: Return Evaluation Result
Interactive-->>User: Display Results
Possibly related PRs
Suggested reviewers
Poem
Warning Review ran into problems🔥 ProblemsGitHub Actions: Resource not accessible by integration - https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository. Please grant the required permissions to the CodeRabbit GitHub App under the organization or repository settings. ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
api/py/ai/chronon/repo/interactive.py (1)
44-46
: Add type hints-def eval(obj, limit=5): +def eval(obj: Union[str, thrift.Source, thrift.GroupBy, thrift.Join, thrift.StagingQuery, thrift.Model], limit: int = 5):api/py/ai/chronon/repo/interactive.md (3)
25-25
: Use placeholder paths in documentationReplace hard-coded paths with placeholders like
<SPARK_HOME>
and<CHRONON_ROOT>
.Also applies to: 31-31
29-32
: Add language specifier to code blockAdd 'bash' or 'shell' to the code block fence.
🧰 Tools
🪛 Markdownlint (0.37.0)
29-29: null
Fenced code blocks should have a language specified(MD040, fenced-code-language)
46-46
: Fix typographical errorReplace
..
with.
🧰 Tools
🪛 LanguageTool
[typographical] ~46-~46: Two consecutive dots
Context: ... objects in vscode in a notebook like so.. ```py # import source, I do this by r...(DOUBLE_PUNCTUATION)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (3)
api/py/ai/chronon/repo/interactive.md
(1 hunks)api/py/ai/chronon/repo/interactive.py
(4 hunks)spark/src/main/scala/ai/chronon/spark/interactive/Evaluator.scala
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
api/py/ai/chronon/repo/interactive.md
[typographical] ~46-~46: Two consecutive dots
Context: ... objects in vscode in a notebook like so.. ```py # import source, I do this by r...
(DOUBLE_PUNCTUATION)
🪛 Markdownlint (0.37.0)
api/py/ai/chronon/repo/interactive.md
29-29: null
Fenced code blocks should have a language specified
(MD040, fenced-code-language)
40-40: null
Fenced code blocks should have a language specified
(MD040, fenced-code-language)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: table_utils_delta_format_spark_tests
- GitHub Check: other_spark_tests
- GitHub Check: mutation_spark_tests
- GitHub Check: fetcher_spark_tests
- GitHub Check: no_spark_scala_tests
- GitHub Check: join_spark_tests
- GitHub Check: scala_compile_fmt_fix
🔇 Additional comments (2)
api/py/ai/chronon/repo/interactive.py (1)
64-64
: LGTM! Modern SparkSession usagespark/src/main/scala/ai/chronon/spark/interactive/Evaluator.scala (1)
36-48
:⚠️ Potential issueProtect against SQL injection
Direct string execution is unsafe. Consider using prepared statements or query parameters.
@@ -4,7 +4,7 @@ | |||
import ai.chronon.api.ttypes as thrift | |||
|
|||
|
|||
def eval(obj): | |||
def eval(obj, limit=5): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add input validation for limit parameter
def eval(obj, limit=5):
+ if not isinstance(limit, int) or limit <= 0:
+ raise ValueError("limit must be a positive integer")
Also applies to: 25-25
## Summary eval("select ... from ... where ...") is now supported. easier for exploration. ## Checklist - [ ] Added Unit Tests - [ ] Covered by existing CI - [x] Integration tested - [x] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated setup instructions for Chronon Python interactive runner - Modified environment variable paths and gateway service instructions - **New Features** - Added ability to specify result limit when evaluating queries - Enhanced SQL query evaluation with error handling - **Bug Fixes** - Simplified interactive usage example - Updated Spark session method in DataFrame creation <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary eval("select ... from ... where ...") is now supported. easier for exploration. ## Checklist - [ ] Added Unit Tests - [ ] Covered by existing CI - [x] Integration tested - [x] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated setup instructions for Chronon Python interactive runner - Modified environment variable paths and gateway service instructions - **New Features** - Added ability to specify result limit when evaluating queries - Enhanced SQL query evaluation with error handling - **Bug Fixes** - Simplified interactive usage example - Updated Spark session method in DataFrame creation <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary eval("select ... from ... where ...") is now supported. easier for exploration. ## Checklist - [ ] Added Unit Tests - [ ] Covered by existing CI - [x] Integration tested - [x] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated setup instructions for Chronon Python interactive runner - Modified environment variable paths and gateway service instructions - **New Features** - Added ability to specify result limit when evaluating queries - Enhanced SQL query evaluation with error handling - **Bug Fixes** - Simplified interactive usage example - Updated Spark session method in DataFrame creation <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary eval("select ... from ... where ...") is now supported. easier for exploration. ## Checklist - [ ] Added Unit Tests - [ ] Covered by existing CI - [x] Integration tested - [x] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated setup instructions for Chronon Python interactive runner - Modified environment variable paths and gateway service instructions - **New Features** - Added ability to specify result limit when evaluating queries - Enhanced SQL query evaluation with error handling - **Bug Fixes** - Simplified interactive usage example - Updated Spark session method in DataFrame creation <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary eval("select ... from ... where ...") is now supported. easier for exploration. ## Cheour clientslist - [ ] Added Unit Tests - [ ] Covered by existing CI - [x] Integration tested - [x] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated setup instructions for Chronon Python interactive runner - Modified environment variable paths and gateway service instructions - **New Features** - Added ability to specify result limit when evaluating queries - Enhanced SQL query evaluation with error handling - **Bug Fixes** - Simplified interactive usage example - Updated Spark session method in DataFrame creation <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
eval("select ... from ... where ...") is now supported. easier for exploration.
Checklist
Summary by CodeRabbit
Documentation
New Features
Bug Fixes