Skip to content

Commit

Permalink
Java format and aggregate tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdunkerley committed Jun 8, 2024
1 parent 4c50e7b commit 1e14a09
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.Objects;
import java.util.UUID;
import org.enso.compiler.context.LocalScope;
import org.enso.compiler.core.ir.module.scope.Definition;
import org.enso.interpreter.EnsoLanguage;
import org.enso.interpreter.node.ClosureRootNode;
import org.enso.interpreter.node.EnsoRootNode;
Expand Down
24 changes: 24 additions & 0 deletions test/Table_Tests/src/Common_Table_Operations/Aggregate_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ add_specs suite_builder setup =
materialized.columns.at 0 . name . should_equal "Count"
materialized.columns.at 0 . at 0 . should_equal 2500

group_builder.specify "should be able to count (autoscoped)" <|
grouped = data.table.aggregate columns=[..Count]
materialized = materialize grouped
Problems.assume_no_problems materialized
grouped.row_count . should_equal 1
materialized.column_count . should_equal 1
materialized.columns.at 0 . name . should_equal "Count"
materialized.columns.at 0 . at 0 . should_equal 2500

group_builder.specify "should be able to count missing values" <|
grouped = data.table.aggregate columns=[Count_Nothing "Hexadecimal", Count_Not_Nothing "Hexadecimal", Count_Empty "TextWithNothing", Count_Not_Empty "TextWithNothing"]
materialized = materialize grouped
Expand Down Expand Up @@ -125,6 +134,21 @@ add_specs suite_builder setup =
materialized.columns.at 3 . name . should_equal "Average ValueWithNothing"
materialized.columns.at 3 . at 0 . should_equal 1.228650 epsilon=0.000001

group_builder.specify "should be able to compute sum and average of values (autoscoped)" <|
grouped = data.table.aggregate columns=[..Sum "Value", ..Sum "ValueWithNothing", ..Average "Value", ..Average "ValueWithNothing"]
materialized = materialize grouped
Problems.assume_no_problems materialized
grouped.row_count . should_equal 1
materialized.column_count . should_equal 4
materialized.columns.at 0 . name . should_equal "Sum Value"
materialized.columns.at 0 . at 0 . should_equal -932.411550 epsilon=0.000001
materialized.columns.at 1 . name . should_equal "Sum ValueWithNothing"
materialized.columns.at 1 . at 0 . should_equal 2757.09 epsilon=0.000001
materialized.columns.at 2 . name . should_equal "Average Value"
materialized.columns.at 2 . at 0 . should_equal -0.372965 epsilon=0.000001
materialized.columns.at 3 . name . should_equal "Average ValueWithNothing"
materialized.columns.at 3 . at 0 . should_equal 1.228650 epsilon=0.000001

group_builder.specify "should be able to compute standard deviation of values" (pending = resolve_pending test_selection.std_dev) <|
grouped = data.table.aggregate columns=[Standard_Deviation "Value", Standard_Deviation "ValueWithNothing", (Standard_Deviation "Value" population=True), (Standard_Deviation "ValueWithNothing" population=True)]
materialized = materialize grouped
Expand Down

0 comments on commit 1e14a09

Please sign in to comment.