From 7e0870267ed391bf1042a5f159c825716b14ddfe Mon Sep 17 00:00:00 2001 From: James Dunkerley Date: Wed, 24 Jul 2024 17:39:10 +0100 Subject: [PATCH] Fix Simple Expression issue where column arguments weren't resolved. (#10658) Closes #10657 Was missing the `table.resolve` for arguments. --- .../0.0.0-dev/src/Simple_Expression.enso | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Simple_Expression.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Simple_Expression.enso index 772abc2d76f1..88291972e24b 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Simple_Expression.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Simple_Expression.enso @@ -32,10 +32,10 @@ type Simple_Expression input_column = table.resolve_as_column self.input derived = case self.operation of Simple_Calculation.Copy -> input_column . rename (input_column.name+" (Copy)") - Simple_Calculation.Text operation -> operation.evaluate input_column - Simple_Calculation.Math operation -> operation.evaluate input_column - Simple_Calculation.Date operation -> operation.evaluate input_column - Simple_Calculation.Logical operation -> operation.evaluate input_column + Simple_Calculation.Text operation -> operation.evaluate input_column table + Simple_Calculation.Math operation -> operation.evaluate input_column table + Simple_Calculation.Date operation -> operation.evaluate input_column table + Simple_Calculation.Logical operation -> operation.evaluate input_column table Simple_Calculation.Add rhs -> input_column + (table.resolve rhs) Simple_Calculation.Subtract rhs -> input_column - (table.resolve rhs) Simple_Calculation.Multiply rhs -> input_column * (table.resolve rhs) @@ -132,16 +132,16 @@ type Text_Operation ## PRIVATE Evaluate the operation - will be passed a Column or DB_Column - evaluate : Any -> Any - evaluate self column = + evaluate : Any -> Table_Ref -> Any + evaluate self column table:Table_Ref = case self of - Text_Operation.Left length -> column.text_left length - Text_Operation.Right length -> column.text_right length + Text_Operation.Left length -> column.text_left (table.resolve length) + Text_Operation.Right length -> column.text_right (table.resolve length) Text_Operation.Length -> column.text_length - Text_Operation.Trim where what -> column.trim where what - Text_Operation.Starts_With prefix -> column.starts_with prefix - Text_Operation.Ends_With suffix -> column.ends_with suffix - Text_Operation.Contains substring -> column.contains substring + Text_Operation.Trim where what -> column.trim (table.resolve where) (table.resolve what) + Text_Operation.Starts_With prefix -> column.starts_with (table.resolve prefix) + Text_Operation.Ends_With suffix -> column.ends_with (table.resolve suffix) + Text_Operation.Contains substring -> column.contains (table.resolve substring) ## Defines a set of Math based operations. type Math_Operation @@ -192,14 +192,14 @@ type Math_Operation ## PRIVATE Evaluate the operation - will be passed a Column or DB_Column - evaluate : Any -> Any - evaluate self column = + evaluate : Any -> Table_Ref -> Any + evaluate self column table:Table_Ref = case self of - Math_Operation.Subtract rhs -> column - rhs - Math_Operation.Multiply rhs -> column * rhs - Math_Operation.Divide rhs -> column / rhs - Math_Operation.Mod rhs -> column % rhs - Math_Operation.Power rhs -> column ^ rhs + Math_Operation.Subtract rhs -> column - (table.resolve rhs) + Math_Operation.Multiply rhs -> column * (table.resolve rhs) + Math_Operation.Divide rhs -> column / (table.resolve rhs) + Math_Operation.Mod rhs -> column % (table.resolve rhs) + Math_Operation.Power rhs -> column ^ (table.resolve rhs) Math_Operation.Round precision use_bankers -> column.round precision use_bankers Math_Operation.Ceil -> column.ceil Math_Operation.Floor -> column.floor @@ -258,12 +258,12 @@ type Date_Operation ## PRIVATE Evaluate the operation - will be passed a Column or DB_Column - evaluate : Any -> Any - evaluate self column = + evaluate : Any -> Table_Ref -> Any + evaluate self column table:Table_Ref = case self of - Date_Operation.Add length period -> column.date_add length period + Date_Operation.Add length period -> column.date_add (table.resolve length) period Date_Operation.Part period -> column.date_part period - Date_Operation.Diff end period -> column.date_diff end period + Date_Operation.Diff end period -> column.date_diff (table.resolve end) period Date_Operation.Truncate -> column.truncate Date_Operation.Year -> column.year Date_Operation.Month -> column.month @@ -296,12 +296,12 @@ type Logical_Operation ## PRIVATE Evaluate the operation - will be passed a Column or DB_Column - evaluate : Any -> Any - evaluate self column = + evaluate : Any -> Table_Ref -> Any + evaluate self column table:Table_Ref = case self of Logical_Operation.Not -> column.not - Logical_Operation.And rhs -> column && rhs - Logical_Operation.Or rhs -> column || rhs + Logical_Operation.And rhs -> column && (table.resolve rhs) + Logical_Operation.Or rhs -> column || (table.resolve rhs) ## Defines the operation on a derived column. type Simple_Calculation