Skip to content

Documentation:Implement all intergration test#33

Merged
Rich-T-kid merged 2 commits intopre-releasefrom
documentation/intergration-test
Dec 5, 2025
Merged

Documentation:Implement all intergration test#33
Rich-T-kid merged 2 commits intopre-releasefrom
documentation/intergration-test

Conversation

@Rich-T-kid
Copy link
Copy Markdown
Owner

No description provided.

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 comprehensive integration tests for various SQL operators including filter, join, aggregation, sort, and scalar functions. The changes convert previously commented-out test specifications into working test implementations, and add supporting functionality for boolean type handling in aggregations and scalar function validation in filters.

Key Changes:

  • Implements 7 test functions covering filter/limit, scalar functions, sorting, joins, aggregations, distinct operations, and complex multi-operator pipelines
  • Adds boolean type support in the aggregation builder
  • Extends filter validation to handle scalar functions
  • Removes unnecessary string conversions in expression tests

Reviewed changes

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

Show a summary per file
File Description
src/Backend/opti-sql-go/operators/test/intergration_test.go Main integration test implementation with 7 test functions covering various operator combinations
src/Backend/opti-sql-go/operators/filter/filter.go Adds scalar function validation support and debug logging
src/Backend/opti-sql-go/operators/aggr/groupBy.go Implements boolean type handling in dynamic array builder with helper function
src/Backend/opti-sql-go/Expr/expr_test.go Removes redundant string conversions in test assertions
src/Backend/opti-sql-go/Expr/expr.go Removes debug print statement from literal resolve function

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

if v == "true" || v == true {
return true
}
return false
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The castToBool function only checks for "true" string and true boolean. This will incorrectly return false for the string "false", which should be considered a valid boolean value. Consider handling "false" explicitly and potentially raising an error for invalid inputs.

Suggested change
return false
if v == "false" || v == false {
return false
}
panic(fmt.Sprintf("invalid value for castToBool: %v (type %T)", v, v))

Copilot uses AI. Check for mistakes.
Comment on lines +287 to +288
return
}
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The t.Fatalf should use t.Errorf or the test should not have a return statement after it. t.Fatalf immediately terminates the test, so the return on line 287 is unreachable code.

Suggested change
return
}
}
}

Copilot uses AI. Check for mistakes.
t.Fatalf("unexpected error: %v", err)
}
if batch != nil {
t.Fatalf("was expecting an empty batch but recieved %s\n", batch.PrettyPrint())
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

Spelling error: "recieved" should be "received".

Suggested change
t.Fatalf("was expecting an empty batch but recieved %s\n", batch.PrettyPrint())
t.Fatalf("was expecting an empty batch but received %s\n", batch.PrettyPrint())

Copilot uses AI. Check for mistakes.
case arrow.BOOL:
b := array.NewBooleanBuilder(mem)
for _, v := range values {
fmt.Printf("values:%v type:%T\n", v, v)
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

Debug print statement left in production code. This should be removed before merging as it will clutter logs during normal operation.

Suggested change
fmt.Printf("values:%v type:%T\n", v, v)

Copilot uses AI. Check for mistakes.
if err != nil {
t.Fatalf("join init failed: %v", err)
}
fmt.Printf("schema:%v\n", j.Schema())
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

Debug print statement left in production code. This should be removed before merging as it will clutter logs during normal operation.

Suggested change
fmt.Printf("schema:%v\n", j.Schema())
t.Logf("schema:%v", j.Schema())

Copilot uses AI. Check for mistakes.

case *Expr.NullCheckExpr:
return validPredicates(p.Expr, schema)
case *Expr.ScalarFunction:
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The ScalarFunction case always returns true without validating its arguments. This could allow invalid scalar functions to pass validation. Consider recursively validating the function's arguments against the schema, similar to how BinaryExpr validates its children.

Suggested change
case *Expr.ScalarFunction:
case *Expr.ScalarFunction:
for _, arg := range p.Args {
if !validPredicates(arg, schema) {
return false
}
}

Copilot uses AI. Check for mistakes.
exprs := Expr.NewExpressions(
Expr.NewAlias(Expr.NewColumnResolve("left_id"), "id"),
Expr.NewColumnResolve("username"),
Expr.NewAlias(Expr.NewColumnResolve("department_name"), "deptartment"),
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

Spelling error in alias: "deptartment" should be "department".

Suggested change
Expr.NewAlias(Expr.NewColumnResolve("department_name"), "deptartment"),
Expr.NewAlias(Expr.NewColumnResolve("department_name"), "department"),

Copilot uses AI. Check for mistakes.
if !arrow.TypeEqual(dt1, dt2) {
return false
}
fmt.Printf("left:\t%v\nright:\t%v\n", p.Left, p.Right)
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

Debug print statement left in production code. This should be removed before merging as it will clutter logs during normal operation.

Suggested change
fmt.Printf("left:\t%v\nright:\t%v\n", p.Left, p.Right)

Copilot uses AI. Check for mistakes.
// (5.B) SELECT is_active, COUNT(*) AS active_count, AVG(age_years) AS avg_age FROM source1 GROUP BY is_active;
t.Run("5B", func(t *testing.T) {
src := source1Project()
fmt.Printf("\t%v\n", src.Schema())
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

Debug print statement left in production code. This should be removed before merging as it will clutter logs during normal operation.

Suggested change
fmt.Printf("\t%v\n", src.Schema())
t.Logf("\t%v\n", src.Schema())

Copilot uses AI. Check for mistakes.
@Rich-T-kid
Copy link
Copy Markdown
Owner Author

closes #32

@Rich-T-kid Rich-T-kid merged commit 488bf2b into pre-release Dec 5, 2025
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