Skip to content

Feature/expresion operator#10

Closed
Rich-T-kid wants to merge 11 commits intomainfrom
feature/Expresion-Operator
Closed

Feature/expresion operator#10
Rich-T-kid wants to merge 11 commits intomainfrom
feature/Expresion-Operator

Conversation

@Rich-T-kid
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings November 18, 2025 05:51
@Rich-T-kid Rich-T-kid closed this Nov 18, 2025
Copy link
Copy Markdown
Contributor

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 implements a comprehensive expression operator framework for the OptiSQL query engine, adding support for projection operations, various data sources (CSV, Parquet, S3), and expression evaluation infrastructure.

Key Changes

  • Implemented projection operators with support for column pruning and schema filtering
  • Added CSV and Parquet data source readers with Arrow integration
  • Introduced S3 network resource support for remote data access
  • Created expression evaluation framework with binary operators, scalar functions, and aggregates
  • Added extensive test coverage for all new operators

Reviewed Changes

Copilot reviewed 32 out of 36 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/Backend/opti-sql-rs/src/main.rs Rust DataFusion integration with Substrait plan generation (contains typo)
src/Backend/opti-sql-rs/Cargo.toml Added datafusion-substrait and tokio dependencies
src/Backend/opti-sql-go/operators/project/*.go Core project operator implementations (CSV, Parquet, in-memory sources)
src/Backend/opti-sql-go/operators/Expr/expr.go Expression evaluation framework with operators and functions
src/Backend/opti-sql-go/operators/filter/filter.go Filter expression infrastructure (contains typos)
src/Backend/opti-sql-go/config/config.go SECURITY ISSUE: Contains hardcoded S3 credentials
src/Backend/test_data/* Test data files for CSV and Parquet sources
.gitignore Updated to track specific test data files
CONTRIBUTING.md Added instructions for HTML coverage reports
Makefile Minor formatting cleanup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// function calls
let (l,r) = basic_project("function call with Abs()",&mut ctx,"SELECT ABS(age) FROM example").await;
//println!("Logical Plan:\n{}", l);
print_batches(&r).unwrap();ß
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Invalid character 'ß' found in the code. This appears to be a typo that should be removed.

Copilot uses AI. Check for mistakes.
@@ -1,8 +1,65 @@
//use datafusion::arrow::record_batch::RecordBatch;
use datafusion::{arrow::{array::RecordBatch, util::pretty::print_batches}, functions::crypto::basic, prelude::*};
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Unused import basic from datafusion::functions::crypto::basic. This import should be removed if not used.

Copilot uses AI. Check for mistakes.
Comment on lines +95 to +100
// TODO: remove hardcoded secretes before production. we are just testing for now
Secretes: secretesConfig{
AccessKey: "DO8013ZT6VDHJ2EM94RN",
SecretKey: "kPvQSMt6naiwe/FhDnzXpYmVE5yzJUsIR0/OJpsUNzo",
EndpointURL: "atl1.digitaloceanspaces.com",
BucketName: "test-bucket-pull-down",
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Hardcoded AWS/S3 credentials (Access Key and Secret Key) are exposed in the codebase. These sensitive credentials should never be committed to version control. Use environment variables or a secure secrets management system instead.

Suggested change
// TODO: remove hardcoded secretes before production. we are just testing for now
Secretes: secretesConfig{
AccessKey: "DO8013ZT6VDHJ2EM94RN",
SecretKey: "kPvQSMt6naiwe/FhDnzXpYmVE5yzJUsIR0/OJpsUNzo",
EndpointURL: "atl1.digitaloceanspaces.com",
BucketName: "test-bucket-pull-down",
// Load secrets from environment variables for security
Secretes: secretesConfig{
AccessKey: os.Getenv("AWS_ACCESS_KEY"),
SecretKey: os.Getenv("AWS_SECRET_KEY"),
EndpointURL: os.Getenv("AWS_ENDPOINT_URL"),
BucketName: os.Getenv("AWS_BUCKET_NAME"),

Copilot uses AI. Check for mistakes.
} else {
v, err := strconv.ParseInt(cell, 10, 64)
if err != nil {
fmt.Printf("failed to parse cell: %v with error: %v\n", cell, err)
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Using fmt.Printf for error logging in production code. Consider using a proper logging framework or returning errors to the caller instead of printing to stdout.

Copilot uses AI. Check for mistakes.
} else {
v, err := strconv.ParseFloat(cell, 64)
if err != nil {
fmt.Printf("failed to parse cell: %v with error: %v\n", cell, err)
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Using fmt.Printf for error logging in production code. Consider using a proper logging framework or returning errors to the caller instead of printing to stdout.

Copilot uses AI. Check for mistakes.

defer func() {
if err := filerReader.Close(); err != nil {
fmt.Printf("warning: failed to close parquet reader: %v\n", err)
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Using fmt.Printf for warning messages. Consider using a proper logging framework for consistent logging across the application.

Copilot uses AI. Check for mistakes.
// OR
// AND
// NOT
// FilterExpr takes in a field and column and yeilds a function that takes in an index and returns a bool indicating whether the row at that index satisfies the filter condition.
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Typo in documentation comment: 'yeilds' should be 'yields'.

Suggested change
// FilterExpr takes in a field and column and yeilds a function that takes in an index and returns a bool indicating whether the row at that index satisfies the filter condition.
// FilterExpr takes in a field and column and yields a function that takes in an index and returns a bool indicating whether the row at that index satisfies the filter condition.

Copilot uses AI. Check for mistakes.
// AND
// NOT
// FilterExpr takes in a field and column and yeilds a function that takes in an index and returns a bool indicating whether the row at that index satisfies the filter condition.
type FilterExpr func(filed arrow.Field, col arrow.Array) func(i int) bool
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Typo in parameter name: 'filed' should be 'field'.

Suggested change
type FilterExpr func(filed arrow.Field, col arrow.Array) func(i int) bool
type FilterExpr func(field arrow.Field, col arrow.Array) func(i int) bool

Copilot uses AI. Check for mistakes.

defer func() {
if err := filerReader.Close(); err != nil {
fmt.Printf("warning: failed to close parquet reader: %v\n", err)
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Using fmt.Printf for warning messages. Consider using a proper logging framework for consistent logging across the application.

Copilot uses AI. Check for mistakes.
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.

2 participants