From 634d12a240ec4fa38445154ba8142c443b163742 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Wed, 1 May 2024 16:31:45 -0400 Subject: [PATCH 01/34] hack --- distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index 801fb7a5a4bd..d72730f02561 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -99,9 +99,15 @@ type Column handle_invalid_value_type ~action = Panic.catch ValueTypeMismatchException action caught_panic-> java_exception = caught_panic.payload raise_invalid_value_type_error java_exception.getValue + hack items = + h item = case item of + _ : Decimal -> item.big_decimal + _ -> item + items.map h Invalid_Column_Names.handle_java_exception <| Polyglot_Helpers.handle_polyglot_dataflow_errors <| handle_invalid_value_type <| java_column = Java_Problems.with_problem_aggregator Problem_Behavior.Report_Warning java_problem_aggregator-> case needs_polyglot_conversion of + #True -> Java_Column.fromItems name (hack items) expected_storage_type java_problem_aggregator True -> Java_Column.fromItems name items expected_storage_type java_problem_aggregator False -> Java_Column.fromItemsNoDateConversion name items expected_storage_type java_problem_aggregator result = Column.Value java_column . throw_on_warning Conversion_Failure From dfc854a9f6ec90d73a016c2c6488aa37e6ca35d2 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Wed, 8 May 2024 12:53:49 -0400 Subject: [PATCH 02/34] make a column --- .../Standard/Table/0.0.0-dev/src/Column.enso | 6 --- .../Table/0.0.0-dev/src/Internal/Storage.enso | 5 +- .../enso/base/polyglot/NumericConverter.java | 1 - .../enso/base/polyglot/Polyglot_Utils.java | 12 +++++ .../column/builder/BigDecimalBuilder.java | 50 +++++++++++++++++++ .../data/column/builder/DateBuilder.java | 2 +- .../data/column/builder/DateTimeBuilder.java | 2 +- .../data/column/builder/InferredBuilder.java | 3 ++ .../data/column/builder/TimeOfDayBuilder.java | 2 +- .../storage/numeric/BigDecimalStorage.java | 37 ++++++++++++++ .../column/storage/type/BigDecimalType.java | 20 ++++++++ .../data/column/storage/type/StorageType.java | 1 + 12 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/storage/type/BigDecimalType.java diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index 63e5e2869b2e..ba4100324774 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -99,15 +99,9 @@ type Column handle_invalid_value_type ~action = Panic.catch ValueTypeMismatchException action caught_panic-> java_exception = caught_panic.payload raise_invalid_value_type_error java_exception.getValue - hack items = - h item = case item of - _ : Decimal -> item.big_decimal - _ -> item - items.map h Invalid_Column_Names.handle_java_exception <| Polyglot_Helpers.handle_polyglot_dataflow_errors <| handle_invalid_value_type <| java_column = Java_Problems.with_problem_aggregator Problem_Behavior.Report_Warning java_problem_aggregator-> case needs_polyglot_conversion of - #True -> Java_Column.fromItems name (hack items) expected_storage_type java_problem_aggregator True -> Java_Column.fromItems name items expected_storage_type java_problem_aggregator False -> Java_Column.fromItemsNoDateConversion name items expected_storage_type java_problem_aggregator result = Column.Value java_column . throw_on_warning Conversion_Failure diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso index 8608ebc839b0..6c0dbae44b24 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso @@ -10,6 +10,7 @@ from project.Errors import Inexact_Type_Coercion polyglot java import org.enso.table.data.column.builder.Builder as Java_Builder polyglot java import org.enso.table.data.column.storage.type.AnyObjectType +polyglot java import org.enso.table.data.column.storage.type.BigDecimalType polyglot java import org.enso.table.data.column.storage.type.BigIntegerType polyglot java import org.enso.table.data.column.storage.type.Bits as Java_Bits polyglot java import org.enso.table.data.column.storage.type.BooleanType @@ -40,6 +41,7 @@ to_value_type storage_type = case storage_type of _ : DateType -> Value_Type.Date _ : DateTimeType -> Value_Type.Date_Time with_timezone=True _ : TimeOfDayType -> Value_Type.Time + _ : BigDecimalType -> Value_Type.Decimal scale=0 _ : BigIntegerType -> Value_Type.Decimal scale=0 _ : AnyObjectType -> Value_Type.Mixed @@ -64,8 +66,7 @@ closest_storage_type value_type = case value_type of Value_Type.Mixed -> AnyObjectType.INSTANCE Value_Type.Decimal _ scale -> is_integer = scale.is_nothing || scale <= 0 - if is_integer then BigIntegerType.INSTANCE else - Error.throw (Illegal_Argument.Error "Columns of type "+value_type.to_display_text+" are currently not supported in the in-memory backend - only Decimal of integer type (scale <= 0) is supported. You may cast the column to Float first (lossy conversion).") + if is_integer then BigIntegerType.INSTANCE else BigDecimalType.INSTANCE _ -> Error.throw (Illegal_Argument.Error "Columns of type "+value_type.to_display_text+" are currently not supported in the in-memory backend.") diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java index d7b860200e78..845ac123af19 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java @@ -66,7 +66,6 @@ public static boolean isCoercibleToDouble(Object o) { public static boolean isFloatLike(Object o) { return o instanceof Double - || o instanceof BigDecimal || o instanceof Float; } diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java index ebbedc3ac941..632c543b3623 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java @@ -1,5 +1,6 @@ package org.enso.base.polyglot; +import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime; @@ -35,6 +36,17 @@ public static Object convertPolyglotValue(Value item) { if (item.isException()) { throw new WrappedDataflowError(item); } + + //if (item.receiver instanceof Atom atom && atom.getConstructor().getType() == "Decimal") { + if (item.hasMember("big_decimal")) { + Object member = item.getMember("big_decimal").asHostObject(); + if (member instanceof BigDecimal bigDecimal) { + return bigDecimal; + } + } +// ((org.enso.interpreter.runtime.data.atom.BoxingAtom)item.receiver).getConstructor().getType() +// item.getMember("big_decimal") + var ret = item.as(Object.class); if (ret instanceof BigInteger && item.fitsInLong()) { return item.asLong(); diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java b/std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java new file mode 100644 index 000000000000..8b87a1f93fb7 --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java @@ -0,0 +1,50 @@ +package org.enso.table.data.column.builder; + +import java.math.BigDecimal; + +import org.enso.table.data.column.storage.Storage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; +import org.enso.table.data.column.storage.type.BigDecimalType; +import org.enso.table.data.column.storage.type.StorageType; +import org.enso.table.error.ValueTypeMismatchException; + +/** A builder for BigDecimal columns. */ +public class BigDecimalBuilder extends TypedBuilderImpl { + @Override + protected BigDecimal[] newArray(int size) { + return new BigDecimal[size]; + } + + public BigDecimalBuilder(int size) { + super(size); + } + + @Override + public StorageType getType() { + return BigDecimalType.INSTANCE; + } + + @Override + public void appendNoGrow(Object o) { + try { + data[currentSize++] = (BigDecimal) o; + } catch (ClassCastException e) { + throw new ValueTypeMismatchException(getType(), o); + } + } + + @Override + public void append(Object o) { + appendNoGrow(o); + } + + @Override + public boolean accepts(Object o) { + return o instanceof BigDecimal; + } + + @Override + protected Storage doSeal() { + return new BigDecimalStorage(data, currentSize); + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateBuilder.java b/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateBuilder.java index 430bd35190b0..047dc74637e8 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateBuilder.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateBuilder.java @@ -7,7 +7,7 @@ import org.enso.table.data.column.storage.type.StorageType; import org.enso.table.error.ValueTypeMismatchException; -/** A builder for string columns. */ +/** A builder for LocalDate columns. */ public class DateBuilder extends TypedBuilderImpl { @Override protected LocalDate[] newArray(int size) { diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateTimeBuilder.java b/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateTimeBuilder.java index aadc4167213f..e7eb9fcaa942 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateTimeBuilder.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/builder/DateTimeBuilder.java @@ -7,7 +7,7 @@ import org.enso.table.data.column.storage.type.StorageType; import org.enso.table.error.ValueTypeMismatchException; -/** A builder for string columns. */ +/** A builder for ZonedDateTime columns. */ public class DateTimeBuilder extends TypedBuilderImpl { @Override protected ZonedDateTime[] newArray(int size) { diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/builder/InferredBuilder.java b/std-bits/table/src/main/java/org/enso/table/data/column/builder/InferredBuilder.java index 55c3bcc80250..97d7214c1f89 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/builder/InferredBuilder.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/builder/InferredBuilder.java @@ -1,5 +1,6 @@ package org.enso.table.data.column.builder; +import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalTime; @@ -115,6 +116,8 @@ private void initBuilderFor(Object o) { currentBuilder = new StringBuilder(initialCapacity, TextType.VARIABLE_LENGTH); } else if (o instanceof BigInteger) { currentBuilder = new BigIntegerBuilder(initialCapacity, problemAggregator); + } else if (o instanceof BigDecimal) { + currentBuilder = new BigDecimalBuilder(initialCapacity); } else if (o instanceof LocalDate) { currentBuilder = new DateBuilder(initialCapacity); } else if (o instanceof LocalTime) { diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/builder/TimeOfDayBuilder.java b/std-bits/table/src/main/java/org/enso/table/data/column/builder/TimeOfDayBuilder.java index 21dd0b259462..09a04fd68062 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/builder/TimeOfDayBuilder.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/builder/TimeOfDayBuilder.java @@ -7,7 +7,7 @@ import org.enso.table.data.column.storage.type.TimeOfDayType; import org.enso.table.error.ValueTypeMismatchException; -/** A builder for string columns. */ +/** A builder for LocalTime columns. */ public class TimeOfDayBuilder extends TypedBuilderImpl { @Override protected LocalTime[] newArray(int size) { diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java new file mode 100644 index 000000000000..ec06ab278c91 --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java @@ -0,0 +1,37 @@ +package org.enso.table.data.column.storage.numeric; + +import java.math.BigDecimal; +import org.enso.table.data.column.operation.map.MapOperationStorage; +import org.enso.table.data.column.storage.ObjectStorage; +import org.enso.table.data.column.storage.SpecializedStorage; +import org.enso.table.data.column.storage.type.BigDecimalType; +import org.enso.table.data.column.storage.type.StorageType; + +public final class BigDecimalStorage extends SpecializedStorage { + /** + * @param data the underlying data + * @param size the number of items stored + */ + public BigDecimalStorage(BigDecimal[] data, int size) { + super(data, size, buildOps()); + } + + private static MapOperationStorage> buildOps() { + return ObjectStorage.buildObjectOps(); + } + + @Override + protected SpecializedStorage newInstance(BigDecimal[] data, int size) { + return new BigDecimalStorage(data, size); + } + + @Override + protected BigDecimal[] newUnderlyingArray(int size) { + return new BigDecimal[size]; + } + + @Override + public StorageType getType() { + return BigDecimalType.INSTANCE; + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/type/BigDecimalType.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/type/BigDecimalType.java new file mode 100644 index 000000000000..84de26444c51 --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/type/BigDecimalType.java @@ -0,0 +1,20 @@ +package org.enso.table.data.column.storage.type; + +public record BigDecimalType() implements StorageType { + public static final BigDecimalType INSTANCE = new BigDecimalType(); + + @Override + public boolean isNumeric() { + return true; + } + + @Override + public boolean hasDate() { + return false; + } + + @Override + public boolean hasTime() { + return false; + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/type/StorageType.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/type/StorageType.java index 69ef0e264146..35224aa4b2f8 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/type/StorageType.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/type/StorageType.java @@ -13,6 +13,7 @@ */ public sealed interface StorageType permits AnyObjectType, + BigDecimalType, BigIntegerType, BooleanType, DateTimeType, From b1c567f17b271be286cd03b8dd1fe2220b796476 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Thu, 9 May 2024 13:31:14 -0400 Subject: [PATCH 03/34] add --- .../map/numeric/arithmetic/AddOp.java | 8 ++ .../map/numeric/arithmetic/DivideOp.java | 8 ++ .../map/numeric/arithmetic/ModOp.java | 12 ++ .../map/numeric/arithmetic/MulOp.java | 7 + .../arithmetic/NumericBinaryOpDefinition.java | 4 + .../NumericBinaryOpImplementation.java | 53 +++++++- .../map/numeric/arithmetic/PowerOp.java | 8 ++ .../map/numeric/arithmetic/SubOp.java | 7 + .../helpers/BigDecimalArrayAdapter.java | 125 ++++++++++++++++++ .../helpers/BigIntegerArrayAdapter.java | 1 + .../storage/numeric/BigDecimalStorage.java | 23 +++- 11 files changed, 253 insertions(+), 3 deletions(-) create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java index 7e5fc0026ed3..4c76ec72a2cc 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java @@ -1,8 +1,10 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; +import java.math.BigDecimal; import java.math.BigInteger; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.type.IntegerType; public class AddOp> @@ -32,4 +34,10 @@ public BigInteger doBigInteger( BigInteger a, BigInteger b, int ix, MapOperationProblemAggregator problemAggregator) { return a.add(b); } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + return a.add(b); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java index 9c1c42f1d4f5..99d2cc1b7290 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java @@ -1,5 +1,7 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; +import java.math.BigDecimal; + import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; @@ -17,4 +19,10 @@ public double doDouble( } return a / b; } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + return a.divide(b); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/ModOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/ModOp.java index 3a0c776ceaa9..fb544c993700 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/ModOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/ModOp.java @@ -1,5 +1,6 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; +import java.math.BigDecimal; import java.math.BigInteger; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; @@ -40,4 +41,15 @@ public BigInteger doBigInteger( return a.mod(b); } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + if (b.equals(BigDecimal.ZERO)) { + problemAggregator.reportDivisionByZero(ix); + return null; + } + + return a.remainder(b); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/MulOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/MulOp.java index 4cf27e8dd06a..781c1c1c1093 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/MulOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/MulOp.java @@ -1,5 +1,6 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; +import java.math.BigDecimal; import java.math.BigInteger; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; @@ -32,4 +33,10 @@ public BigInteger doBigInteger( BigInteger a, BigInteger b, int ix, MapOperationProblemAggregator problemAggregator) { return a.multiply(b); } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + return a.multiply(b); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpDefinition.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpDefinition.java index 879f7d6a8712..d9ff6db9028a 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpDefinition.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpDefinition.java @@ -1,5 +1,6 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; +import java.math.BigDecimal; import java.math.BigInteger; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; @@ -10,4 +11,7 @@ public interface NumericBinaryOpDefinition { BigInteger doBigInteger( BigInteger a, BigInteger b, int ix, MapOperationProblemAggregator problemAggregator); + + BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator); } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java index ede9667b08e6..15c10ffb1235 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java @@ -2,15 +2,19 @@ import static org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter.fromAnyStorage; +import java.math.BigDecimal; import java.math.BigInteger; import java.util.BitSet; + import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.BinaryMapOperation; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; +import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; import org.enso.table.data.column.operation.map.numeric.helpers.BigIntegerArrayAdapter; import org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter; import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.numeric.BigIntegerStorage; import org.enso.table.data.column.storage.numeric.DoubleStorage; import org.enso.table.data.column.storage.numeric.LongStorage; @@ -78,7 +82,14 @@ public Storage runBinaryMap( public Storage runZip( I storage, Storage arg, MapOperationProblemAggregator problemAggregator) { return switch (storage) { - case DoubleStorage lhs -> runDoubleZip(lhs, fromAnyStorage(arg), problemAggregator); + case DoubleStorage lhs -> switch (arg) { + case BigDecimalStorage rhs -> { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(lhs); + BigDecimalArrayAdapter right = BigDecimalArrayAdapter.fromStorage(rhs); + yield runBigDecimalZip(left, right, problemAggregator); + } + default -> runDoubleZip(lhs, fromAnyStorage(arg), problemAggregator); + }; case AbstractLongStorage lhs -> switch (arg) { case AbstractLongStorage rhs -> runLongZip(lhs, rhs, problemAggregator); @@ -89,28 +100,45 @@ public Storage runZip( } case DoubleStorage rhs -> runDoubleZip( DoubleArrayAdapter.fromStorage(lhs), rhs, problemAggregator); + case BigDecimalStorage rhs -> { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(lhs); + BigDecimalArrayAdapter right = BigDecimalArrayAdapter.fromStorage(rhs); + yield runBigDecimalZip(left, right, problemAggregator); + } default -> throw new IllegalStateException( "Unsupported storage: " + arg.getClass().getCanonicalName()); }; case BigIntegerStorage lhs -> { - BigIntegerArrayAdapter left = BigIntegerArrayAdapter.fromStorage(lhs); yield switch (arg) { case AbstractLongStorage rhs -> { + BigIntegerArrayAdapter left = BigIntegerArrayAdapter.fromStorage(lhs); BigIntegerArrayAdapter right = BigIntegerArrayAdapter.fromStorage(rhs); yield runBigIntegerZip(left, right, problemAggregator); } case BigIntegerStorage rhs -> { + BigIntegerArrayAdapter left = BigIntegerArrayAdapter.fromStorage(lhs); BigIntegerArrayAdapter right = BigIntegerArrayAdapter.fromStorage(rhs); yield runBigIntegerZip(left, right, problemAggregator); } case DoubleStorage rhs -> runDoubleZip( DoubleArrayAdapter.fromStorage(lhs), rhs, problemAggregator); + case BigDecimalStorage rhs -> { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(lhs); + BigDecimalArrayAdapter right = BigDecimalArrayAdapter.fromStorage(rhs); + yield runBigDecimalZip(left, right, problemAggregator); + } default -> throw new IllegalStateException( "Unsupported storage: " + arg.getClass().getCanonicalName()); }; } + case BigDecimalStorage lhs -> { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(lhs); + BigDecimalArrayAdapter right = BigDecimalArrayAdapter.fromAnyStorage(arg); + yield runBigDecimalZip(left, right, problemAggregator); + } + default -> throw new IllegalStateException( "Unsupported storage: " + storage.getClass().getCanonicalName()); }; @@ -276,4 +304,25 @@ protected BigIntegerStorage runBigIntegerMap( return new BigIntegerStorage(out, n); } + + protected BigDecimalStorage runBigDecimalZip( + BigDecimalArrayAdapter a, + BigDecimalArrayAdapter b, + MapOperationProblemAggregator problemAggregator) { + Context context = Context.getCurrent(); + int n = a.size(); + int m = Math.min(a.size(), b.size()); + BigDecimal[] out = new BigDecimal[n]; + for (int i = 0; i < m; i++) { + BigDecimal x = a.getItem(i); + BigDecimal y = b.getItem(i); + if (x != null && y != null) { + BigDecimal r = doBigDecimal(x, y, i, problemAggregator); + out[i] = r; + } + context.safepoint(); + } + + return new BigDecimalStorage(out, n); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java index a2ff5851d043..41c26bd6f353 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java @@ -1,5 +1,7 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; +import java.math.BigDecimal; + import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; @@ -14,4 +16,10 @@ public double doDouble( double a, double b, int ix, MapOperationProblemAggregator problemAggregator) { return Math.pow(a, b); } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + throw new UnsupportedOperationException("unimplemented"); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/SubOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/SubOp.java index 1620e599a4cf..d00712e8a2c5 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/SubOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/SubOp.java @@ -1,5 +1,6 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; +import java.math.BigDecimal; import java.math.BigInteger; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; @@ -32,4 +33,10 @@ public BigInteger doBigInteger( BigInteger a, BigInteger b, int ix, MapOperationProblemAggregator problemAggregator) { return a.subtract(b); } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + return a.subtract(b); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java new file mode 100644 index 000000000000..d88992c30c2b --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java @@ -0,0 +1,125 @@ +package org.enso.table.data.column.operation.map.numeric.helpers; + +import java.math.BigDecimal; +import java.math.BigInteger; +import org.enso.table.data.column.storage.Storage; +import org.enso.table.data.column.storage.numeric.AbstractLongStorage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; +import org.enso.table.data.column.storage.numeric.BigIntegerStorage; +import org.enso.table.data.column.storage.numeric.DoubleStorage; + +public interface BigDecimalArrayAdapter { + BigDecimal getItem(int i); + + int size(); + + static BigDecimalArrayAdapter fromStorage(BigDecimalStorage storage) { + return new BigDecimalStorageAsBigDecimal(storage); + } + + static BigDecimalArrayAdapter fromStorage(BigIntegerStorage storage) { + return new BigIntegerStorageAsBigDecimal(storage); + } + + static BigDecimalArrayAdapter fromStorage(AbstractLongStorage storage) { + return new LongStorageAsBigDecimal(storage); + } + + static BigDecimalArrayAdapter fromStorage(DoubleStorage storage) { + return new DoubleStorageAsBigDecimal(storage); + } + + static BigDecimalArrayAdapter fromAnyStorage(Storage storage) { + return switch (storage) { + case DoubleStorage s -> fromStorage(s); + case AbstractLongStorage s -> fromStorage(s); + case BigIntegerStorage s -> fromStorage(s); + case BigDecimalStorage s -> fromStorage(s); + default -> throw new IllegalStateException( + "Unsupported storage: " + storage.getClass().getCanonicalName()); + }; + } + + + class BigDecimalStorageAsBigDecimal implements BigDecimalArrayAdapter { + private final BigDecimalStorage storage; + + private BigDecimalStorageAsBigDecimal(BigDecimalStorage storage) { + this.storage = storage; + } + + @Override + public BigDecimal getItem(int i) { + return storage.getItemBoxed(i); + } + + @Override + public int size() { + return storage.size(); + } + } + + class BigIntegerStorageAsBigDecimal implements BigDecimalArrayAdapter { + private final BigIntegerStorage storage; + + private BigIntegerStorageAsBigDecimal(BigIntegerStorage storage) { + this.storage = storage; + } + + @Override + public BigDecimal getItem(int i) { + return new BigDecimal(storage.getItemBoxed(i)); + } + + @Override + public int size() { + return storage.size(); + } + } + + class LongStorageAsBigDecimal implements BigDecimalArrayAdapter { + private final AbstractLongStorage storage; + + private LongStorageAsBigDecimal(AbstractLongStorage storage) { + this.storage = storage; + } + + @Override + public BigDecimal getItem(int i) { + if (storage.isNothing(i)) { + return null; + } else { + long x = storage.getItem(i); + return BigDecimal.valueOf(x); + } + } + + @Override + public int size() { + return storage.size(); + } + } + + class DoubleStorageAsBigDecimal implements BigDecimalArrayAdapter { + private final DoubleStorage storage; + + private DoubleStorageAsBigDecimal(DoubleStorage storage) { + this.storage = storage; + } + + @Override + public BigDecimal getItem(int i) { + if (storage.isNothing(i)) { + return null; + } else { + double x = storage.getItemAsDouble(i); + return BigDecimal.valueOf(x); + } + } + + @Override + public int size() { + return storage.size(); + } + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java index 2d6032791dbe..719234494149 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java @@ -1,6 +1,7 @@ package org.enso.table.data.column.operation.map.numeric.helpers; import java.math.BigInteger; +import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; import org.enso.table.data.column.storage.numeric.BigIntegerStorage; diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java index ec06ab278c91..641fa7955f2e 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java @@ -2,6 +2,16 @@ import java.math.BigDecimal; import org.enso.table.data.column.operation.map.MapOperationStorage; +import org.enso.table.data.column.operation.map.numeric.arithmetic.AddOp; +import org.enso.table.data.column.operation.map.numeric.arithmetic.DivideOp; +import org.enso.table.data.column.operation.map.numeric.arithmetic.ModOp; +import org.enso.table.data.column.operation.map.numeric.arithmetic.MulOp; +import org.enso.table.data.column.operation.map.numeric.arithmetic.SubOp; +import org.enso.table.data.column.operation.map.numeric.comparisons.EqualsComparison; +import org.enso.table.data.column.operation.map.numeric.comparisons.GreaterComparison; +import org.enso.table.data.column.operation.map.numeric.comparisons.GreaterOrEqualComparison; +import org.enso.table.data.column.operation.map.numeric.comparisons.LessComparison; +import org.enso.table.data.column.operation.map.numeric.comparisons.LessOrEqualComparison; import org.enso.table.data.column.storage.ObjectStorage; import org.enso.table.data.column.storage.SpecializedStorage; import org.enso.table.data.column.storage.type.BigDecimalType; @@ -17,7 +27,18 @@ public BigDecimalStorage(BigDecimal[] data, int size) { } private static MapOperationStorage> buildOps() { - return ObjectStorage.buildObjectOps(); + MapOperationStorage> ops = + ObjectStorage.buildObjectOps(); + return ops.add(new AddOp<>()) + .add(new SubOp<>()) + .add(new MulOp<>()) + .add(new DivideOp<>()) + .add(new ModOp<>()) + .add(new LessComparison<>()) + .add(new LessOrEqualComparison<>()) + .add(new EqualsComparison<>()) + .add(new GreaterOrEqualComparison<>()) + .add(new GreaterComparison<>()); } @Override From 4973d5e8998c7b9a1c4f8d0f54674bf63553561c Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 10 May 2024 15:37:48 -0400 Subject: [PATCH 04/34] no scale=0 on BD type --- .../lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso index 6c0dbae44b24..f90823a9067d 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso @@ -41,7 +41,7 @@ to_value_type storage_type = case storage_type of _ : DateType -> Value_Type.Date _ : DateTimeType -> Value_Type.Date_Time with_timezone=True _ : TimeOfDayType -> Value_Type.Time - _ : BigDecimalType -> Value_Type.Decimal scale=0 + _ : BigDecimalType -> Value_Type.Decimal _ : BigIntegerType -> Value_Type.Decimal scale=0 _ : AnyObjectType -> Value_Type.Mixed From aeb4114d8b34122a606f3c7b174d3bf51ead90df Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 13 May 2024 16:23:36 -0400 Subject: [PATCH 05/34] a test --- .../Column_Operations_Spec.enso | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index 1c8a5cc89a98..c95267f38d2e 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -20,7 +20,7 @@ import enso_dev.Base_Tests.Data.Round_Spec from project.Common_Table_Operations.Util import run_default_backend -main filter=Nothing = run_default_backend add_specs filter +main filter="Decimal" = run_default_backend add_specs filter type Data Value ~connection @@ -1768,6 +1768,27 @@ add_specs suite_builder setup = c.value_type . should_equal Value_Type.Mixed (empty.set c).at c.name . value_type . should_equal Value_Type.Mixed + decimal_db_pending = if setup.is_database then "Decimals are currently not implemented for the Database backend." + suite_builder.group prefix+"Decimal" pending=decimal_db_pending group_builder-> + data = Data.setup create_connection_fn + + group_builder.teardown <| + data.teardown + + table_builder cols = + setup.table_builder cols connection=data.connection + + group_builder.specify "Binary ops" <| + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]]] + q = (t.at "x" + t.at "y").to_vector + p n = IO.println (n.to_text + " " + n.internal_representation.to_text) + (t.at "x" + t.at "y").to_vector . map p + [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] . map p + (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] + IO.println <| (t.at "x" - t.at "y").to_vector # . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] + IO.println <| (t.at "x" * t.at "y").to_vector # . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] + IO.println <| (t.at "x" / t.at "y").to_vector # . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] + # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 2b9a1e3843589be3b7b62dd5ba0f8b1f018c439d Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Tue, 14 May 2024 09:38:23 -0400 Subject: [PATCH 06/34] wip --- .../src/main/java/org/enso/base/polyglot/Polyglot_Utils.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java index 632c543b3623..a1ff4096ae84 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java @@ -37,15 +37,12 @@ public static Object convertPolyglotValue(Value item) { throw new WrappedDataflowError(item); } - //if (item.receiver instanceof Atom atom && atom.getConstructor().getType() == "Decimal") { if (item.hasMember("big_decimal")) { Object member = item.getMember("big_decimal").asHostObject(); if (member instanceof BigDecimal bigDecimal) { return bigDecimal; } } -// ((org.enso.interpreter.runtime.data.atom.BoxingAtom)item.receiver).getConstructor().getType() -// item.getMember("big_decimal") var ret = item.as(Object.class); if (ret instanceof BigInteger && item.fitsInLong()) { From 4c0b81e8a8ab4007d339b7277991eea9e2b084d4 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Tue, 14 May 2024 15:03:01 -0400 Subject: [PATCH 07/34] 3 arithmetic ops --- .../lib/Standard/Table/0.0.0-dev/src/Column.enso | 9 +++++---- .../Standard/Table/0.0.0-dev/src/Internal/Storage.enso | 10 ++++++++++ .../java/org/enso/base/polyglot/Polyglot_Utils.java | 8 -------- .../map/numeric/helpers/BigIntegerArrayAdapter.java | 1 - .../Column_Operations_Spec.enso | 10 +++------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index 26a5eef2b8da..8b23d8ae948d 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -30,6 +30,7 @@ import project.Value_Type.Value_Type from project.Errors import Conversion_Failure, Floating_Point_Equality, Inexact_Type_Coercion, Invalid_Column_Names, Invalid_Value_Type, No_Index_Set_Error from project.Internal.Column_Format import all from project.Internal.Java_Exports import make_date_builder_adapter, make_string_builder +from project.Internal.Storage import enso_to_java, java_to_enso polyglot java import org.enso.base.Time_Utils polyglot java import org.enso.table.data.column.operation.cast.CastProblemAggregator @@ -101,7 +102,7 @@ type Column Invalid_Column_Names.handle_java_exception <| Polyglot_Helpers.handle_polyglot_dataflow_errors <| handle_invalid_value_type <| java_column = Java_Problems.with_problem_aggregator Problem_Behavior.Report_Warning java_problem_aggregator-> case needs_polyglot_conversion of - True -> Java_Column.fromItems name items expected_storage_type java_problem_aggregator + True -> Java_Column.fromItems name (items.map enso_to_java) expected_storage_type java_problem_aggregator False -> Java_Column.fromItemsNoDateConversion name items expected_storage_type java_problem_aggregator result = Column.Value java_column . throw_on_warning Conversion_Failure result.catch Conversion_Failure error-> @@ -136,7 +137,7 @@ type Column Arguments: - java_column: The internal representation of the column. - private Value java_column + Value java_column ## PRIVATE ADVANCED @@ -2110,7 +2111,7 @@ type Column @index (self-> Numeric_Input minimum=0 maximum=self.length-1) at : Integer -> (Any | Nothing) ! Index_Out_Of_Bounds at self (index : Integer) = - self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) + java_to_enso <| self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## GROUP Standard.Base.Selections ICON select_row @@ -2159,7 +2160,7 @@ type Column example_to_vector = Examples.integer_column.to_vector to_vector : Vector - to_vector self = Vector.from_polyglot_array self.java_column.getStorage.toList + to_vector self = Vector.from_polyglot_array self.java_column.getStorage.toList . map java_to_enso ## GROUP Standard.Base.Metadata ICON metadata diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso index f90823a9067d..409b6b18466c 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso @@ -8,6 +8,8 @@ import project.Value_Type.Bits import project.Value_Type.Value_Type from project.Errors import Inexact_Type_Coercion +polyglot java import java.math.BigDecimal + polyglot java import org.enso.table.data.column.builder.Builder as Java_Builder polyglot java import org.enso.table.data.column.storage.type.AnyObjectType polyglot java import org.enso.table.data.column.storage.type.BigDecimalType @@ -70,6 +72,14 @@ closest_storage_type value_type = case value_type of _ -> Error.throw (Illegal_Argument.Error "Columns of type "+value_type.to_display_text+" are currently not supported in the in-memory backend.") +enso_to_java x = case x of + Decimal.Value big_decimal -> big_decimal + _ -> x + +java_to_enso x = case x of + _ : BigDecimal -> Decimal.Value x + _ -> x + ## PRIVATE Converts a value type to an in-memory storage type, possibly approximating it to the closest supported type. diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java index a1ff4096ae84..6a6d4b5a7a13 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java @@ -1,6 +1,5 @@ package org.enso.base.polyglot; -import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.LocalDateTime; @@ -37,13 +36,6 @@ public static Object convertPolyglotValue(Value item) { throw new WrappedDataflowError(item); } - if (item.hasMember("big_decimal")) { - Object member = item.getMember("big_decimal").asHostObject(); - if (member instanceof BigDecimal bigDecimal) { - return bigDecimal; - } - } - var ret = item.as(Object.class); if (ret instanceof BigInteger && item.fitsInLong()) { return item.asLong(); diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java index 719234494149..2d6032791dbe 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigIntegerArrayAdapter.java @@ -1,7 +1,6 @@ package org.enso.table.data.column.operation.map.numeric.helpers; import java.math.BigInteger; -import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; import org.enso.table.data.column.storage.numeric.BigIntegerStorage; diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index c95267f38d2e..a754ff07bafb 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1780,14 +1780,10 @@ add_specs suite_builder setup = group_builder.specify "Binary ops" <| t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]]] - q = (t.at "x" + t.at "y").to_vector - p n = IO.println (n.to_text + " " + n.internal_representation.to_text) - (t.at "x" + t.at "y").to_vector . map p - [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] . map p (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] - IO.println <| (t.at "x" - t.at "y").to_vector # . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] - IO.println <| (t.at "x" * t.at "y").to_vector # . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] - IO.println <| (t.at "x" / t.at "y").to_vector # . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] + (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "-12299999999999999999999999999999999999999976742754654.654654655"] + (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "2.860641177477477477435E+62"] + (t.at "x" / t.at "y").to_vector . should_equal [Decimal.new "1"] # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From f940ccd53c2107fa1bfecfa03518051c1a041ed1 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Wed, 15 May 2024 15:41:36 -0400 Subject: [PATCH 08/34] / --- .../NumericBinaryOpReturningDouble.java | 15 ++++++++++++--- .../Column_Operations_Spec.enso | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java index 6a0c91bcfff1..74b5fd82c68b 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java @@ -3,10 +3,13 @@ import static org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter.fromAnyStorage; import java.math.BigInteger; + import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; +import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; import org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter; import org.enso.table.data.column.storage.Storage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.numeric.DoubleStorage; public abstract class NumericBinaryOpReturningDouble> @@ -33,9 +36,15 @@ public Storage runBinaryMap( @Override public Storage runZip( I storage, Storage arg, MapOperationProblemAggregator problemAggregator) { - DoubleArrayAdapter lhs = fromAnyStorage(storage); - DoubleArrayAdapter rhs = fromAnyStorage(arg); - return runDoubleZip(lhs, rhs, problemAggregator); + if (storage instanceof BigDecimalStorage || arg instanceof BigDecimalStorage) { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromAnyStorage(storage); + BigDecimalArrayAdapter right = BigDecimalArrayAdapter.fromAnyStorage(arg); + return runBigDecimalZip(left, right, problemAggregator); + } else { + DoubleArrayAdapter lhs = fromAnyStorage(storage); + DoubleArrayAdapter rhs = fromAnyStorage(arg); + return runDoubleZip(lhs, rhs, problemAggregator); + } } @Override diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index a754ff07bafb..1311e62151df 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1779,11 +1779,11 @@ add_specs suite_builder setup = setup.table_builder cols connection=data.connection group_builder.specify "Binary ops" <| - t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]]] + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]], ["z", [Decimal.new "125E50"]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "-12299999999999999999999999999999999999999976742754654.654654655"] (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "2.860641177477477477435E+62"] - (t.at "x" / t.at "y").to_vector . should_equal [Decimal.new "1"] + (t.at "x" / t.at "z").to_vector . should_equal [Decimal.new "1.8605796276276276276E-42"] # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 68507519eaf130ccea3fd48c353e6d571f90910a Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Wed, 15 May 2024 16:47:27 -0400 Subject: [PATCH 09/34] wip --- .../numeric/arithmetic/BigDecimalPowerOp.java | 57 +++++++++++++++++++ .../storage/numeric/BigDecimalStorage.java | 2 + 2 files changed, 59 insertions(+) create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java new file mode 100644 index 000000000000..56a2e6a981ae --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java @@ -0,0 +1,57 @@ +package org.enso.table.data.column.operation.map.numeric.arithmetic; + +import java.math.BigDecimal; + +import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; +import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; +import org.enso.table.data.column.storage.Storage; +import org.enso.table.data.column.storage.numeric.AbstractLongStorage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; +import org.enso.table.data.column.storage.numeric.BigIntegerStorage; +import org.graalvm.polyglot.Context; + +public class BigDecimalPowerOp extends BinaryMapOperation { + public BigDecimalPowerOp() { + super("/"); + } + + @Override + public Storage runBinaryMap( + BigDecimalStorage storage, Object arg, MapOperationProblemAggregator problemAggregator) { + throw new UnsupportedOperationException(""); + } + + @Override + public abstract Storage runZip( + BigDecimalStorage storage, Storage arg, MapOperationProblemAggregator problemAggregator) { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(storage);) + BigDecimalArrayAdapter right = switch(arg) { + case AbstractLongStorage lhs -> BigDecimalArrayAdapter.fromStorage(lhs); + case BigIntegerStorage lhs -> BigDecimalArrayAdapter.fromStorage(lhs); + default -> throw new IllegalStateException( + "Unsupported storage: " + arg.getClass().getCanonicalName()); + } + return runBigDecimalZip((left, right, problemAggregator) + } + + protected BigDecimalStorage runBigDecimalZip( + BigDecimalArrayAdapter a, + BigDecimalArrayAdapter b, + MapOperationProblemAggregator problemAggregator) { + Context context = Context.getCurrent(); + int n = a.size(); + int m = Math.min(a.size(), b.size()); + BigDecimal[] out = new BigDecimal[n]; + for (int i = 0; i < m; i++) { + BigDecimal x = a.getItem(i); + BigDecimal y = b.getItem(i); + if (x != null && y != null) { + BigDecimal r = doBigDecimal(x, y, i, problemAggregator); + out[i] = r; + } + context.safepoint(); + } + + return new BigDecimalStorage(out, n); + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java index 641fa7955f2e..cb0d4d7b71ae 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java @@ -3,6 +3,7 @@ import java.math.BigDecimal; import org.enso.table.data.column.operation.map.MapOperationStorage; import org.enso.table.data.column.operation.map.numeric.arithmetic.AddOp; +import org.enso.table.data.column.operation.map.numeric.arithmetic.BigDecimalPowerOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.DivideOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.ModOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.MulOp; @@ -33,6 +34,7 @@ private static MapOperationStorage> b .add(new SubOp<>()) .add(new MulOp<>()) .add(new DivideOp<>()) + .add(new BigDecimalPowerOp<>()) .add(new ModOp<>()) .add(new LessComparison<>()) .add(new LessOrEqualComparison<>()) From 230b8bbaca51ffd666d3766ee4c479597c973132 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Thu, 16 May 2024 15:28:34 -0400 Subject: [PATCH 10/34] BigDecimalPowerOp --- .../numeric/arithmetic/BigDecimalPowerOp.java | 33 ++++---- .../helpers/BigDecimalArrayAdapter.java | 7 +- .../numeric/helpers/IntegerArrayAdapter.java | 82 +++++++++++++++++++ .../storage/numeric/BigDecimalStorage.java | 2 +- 4 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java index 56a2e6a981ae..750825707508 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java @@ -2,41 +2,44 @@ import java.math.BigDecimal; +import org.enso.table.data.column.operation.map.BinaryMapOperation; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; +import org.enso.table.data.column.operation.map.numeric.helpers.IntegerArrayAdapter; +import org.enso.table.data.column.storage.SpecializedStorage; import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.numeric.BigIntegerStorage; import org.graalvm.polyglot.Context; -public class BigDecimalPowerOp extends BinaryMapOperation { +public class BigDecimalPowerOp extends BinaryMapOperation> { public BigDecimalPowerOp() { - super("/"); + super("^"); } @Override public Storage runBinaryMap( - BigDecimalStorage storage, Object arg, MapOperationProblemAggregator problemAggregator) { + SpecializedStorage storage, Object arg, MapOperationProblemAggregator problemAggregator) { throw new UnsupportedOperationException(""); } @Override - public abstract Storage runZip( - BigDecimalStorage storage, Storage arg, MapOperationProblemAggregator problemAggregator) { - BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(storage);) - BigDecimalArrayAdapter right = switch(arg) { - case AbstractLongStorage lhs -> BigDecimalArrayAdapter.fromStorage(lhs); - case BigIntegerStorage lhs -> BigDecimalArrayAdapter.fromStorage(lhs); + public Storage runZip( + SpecializedStorage storage, Storage arg, MapOperationProblemAggregator problemAggregator) { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(storage); + IntegerArrayAdapter right = switch(arg) { + case AbstractLongStorage lhs -> IntegerArrayAdapter.fromStorage(lhs); + case BigIntegerStorage lhs -> IntegerArrayAdapter.fromStorage(lhs); default -> throw new IllegalStateException( "Unsupported storage: " + arg.getClass().getCanonicalName()); - } - return runBigDecimalZip((left, right, problemAggregator) + }; + return runBigDecimalZip(left, right, problemAggregator); } - protected BigDecimalStorage runBigDecimalZip( + private BigDecimalStorage runBigDecimalZip( BigDecimalArrayAdapter a, - BigDecimalArrayAdapter b, + IntegerArrayAdapter b, MapOperationProblemAggregator problemAggregator) { Context context = Context.getCurrent(); int n = a.size(); @@ -44,9 +47,9 @@ protected BigDecimalStorage runBigDecimalZip( BigDecimal[] out = new BigDecimal[n]; for (int i = 0; i < m; i++) { BigDecimal x = a.getItem(i); - BigDecimal y = b.getItem(i); + Integer y = b.getItemAsInteger(i, problemAggregator); if (x != null && y != null) { - BigDecimal r = doBigDecimal(x, y, i, problemAggregator); + BigDecimal r = x.pow(y); out[i] = r; } context.safepoint(); diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java index d88992c30c2b..1cc0bccf440d 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; import java.math.BigInteger; +import org.enso.table.data.column.storage.SpecializedStorage; import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; import org.enso.table.data.column.storage.numeric.BigDecimalStorage; @@ -13,7 +14,7 @@ public interface BigDecimalArrayAdapter { int size(); - static BigDecimalArrayAdapter fromStorage(BigDecimalStorage storage) { + static BigDecimalArrayAdapter fromStorage(SpecializedStorage storage) { return new BigDecimalStorageAsBigDecimal(storage); } @@ -42,9 +43,9 @@ static BigDecimalArrayAdapter fromAnyStorage(Storage storage) { class BigDecimalStorageAsBigDecimal implements BigDecimalArrayAdapter { - private final BigDecimalStorage storage; + private final SpecializedStorage storage; - private BigDecimalStorageAsBigDecimal(BigDecimalStorage storage) { + private BigDecimalStorageAsBigDecimal(SpecializedStorage storage) { this.storage = storage; } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java new file mode 100644 index 000000000000..0994911ae04d --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java @@ -0,0 +1,82 @@ +package org.enso.table.data.column.operation.map.numeric.helpers; + +import java.math.BigInteger; +import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; +import org.enso.table.data.column.storage.Storage; +import org.enso.table.data.column.storage.numeric.AbstractLongStorage; +import org.enso.table.data.column.storage.numeric.BigIntegerStorage; + +public interface IntegerArrayAdapter { + static BigInteger INTEGER_MIN_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MIN_VALUE); + static BigInteger INTEGER_MAX_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MAX_VALUE); + + Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator); + + boolean isNothing(long i); + + int size(); + + static IntegerArrayAdapter fromStorage(BigIntegerStorage storage) { + return new BigIntegerStorageAsInteger(storage); + } + + static IntegerArrayAdapter fromStorage(AbstractLongStorage storage) { + return new LongStorageAsInteger(storage); + } + + class LongStorageAsInteger implements IntegerArrayAdapter { + private final AbstractLongStorage storage; + + private LongStorageAsInteger(AbstractLongStorage storage) { + this.storage = storage; + } + + @Override + public Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator) { + long x = storage.getItem(i); + if (x > Integer.MAX_VALUE || x < Integer.MIN_VALUE) { + problemAggregator.reportIllegalArgumentError("The exponent in Decimal.pow (^) must be an Integer (between -2147483648 and 2147483647), but was "+x, i); + return null; + } + return (int) x; + } + + @Override + public boolean isNothing(long i) { + return storage.isNothing(i); + } + + @Override + public int size() { + return storage.size(); + } + } + + class BigIntegerStorageAsInteger implements IntegerArrayAdapter { + private final BigIntegerStorage storage; + + private BigIntegerStorageAsInteger(BigIntegerStorage storage) { + this.storage = storage; + } + + @Override + public Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator) { + BigInteger x = storage.getItem(i); + if (x.compareTo(INTEGER_MAX_VALUE_BIG_INTEGER) > 0 || x.compareTo(INTEGER_MIN_VALUE_BIG_INTEGER) < 0) { + problemAggregator.reportIllegalArgumentError("The exponent in Decimal.pow (^) must be an Integer (between -2147483648 and 2147483647), but was "+x, i); + return null; + } + return x.intValue(); + } + + @Override + public boolean isNothing(long i) { + return storage.isNothing(i); + } + + @Override + public int size() { + return storage.size(); + } + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java index cb0d4d7b71ae..73d1fdaac356 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java @@ -34,7 +34,7 @@ private static MapOperationStorage> b .add(new SubOp<>()) .add(new MulOp<>()) .add(new DivideOp<>()) - .add(new BigDecimalPowerOp<>()) + .add(new BigDecimalPowerOp()) .add(new ModOp<>()) .add(new LessComparison<>()) .add(new LessOrEqualComparison<>()) From a2a6019c9301cb7cec2fadfd1b1d49260853bd8e Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Thu, 16 May 2024 15:41:59 -0400 Subject: [PATCH 11/34] wip --- .../src/Common_Table_Operations/Column_Operations_Spec.enso | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index 1311e62151df..01ff5164989e 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1778,12 +1778,13 @@ add_specs suite_builder setup = table_builder cols = setup.table_builder cols connection=data.connection - group_builder.specify "Binary ops" <| - t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]], ["z", [Decimal.new "125E50"]]] + group_builder.specify "Arithmetic" <| + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]], ["z", [Decimal.new "125E50"]], ["w", [2]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "-12299999999999999999999999999999999999999976742754654.654654655"] (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "2.860641177477477477435E+62"] (t.at "x" / t.at "z").to_vector . should_equal [Decimal.new "1.8605796276276276276E-42"] + (t.at "x" ^ t.at "w").to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 2ff91a5ba5ee5f4667d7b31ff760bd3965e5e595 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Thu, 16 May 2024 15:48:05 -0400 Subject: [PATCH 12/34] mod test --- .../src/Common_Table_Operations/Column_Operations_Spec.enso | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index 01ff5164989e..c749f769f76b 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1779,12 +1779,13 @@ add_specs suite_builder setup = setup.table_builder cols connection=data.connection group_builder.specify "Arithmetic" <| - t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]], ["z", [Decimal.new "125E50"]], ["w", [2]]] + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]], ["z", [Decimal.new "125E50"]], ["w", [2]], ["ww", [7513]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "-12299999999999999999999999999999999999999976742754654.654654655"] (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "2.860641177477477477435E+62"] (t.at "x" / t.at "z").to_vector . should_equal [Decimal.new "1.8605796276276276276E-42"] (t.at "x" ^ t.at "w").to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] + (t.at "x" % t.at "ww").to_vector . should_equal [Decimal.new "2545.345345345"] # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From bb27fa4e6fc34787536cc26e9e464058e88c8472 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 17 May 2024 12:51:53 -0400 Subject: [PATCH 13/34] NumericBinaryOpReturningBigDecimal --- .../enso/base/polyglot/NumericConverter.java | 19 ++++++ .../arithmetic/BigDecimalDivideOp.java | 19 ++++++ .../map/numeric/arithmetic/DivideOp.java | 8 --- .../NumericBinaryOpImplementation.java | 20 ++++++ .../NumericBinaryOpReturningBigDecimal.java | 62 +++++++++++++++++++ .../NumericBinaryOpReturningDouble.java | 24 +++---- .../storage/numeric/BigDecimalStorage.java | 8 ++- 7 files changed, 138 insertions(+), 22 deletions(-) create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java create mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java index 845ac123af19..8e4f5d38333c 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java @@ -59,6 +59,25 @@ public static BigInteger coerceToBigInteger(Object o) { } } + /** + * Coerces a number to a BigDecimal. + * + *

Will throw an exception if the object is not a number. + */ + public static BigDecimal coerceToBigDecimal(Object o) { + return switch (o) { + case Double x -> BigDecimal.valueOf(x); + case BigDecimal x -> x; + case Float x -> BigDecimal.valueOf(x); + case BigInteger x -> new BigDecimal(x); + case Long x -> BigDecimal.valueOf(x); + case Integer x -> BigDecimal.valueOf(x); + case Short x -> BigDecimal.valueOf(x); + case Byte x -> BigDecimal.valueOf(x); + default -> throw new UnsupportedOperationException("Cannot coerce " + o + " to a BigDecimal."); + }; + } + /** Returns true if the object is any supported number. */ public static boolean isCoercibleToDouble(Object o) { return isFloatLike(o)|| isCoercibleToLong(o) || o instanceof BigInteger; diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java new file mode 100644 index 000000000000..2ca5b8c0a156 --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java @@ -0,0 +1,19 @@ +package org.enso.table.data.column.operation.map.numeric.arithmetic; + +import java.math.BigDecimal; + +import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; +import org.enso.table.data.column.storage.Storage; + +public class BigDecimalDivideOp> + extends NumericBinaryOpReturningBigDecimal { + public BigDecimalDivideOp() { + super(Storage.Maps.DIV); + } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + return a.divide(b); + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java index 99d2cc1b7290..9c1c42f1d4f5 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/DivideOp.java @@ -1,7 +1,5 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; -import java.math.BigDecimal; - import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; @@ -19,10 +17,4 @@ public double doDouble( } return a / b; } - - @Override - public BigDecimal doBigDecimal( - BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { - return a.divide(b); - } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java index 15c10ffb1235..3c11a25d841a 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java @@ -325,4 +325,24 @@ protected BigDecimalStorage runBigDecimalZip( return new BigDecimalStorage(out, n); } + + protected BigDecimalStorage runBigDecimalMap( + BigDecimalArrayAdapter a, BigDecimal b, MapOperationProblemAggregator problemAggregator) { + Context context = Context.getCurrent(); + int n = a.size(); + BigDecimal[] out = new BigDecimal[n]; + for (int i = 0; i < n; i++) { + BigDecimal x = a.getItem(i); + if (x == null || b == null) { + out[i] = null; + } else { + BigDecimal r = doBigDecimal(x, b, i, problemAggregator); + out[i] = r; + } + + context.safepoint(); + } + + return new BigDecimalStorage(out, n); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java new file mode 100644 index 000000000000..0894671ee4f2 --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java @@ -0,0 +1,62 @@ +package org.enso.table.data.column.operation.map.numeric.arithmetic; + +import static org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter.fromAnyStorage; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import org.enso.base.polyglot.NumericConverter; +import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; +import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; +import org.enso.table.data.column.storage.Storage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; + +public abstract class NumericBinaryOpReturningBigDecimal> + extends NumericBinaryOpImplementation { + public NumericBinaryOpReturningBigDecimal(String name) { + super(name); + } + + @Override + public Storage runBinaryMap( + I storage, Object arg, MapOperationProblemAggregator problemAggregator) { + if (arg == null) { + return BigDecimalStorage.makeEmpty(storage.size()); + } + + BigDecimalArrayAdapter lhs = fromAnyStorage(storage); + BigDecimal rhs = NumericConverter.coerceToBigDecimal(arg); + return runBigDecimalMap(lhs, rhs, problemAggregator); + } + + @Override + public Storage runZip( + I storage, Storage arg, MapOperationProblemAggregator problemAggregator) { + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromAnyStorage(storage); + BigDecimalArrayAdapter right = BigDecimalArrayAdapter.fromAnyStorage(arg); + return runBigDecimalZip(left, right, problemAggregator); + } + + @Override + public Long doLong(long a, long b, int ix, MapOperationProblemAggregator problemAggregator) { + throw new IllegalStateException( + "Impossible: should not reach here - a NumericOpReturningBigDecimal should always use the" + + " doBigDecimal branch."); + } + + @Override + public BigInteger doBigInteger( + BigInteger a, BigInteger b, int ix, MapOperationProblemAggregator problemAggregator) { + throw new IllegalStateException( + "Impossible: should not reach here - a NumericOpReturningBigDecimal should always use the" + + " doBigDecimal branch."); + } + + @Override + public double doDouble( + double a, double b, int ix, MapOperationProblemAggregator problemAggregator) { + throw new IllegalStateException( + "Impossible: should not reach here - a NumericOpReturningBigDecimal should always use the" + + " doBigDecimal branch."); + } +} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java index 74b5fd82c68b..2787666bca33 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java @@ -3,13 +3,11 @@ import static org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter.fromAnyStorage; import java.math.BigInteger; - +import java.math.BigDecimal; import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; -import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; import org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter; import org.enso.table.data.column.storage.Storage; -import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.numeric.DoubleStorage; public abstract class NumericBinaryOpReturningDouble> @@ -36,15 +34,9 @@ public Storage runBinaryMap( @Override public Storage runZip( I storage, Storage arg, MapOperationProblemAggregator problemAggregator) { - if (storage instanceof BigDecimalStorage || arg instanceof BigDecimalStorage) { - BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromAnyStorage(storage); - BigDecimalArrayAdapter right = BigDecimalArrayAdapter.fromAnyStorage(arg); - return runBigDecimalZip(left, right, problemAggregator); - } else { - DoubleArrayAdapter lhs = fromAnyStorage(storage); - DoubleArrayAdapter rhs = fromAnyStorage(arg); - return runDoubleZip(lhs, rhs, problemAggregator); - } + DoubleArrayAdapter lhs = fromAnyStorage(storage); + DoubleArrayAdapter rhs = fromAnyStorage(arg); + return runDoubleZip(lhs, rhs, problemAggregator); } @Override @@ -61,4 +53,12 @@ public BigInteger doBigInteger( "Impossible: should not reach here - a NumericOpReturningDouble should always use the" + " doDouble branch."); } + + @Override + public BigDecimal doBigDecimal( + BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { + throw new IllegalStateException( + "Impossible: should not reach here - a NumericOpReturningDouble should always use the" + + " doDouble branch."); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java index 73d1fdaac356..d91013acc3fd 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java @@ -4,7 +4,7 @@ import org.enso.table.data.column.operation.map.MapOperationStorage; import org.enso.table.data.column.operation.map.numeric.arithmetic.AddOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.BigDecimalPowerOp; -import org.enso.table.data.column.operation.map.numeric.arithmetic.DivideOp; +import org.enso.table.data.column.operation.map.numeric.arithmetic.BigDecimalDivideOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.ModOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.MulOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.SubOp; @@ -27,13 +27,17 @@ public BigDecimalStorage(BigDecimal[] data, int size) { super(data, size, buildOps()); } + public static BigDecimalStorage makeEmpty(int size) { + return new BigDecimalStorage(new BigDecimal[size], size); + } + private static MapOperationStorage> buildOps() { MapOperationStorage> ops = ObjectStorage.buildObjectOps(); return ops.add(new AddOp<>()) .add(new SubOp<>()) .add(new MulOp<>()) - .add(new DivideOp<>()) + .add(new BigDecimalDivideOp<>()) .add(new BigDecimalPowerOp()) .add(new ModOp<>()) .add(new LessComparison<>()) From fef5e4ad967df58423bcbdef30e087160c6aeb6e Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 17 May 2024 13:54:59 -0400 Subject: [PATCH 14/34] with scalar --- .../enso/base/polyglot/NumericConverter.java | 76 +++++++++++++++++++ .../numeric/arithmetic/BigDecimalPowerOp.java | 29 ++++++- .../NumericBinaryOpImplementation.java | 12 +++ .../numeric/helpers/IntegerArrayAdapter.java | 6 +- 4 files changed, 118 insertions(+), 5 deletions(-) diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java index 8e4f5d38333c..872b5ee331e5 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java @@ -18,6 +18,11 @@ * want to be consistent with Enso's equality semantics where 2 == 2.0. */ public class NumericConverter { + public static BigInteger INTEGER_MIN_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MIN_VALUE); + public static BigInteger INTEGER_MAX_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MAX_VALUE); + public static BigDecimal INTEGER_MIN_VALUE_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE); + public static BigDecimal INTEGER_MAX_VALUE_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE); + /** * Coerces a number (possibly an integer) to a Double. * @@ -120,6 +125,77 @@ public static Double tryConvertingToDouble(Object o) { }; } + /** + * Tries converting the value to an Integer. + * + *

Decimal number types are accepted, only if their fractional part is 0. It will return null + * if the object represented a non-integer value. Integer values must fit within the Integer range. + */ + public static Integer tryConvertingToInteger(Object o) { + return switch (o) { + case Long x -> fitsInInt(x) ? x.intValue() : null; + case Integer x -> x; + case Short x -> (int) x; + case Byte x -> (int) x; + case Double x -> integralDoubleToInteger(x); + case Float x -> integralDoubleToInteger(x); + case BigDecimal x -> integralBigDecimalToInteger(x); + case BigInteger x -> integralBigIntegerToInteger(x); + case null, default -> null; + }; + } + + private static boolean fitsInInt(long x) { + return x >= Integer.MIN_VALUE && x <= Integer.MAX_VALUE; + } + + private static boolean fitsInInt(BigInteger x) { + return x.compareTo(INTEGER_MIN_VALUE_BIG_INTEGER) >= 0 && x.compareTo(INTEGER_MAX_VALUE_BIG_INTEGER) <= 0; + } + + private static boolean fitsInInt(BigDecimal x) { + return x.compareTo(INTEGER_MIN_VALUE_BIG_DECIMAL) >= 0 && x.compareTo(INTEGER_MAX_VALUE_BIG_DECIMAL) <= 0; + } + + /** + * Converts a double to an Integer, if the value is integral and fits in the + * Integer range. Otherwise, returns null; + */ + private static Integer integralDoubleToInteger(double x) { + if (x % 1.0 == 0.0) { + long l = (long) x; + if (fitsInInt(l)) { + return (int) l; + } + } + return null; + } + + /** + * Converts a BigInteger to an Integer, if the value fits in the Integer + * range. Otherwise, returns null; + */ + private static Integer integralBigIntegerToInteger(BigInteger x) { + if (fitsInInt(x)) { + return x.intValueExact(); + } else { + return null; + } + } + + /** + * Converts a BigDecmal to an Integer, if the value is integral and fits in + * the Integer range. Otherwise, returns null; + */ + private static Integer integralBigDecimalToInteger(BigDecimal x) { + if (x.remainder(BigDecimal.ZERO).equals(BigDecimal.ZERO)) { + if (fitsInInt(x)) { + return x.intValueExact(); + } + } + return null; + } + /** * Tries converting the value to a Long. * diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java index 750825707508..1701c4e852da 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; +import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.BinaryMapOperation; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; @@ -11,6 +12,7 @@ import org.enso.table.data.column.storage.numeric.AbstractLongStorage; import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.numeric.BigIntegerStorage; +import org.enso.table.error.UnexpectedTypeException; import org.graalvm.polyglot.Context; public class BigDecimalPowerOp extends BinaryMapOperation> { @@ -21,7 +23,12 @@ public BigDecimalPowerOp() { @Override public Storage runBinaryMap( SpecializedStorage storage, Object arg, MapOperationProblemAggregator problemAggregator) { - throw new UnsupportedOperationException(""); + BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(storage); + Integer right = NumericConverter.tryConvertingToInteger(arg); + if (right == null) { + throw new UnexpectedTypeException("an Integer."); + } + return runBigDecimalMap(left, right, problemAggregator); } @Override @@ -57,4 +64,24 @@ private BigDecimalStorage runBigDecimalZip( return new BigDecimalStorage(out, n); } + + protected BigDecimalStorage runBigDecimalMap( + BigDecimalArrayAdapter a, int b, MapOperationProblemAggregator problemAggregator) { + Context context = Context.getCurrent(); + int n = a.size(); + BigDecimal[] out = new BigDecimal[n]; + for (int i = 0; i < n; i++) { + BigDecimal x = a.getItem(i); + if (x == null) { + out[i] = null; + } else { + BigDecimal r = x.pow(b); + out[i] = r; + } + + context.safepoint(); + } + + return new BigDecimalStorage(out, n); + } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java index 3c11a25d841a..c35390fe16a3 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java @@ -45,6 +45,10 @@ public Storage runBinaryMap( BigIntegerArrayAdapter.fromStorage(s), rhs, problemAggregator); case BigIntegerStorage s -> runBigIntegerMap( BigIntegerArrayAdapter.fromStorage(s), rhs, problemAggregator); + case BigDecimalStorage s -> runBigDecimalMap( + BigDecimalArrayAdapter.fromStorage(s), + new BigDecimal(rhs), + problemAggregator); case DoubleStorage s -> runDoubleMap(s, rhs.doubleValue(), problemAggregator); default -> throw new IllegalStateException( "Unsupported storage: " + storage.getClass().getCanonicalName()); @@ -57,6 +61,10 @@ public Storage runBinaryMap( BigIntegerArrayAdapter.fromStorage(s), BigInteger.valueOf(argAsLong), problemAggregator); + case BigDecimalStorage s -> runBigDecimalMap( + BigDecimalArrayAdapter.fromStorage(s), + BigDecimal.valueOf(argAsLong), + problemAggregator); case DoubleStorage s -> runDoubleMap(s, (double) argAsLong, problemAggregator); default -> throw new IllegalStateException( "Unsupported storage: " + storage.getClass().getCanonicalName()); @@ -68,6 +76,10 @@ public Storage runBinaryMap( DoubleArrayAdapter.fromStorage(s), doubleArg, problemAggregator); case BigIntegerStorage s -> runDoubleMap( DoubleArrayAdapter.fromStorage(s), doubleArg, problemAggregator); + case BigDecimalStorage s -> runBigDecimalMap( + BigDecimalArrayAdapter.fromStorage(s), + BigDecimal.valueOf(doubleArg), + problemAggregator); case DoubleStorage s -> runDoubleMap(s, doubleArg, problemAggregator); default -> throw new IllegalStateException( "Unsupported storage: " + storage.getClass().getCanonicalName()); diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java index 0994911ae04d..299c289db3dc 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java @@ -1,15 +1,13 @@ package org.enso.table.data.column.operation.map.numeric.helpers; import java.math.BigInteger; +import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; import org.enso.table.data.column.storage.numeric.BigIntegerStorage; public interface IntegerArrayAdapter { - static BigInteger INTEGER_MIN_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MIN_VALUE); - static BigInteger INTEGER_MAX_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MAX_VALUE); - Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator); boolean isNothing(long i); @@ -62,7 +60,7 @@ private BigIntegerStorageAsInteger(BigIntegerStorage storage) { @Override public Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator) { BigInteger x = storage.getItem(i); - if (x.compareTo(INTEGER_MAX_VALUE_BIG_INTEGER) > 0 || x.compareTo(INTEGER_MIN_VALUE_BIG_INTEGER) < 0) { + if (x.compareTo(NumericConverter.INTEGER_MAX_VALUE_BIG_INTEGER) > 0 || x.compareTo(NumericConverter.INTEGER_MIN_VALUE_BIG_INTEGER) < 0) { problemAggregator.reportIllegalArgumentError("The exponent in Decimal.pow (^) must be an Integer (between -2147483648 and 2147483647), but was "+x, i); return null; } From bdda67f74508449b01e67aa4f1240adc2edf3759 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 17 May 2024 16:58:01 -0400 Subject: [PATCH 15/34] misc arithmetic tests --- .../Standard/Table/0.0.0-dev/src/Column.enso | 2 +- .../src/Internal/Value_Type_Helpers.enso | 1 + .../NumericBinaryOpImplementation.java | 2 ++ .../Column_Operations_Spec.enso | 30 +++++++++++++++++-- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index 02d9c592bde8..effd46323546 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -2459,7 +2459,7 @@ run_vectorized_binary_op column name operand new_name=Nothing fallback_fn=Nothin _ -> s1 = column.java_column.getStorage rs = Polyglot_Helpers.handle_polyglot_dataflow_errors <| - s1.vectorizedOrFallbackBinaryMap name problem_builder fallback_fn operand skip_nulls storage_type + s1.vectorizedOrFallbackBinaryMap name problem_builder fallback_fn (enso_to_java operand) skip_nulls storage_type Column.Value (Java_Column.new effective_new_name rs) ## PRIVATE diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Value_Type_Helpers.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Value_Type_Helpers.enso index 62e7b0d46219..d6e12ae1289a 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Value_Type_Helpers.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Value_Type_Helpers.enso @@ -25,6 +25,7 @@ most_specific_value_type : Any -> Boolean -> Value_Type most_specific_value_type value use_smallest=False = case value of _ : Float -> Value_Type.Float Bits.Bits_64 + _ : Decimal -> Value_Type.Decimal _ : Boolean -> Value_Type.Boolean _ : Date -> Value_Type.Date _ : Time_Of_Day -> Value_Type.Time diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java index c35390fe16a3..2e7315942dd9 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java @@ -84,6 +84,8 @@ public Storage runBinaryMap( default -> throw new IllegalStateException( "Unsupported storage: " + storage.getClass().getCanonicalName()); }; + } else if (arg instanceof BigDecimal bd) { + return runBigDecimalMap(BigDecimalArrayAdapter.fromAnyStorage(storage), bd, problemAggregator); } else { throw new UnexpectedTypeException("a Number."); } diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index c749f769f76b..f157ec206758 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1778,8 +1778,8 @@ add_specs suite_builder setup = table_builder cols = setup.table_builder cols connection=data.connection - group_builder.specify "Arithmetic" <| - t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123E50"]], ["z", [Decimal.new "125E50"]], ["w", [2]], ["ww", [7513]]] + group_builder.specify "arithmetic (column and column)" <| + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123e50"]], ["z", [Decimal.new "125e50"]], ["w", [2]], ["ww", [7513]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "-12299999999999999999999999999999999999999976742754654.654654655"] (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "2.860641177477477477435E+62"] @@ -1787,6 +1787,32 @@ add_specs suite_builder setup = (t.at "x" ^ t.at "w").to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] (t.at "x" % t.at "ww").to_vector . should_equal [Decimal.new "2545.345345345"] + group_builder.specify "arithmetic (column and scalar)" <| + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "944548245.68648775"]]] + + (t.at "x" + 10) . to_vector . should_equal [Decimal.new "23257245355.345345345"] + (t.at "x" - 10) . to_vector . should_equal [Decimal.new "23257245335.345345345"] + (t.at "x" * 10) . to_vector . should_equal [Decimal.new "232572453453.45345345"] + (t.at "x" / 10) . to_vector . should_equal [Decimal.new "2325724534.5345345345"] + (t.at "x" ^ 2) . to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] + + (t.at "x" + 10.1) . to_vector . should_equal [Decimal.new "23257245355.445345345"] + (t.at "x" - 10.1) . to_vector . should_equal [Decimal.new "23257245335.245345345"] + (t.at "x" * 10.1) . to_vector . should_equal [Decimal.new "234898177987.9879879845"] + (t.at "y" / 16.5) . to_vector . should_equal [Decimal.new "57245348.2234235"] + (t.at "x" ^ 2.0) . to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] + + (t.at "x" + 2^80) . to_vector . should_equal [Decimal.new "1208925819614652431951521.345345345"] + (t.at "x" - 2^80) . to_vector . should_equal [Decimal.new "-1208925819614605917460830.654654655"] + (t.at "x" * 2^80) . to_vector . should_equal [Decimal.new "28116284391100140971590625398136689.624350720"] + (t.at "y" / 2^80) . to_vector . should_equal [Decimal.new "0.0000000000000007813119964528366172913694049826337229003314632791443727910518646240234375"] + + (t.at "x" + (Decimal.new "10.1")) . to_vector . should_equal [Decimal.new "23257245355.445345345"] + (t.at "x" - (Decimal.new "10.1")) . to_vector . should_equal [Decimal.new "23257245335.245345345"] + (t.at "x" * (Decimal.new "10.1")) . to_vector . should_equal [Decimal.new "234898177987.9879879845"] + (t.at "y" / (Decimal.new "16.5")) . to_vector . should_equal [Decimal.new "57245348.2234235"] + (t.at "x" ^ (Decimal.new "2.0")) . to_vector . should_equal [Decimal.new "540899461518732638866.863508357313169025"] + # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 137f9752ab6569e5cda789215b6b34c6bbd681f9 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 20 May 2024 11:59:07 -0400 Subject: [PATCH 16/34] fix integralBigDecimalToInteger --- .../src/main/java/org/enso/base/polyglot/NumericConverter.java | 2 +- .../src/Common_Table_Operations/Column_Operations_Spec.enso | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java index 872b5ee331e5..495fc2cb7570 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java @@ -188,7 +188,7 @@ private static Integer integralBigIntegerToInteger(BigInteger x) { * the Integer range. Otherwise, returns null; */ private static Integer integralBigDecimalToInteger(BigDecimal x) { - if (x.remainder(BigDecimal.ZERO).equals(BigDecimal.ZERO)) { + if (x.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0) { if (fitsInInt(x)) { return x.intValueExact(); } diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index f157ec206758..044bcd4eeb80 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1811,7 +1811,7 @@ add_specs suite_builder setup = (t.at "x" - (Decimal.new "10.1")) . to_vector . should_equal [Decimal.new "23257245335.245345345"] (t.at "x" * (Decimal.new "10.1")) . to_vector . should_equal [Decimal.new "234898177987.9879879845"] (t.at "y" / (Decimal.new "16.5")) . to_vector . should_equal [Decimal.new "57245348.2234235"] - (t.at "x" ^ (Decimal.new "2.0")) . to_vector . should_equal [Decimal.new "540899461518732638866.863508357313169025"] + (t.at "x" ^ (Decimal.new "2.0")) . to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 3f3fde81412d93084ea41c0bc4fc8f3373fa3fdc Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 20 May 2024 15:37:05 -0400 Subject: [PATCH 17/34] mixed columns --- .../Standard/Table/0.0.0-dev/src/Column.enso | 5 +- .../numeric/arithmetic/BigDecimalPowerOp.java | 2 +- .../Column_Operations_Spec.enso | 48 +++++++++++++++++-- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index 1b614a52f450..d87cefed053a 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -685,8 +685,9 @@ type Column example_div = Examples.decimal_column ^ Examples.integer_column ^ : Column | Any -> Column ^ self other = - Value_Type_Helpers.check_binary_numeric_op self other <| - run_vectorized_binary_op self Java_Storage.Maps.POWER other + Illegal_Argument.handle_java_exception <| + Value_Type_Helpers.check_binary_numeric_op self other <| + run_vectorized_binary_op self Java_Storage.Maps.POWER other ## ALIAS and GROUP Standard.Base.Operators diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java index 1701c4e852da..a5dc078f8dc8 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java @@ -26,7 +26,7 @@ public Storage runBinaryMap( BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(storage); Integer right = NumericConverter.tryConvertingToInteger(arg); if (right == null) { - throw new UnexpectedTypeException("an Integer."); + throw new IllegalArgumentException("Exponent must be an Integer."); } return runBigDecimalMap(left, right, problemAggregator); } diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index 044bcd4eeb80..ea022c1d66a0 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -15,7 +15,6 @@ import Standard.Database.DB_Table.DB_Table from Standard.Test import all - import enso_dev.Base_Tests.Data.Round_Spec from project.Common_Table_Operations.Util import run_default_backend @@ -1778,14 +1777,31 @@ add_specs suite_builder setup = table_builder cols = setup.table_builder cols connection=data.connection - group_builder.specify "arithmetic (column and column)" <| - t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123e50"]], ["z", [Decimal.new "125e50"]], ["w", [2]], ["ww", [7513]]] + group_builder.specify "arithmetic (decimal column and decimal column)" <| + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123e50"]], ["z", [Decimal.new "125e50"]], ["w", [7513]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "-12299999999999999999999999999999999999999976742754654.654654655"] (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "2.860641177477477477435E+62"] (t.at "x" / t.at "z").to_vector . should_equal [Decimal.new "1.8605796276276276276E-42"] - (t.at "x" ^ t.at "w").to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] - (t.at "x" % t.at "ww").to_vector . should_equal [Decimal.new "2545.345345345"] + (t.at "x" % t.at "w").to_vector . should_equal [Decimal.new "2545.345345345"] + + group_builder.specify "arithmetic (decimal column and non-decimal column)" <| + t = table_builder [["x", [101.25]], ["y", [30]], ["z", [40.5]], ["w", [2]], ["wf", [2.0]]] + + (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "131.25"] + (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "71.25"] + (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "3037.5"] + (t.at "x" / t.at "y").to_vector . should_equal [Decimal.new "3.375"] + (t.at "x" % t.at "y").to_vector . should_equal [Decimal.new "11.25"] + + (t.at "x" + t.at "z").to_vector . should_equal [Decimal.new "141.75"] + (t.at "x" - t.at "z").to_vector . should_equal [Decimal.new "60.75"] + (t.at "x" * t.at "z").to_vector . should_equal [Decimal.new "4100.625"] + (t.at "x" / t.at "z").to_vector . should_equal [Decimal.new "2.5"] + (t.at "x" % t.at "z").to_vector . should_equal [Decimal.new "20.25"] + + (t.at "x" ^ t.at "w").to_vector . should_equal [Decimal.new "10251.5625"] + (t.at "x" ^ t.at "wf").to_vector . should_equal [Decimal.new "10251.5625"] group_builder.specify "arithmetic (column and scalar)" <| t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "944548245.68648775"]]] @@ -1813,6 +1829,28 @@ add_specs suite_builder setup = (t.at "y" / (Decimal.new "16.5")) . to_vector . should_equal [Decimal.new "57245348.2234235"] (t.at "x" ^ (Decimal.new "2.0")) . to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] + group_builder.specify "exponent non-integral or out of range (scalar)" <| + t = table_builder [["x", [Decimal.new "23257245345.345345345"]]] + + (t.at "x" ^ 2147483650) . to_vector . should_fail_with Illegal_Argument + (t.at "x" ^ (2^80)) . to_vector . should_fail_with Illegal_Argument + (t.at "x" ^ 2.1) . to_vector . should_fail_with Illegal_Argument + + group_builder.specify "exponent non-integral or out of range (column)" <| + bads = [Decimal.new "1.2", 1.2, 2147483650] + bads.map bad-> + t = table_builder [["x", [Decimal.new "1.21"]], ["y", [bad]]] + r = (t.at "x" ^ t.at "y") + r.to_vector . should_equal [Nothing] + Problems.expect_warning Illegal_Argument r + + group_builder.specify "exponent non-integral or out of range (mixed column)" <| + bads = [Decimal.new "1.2", 1.2, 2147483650] + t = table_builder [["x", [Decimal.new "1.21"]], ["y", bads]] + r = (t.at "x" ^ t.at "y") + r.to_vector . should_equal [Nothing, Nothing, Nothing] + Problems.expect_warning Illegal_Argument r + # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 5b1ef35925354e9b4357d6cd3569a0b134395a7c Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 15:15:20 -0400 Subject: [PATCH 18/34] bigdecimal pow via double --- .../numeric/helpers/DoubleArrayAdapter.java | 31 +++++++++++++++++ .../storage/numeric/BigDecimalStorage.java | 4 +-- .../Column_Operations_Spec.enso | 34 ++++--------------- 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java index aa28de2128a9..ba93260ff66a 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java @@ -1,8 +1,10 @@ package org.enso.table.data.column.operation.map.numeric.helpers; +import java.math.BigDecimal; import java.math.BigInteger; import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; +import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.numeric.BigIntegerStorage; import org.enso.table.data.column.storage.numeric.DoubleStorage; @@ -17,6 +19,10 @@ static DoubleArrayAdapter fromStorage(BigIntegerStorage storage) { return new BigIntegerStorageAsDouble(storage); } + static DoubleArrayAdapter fromStorage(BigDecimalStorage storage) { + return new BigDecimalStorageAsDouble(storage); + } + static DoubleArrayAdapter fromStorage(AbstractLongStorage storage) { return new LongStorageAsDouble(storage); } @@ -30,6 +36,7 @@ static DoubleArrayAdapter fromAnyStorage(Storage storage) { case DoubleStorage s -> fromStorage(s); case AbstractLongStorage s -> fromStorage(s); case BigIntegerStorage s -> fromStorage(s); + case BigDecimalStorage s -> fromStorage(s); default -> throw new IllegalStateException( "Unsupported storage: " + storage.getClass().getCanonicalName()); }; @@ -77,6 +84,30 @@ public boolean isNothing(long i) { return storage.getItem(i) == null; } + @Override + public int size() { + return storage.size(); + } + } + + class BigDecimalStorageAsDouble implements DoubleArrayAdapter { + private final BigDecimalStorage storage; + + private BigDecimalStorageAsDouble(BigDecimalStorage storage) { + this.storage = storage; + } + + @Override + public double getItemAsDouble(int i) { + BigDecimal x = storage.getItem(i); + return x.doubleValue(); + } + + @Override + public boolean isNothing(long i) { + return storage.getItem(i) == null; + } + @Override public int size() { return storage.size(); diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java index d91013acc3fd..3f56d0b42420 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/numeric/BigDecimalStorage.java @@ -3,10 +3,10 @@ import java.math.BigDecimal; import org.enso.table.data.column.operation.map.MapOperationStorage; import org.enso.table.data.column.operation.map.numeric.arithmetic.AddOp; -import org.enso.table.data.column.operation.map.numeric.arithmetic.BigDecimalPowerOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.BigDecimalDivideOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.ModOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.MulOp; +import org.enso.table.data.column.operation.map.numeric.arithmetic.PowerOp; import org.enso.table.data.column.operation.map.numeric.arithmetic.SubOp; import org.enso.table.data.column.operation.map.numeric.comparisons.EqualsComparison; import org.enso.table.data.column.operation.map.numeric.comparisons.GreaterComparison; @@ -38,7 +38,7 @@ private static MapOperationStorage> b .add(new SubOp<>()) .add(new MulOp<>()) .add(new BigDecimalDivideOp<>()) - .add(new BigDecimalPowerOp()) + .add(new PowerOp<>()) .add(new ModOp<>()) .add(new LessComparison<>()) .add(new LessOrEqualComparison<>()) diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index ea022c1d66a0..cfe3602c4bce 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1778,15 +1778,16 @@ add_specs suite_builder setup = setup.table_builder cols connection=data.connection group_builder.specify "arithmetic (decimal column and decimal column)" <| - t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123e50"]], ["z", [Decimal.new "125e50"]], ["w", [7513]]] + t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123e50"]], ["z", [Decimal.new "125e50"]], ["w", [Decimal.new 7513]], ["v", [Decimal.new "3.7"]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "-12299999999999999999999999999999999999999976742754654.654654655"] (t.at "x" * t.at "y").to_vector . should_equal [Decimal.new "2.860641177477477477435E+62"] (t.at "x" / t.at "z").to_vector . should_equal [Decimal.new "1.8605796276276276276E-42"] (t.at "x" % t.at "w").to_vector . should_equal [Decimal.new "2545.345345345"] + (t.at "x" ^ t.at "v").to_vector . should_equal [Decimal.new "2.27125352907938E38" . to_float] group_builder.specify "arithmetic (decimal column and non-decimal column)" <| - t = table_builder [["x", [101.25]], ["y", [30]], ["z", [40.5]], ["w", [2]], ["wf", [2.0]]] + t = table_builder [["x", [Decimal.new "101.25"]], ["y", [30]], ["z", [40.5]], ["w", [2]], ["wf", [2.0]], ["wf2", [2.1]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "131.25"] (t.at "x" - t.at "y").to_vector . should_equal [Decimal.new "71.25"] @@ -1802,6 +1803,7 @@ add_specs suite_builder setup = (t.at "x" ^ t.at "w").to_vector . should_equal [Decimal.new "10251.5625"] (t.at "x" ^ t.at "wf").to_vector . should_equal [Decimal.new "10251.5625"] + (t.at "x" ^ t.at "wf2").to_vector . should_equal [16267.827812994828] group_builder.specify "arithmetic (column and scalar)" <| t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "944548245.68648775"]]] @@ -1810,13 +1812,13 @@ add_specs suite_builder setup = (t.at "x" - 10) . to_vector . should_equal [Decimal.new "23257245335.345345345"] (t.at "x" * 10) . to_vector . should_equal [Decimal.new "232572453453.45345345"] (t.at "x" / 10) . to_vector . should_equal [Decimal.new "2325724534.5345345345"] - (t.at "x" ^ 2) . to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] + (t.at "x" ^ 2) . to_vector . should_equal [Decimal.new "5.408994610535877E20" . to_float] (t.at "x" + 10.1) . to_vector . should_equal [Decimal.new "23257245355.445345345"] (t.at "x" - 10.1) . to_vector . should_equal [Decimal.new "23257245335.245345345"] (t.at "x" * 10.1) . to_vector . should_equal [Decimal.new "234898177987.9879879845"] (t.at "y" / 16.5) . to_vector . should_equal [Decimal.new "57245348.2234235"] - (t.at "x" ^ 2.0) . to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] + (t.at "x" ^ 2.0) . to_vector . should_equal [Decimal.new "5.408994610535877E20" . to_float] (t.at "x" + 2^80) . to_vector . should_equal [Decimal.new "1208925819614652431951521.345345345"] (t.at "x" - 2^80) . to_vector . should_equal [Decimal.new "-1208925819614605917460830.654654655"] @@ -1827,29 +1829,7 @@ add_specs suite_builder setup = (t.at "x" - (Decimal.new "10.1")) . to_vector . should_equal [Decimal.new "23257245335.245345345"] (t.at "x" * (Decimal.new "10.1")) . to_vector . should_equal [Decimal.new "234898177987.9879879845"] (t.at "y" / (Decimal.new "16.5")) . to_vector . should_equal [Decimal.new "57245348.2234235"] - (t.at "x" ^ (Decimal.new "2.0")) . to_vector . should_equal [Decimal.new "540899461053587731859.956601457313169025"] - - group_builder.specify "exponent non-integral or out of range (scalar)" <| - t = table_builder [["x", [Decimal.new "23257245345.345345345"]]] - - (t.at "x" ^ 2147483650) . to_vector . should_fail_with Illegal_Argument - (t.at "x" ^ (2^80)) . to_vector . should_fail_with Illegal_Argument - (t.at "x" ^ 2.1) . to_vector . should_fail_with Illegal_Argument - - group_builder.specify "exponent non-integral or out of range (column)" <| - bads = [Decimal.new "1.2", 1.2, 2147483650] - bads.map bad-> - t = table_builder [["x", [Decimal.new "1.21"]], ["y", [bad]]] - r = (t.at "x" ^ t.at "y") - r.to_vector . should_equal [Nothing] - Problems.expect_warning Illegal_Argument r - - group_builder.specify "exponent non-integral or out of range (mixed column)" <| - bads = [Decimal.new "1.2", 1.2, 2147483650] - t = table_builder [["x", [Decimal.new "1.21"]], ["y", bads]] - r = (t.at "x" ^ t.at "y") - r.to_vector . should_equal [Nothing, Nothing, Nothing] - Problems.expect_warning Illegal_Argument r + (t.at "x" ^ (Decimal.new "2.0")) . to_vector . should_equal [Decimal.new "5.408994610535877E20" . to_float] # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From cc9230c49ad0ca62f9ba270a1d36c386752dab23 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 15:33:20 -0400 Subject: [PATCH 19/34] cleanup --- .../enso/base/polyglot/NumericConverter.java | 76 ---------------- .../enso/base/polyglot/Polyglot_Utils.java | 1 - .../numeric/arithmetic/BigDecimalPowerOp.java | 87 ------------------- .../numeric/helpers/IntegerArrayAdapter.java | 80 ----------------- 4 files changed, 244 deletions(-) delete mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java delete mode 100644 std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java index 495fc2cb7570..8e4f5d38333c 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/NumericConverter.java @@ -18,11 +18,6 @@ * want to be consistent with Enso's equality semantics where 2 == 2.0. */ public class NumericConverter { - public static BigInteger INTEGER_MIN_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MIN_VALUE); - public static BigInteger INTEGER_MAX_VALUE_BIG_INTEGER = BigInteger.valueOf(Integer.MAX_VALUE); - public static BigDecimal INTEGER_MIN_VALUE_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE); - public static BigDecimal INTEGER_MAX_VALUE_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE); - /** * Coerces a number (possibly an integer) to a Double. * @@ -125,77 +120,6 @@ public static Double tryConvertingToDouble(Object o) { }; } - /** - * Tries converting the value to an Integer. - * - *

Decimal number types are accepted, only if their fractional part is 0. It will return null - * if the object represented a non-integer value. Integer values must fit within the Integer range. - */ - public static Integer tryConvertingToInteger(Object o) { - return switch (o) { - case Long x -> fitsInInt(x) ? x.intValue() : null; - case Integer x -> x; - case Short x -> (int) x; - case Byte x -> (int) x; - case Double x -> integralDoubleToInteger(x); - case Float x -> integralDoubleToInteger(x); - case BigDecimal x -> integralBigDecimalToInteger(x); - case BigInteger x -> integralBigIntegerToInteger(x); - case null, default -> null; - }; - } - - private static boolean fitsInInt(long x) { - return x >= Integer.MIN_VALUE && x <= Integer.MAX_VALUE; - } - - private static boolean fitsInInt(BigInteger x) { - return x.compareTo(INTEGER_MIN_VALUE_BIG_INTEGER) >= 0 && x.compareTo(INTEGER_MAX_VALUE_BIG_INTEGER) <= 0; - } - - private static boolean fitsInInt(BigDecimal x) { - return x.compareTo(INTEGER_MIN_VALUE_BIG_DECIMAL) >= 0 && x.compareTo(INTEGER_MAX_VALUE_BIG_DECIMAL) <= 0; - } - - /** - * Converts a double to an Integer, if the value is integral and fits in the - * Integer range. Otherwise, returns null; - */ - private static Integer integralDoubleToInteger(double x) { - if (x % 1.0 == 0.0) { - long l = (long) x; - if (fitsInInt(l)) { - return (int) l; - } - } - return null; - } - - /** - * Converts a BigInteger to an Integer, if the value fits in the Integer - * range. Otherwise, returns null; - */ - private static Integer integralBigIntegerToInteger(BigInteger x) { - if (fitsInInt(x)) { - return x.intValueExact(); - } else { - return null; - } - } - - /** - * Converts a BigDecmal to an Integer, if the value is integral and fits in - * the Integer range. Otherwise, returns null; - */ - private static Integer integralBigDecimalToInteger(BigDecimal x) { - if (x.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0) { - if (fitsInInt(x)) { - return x.intValueExact(); - } - } - return null; - } - /** * Tries converting the value to a Long. * diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java index 6a6d4b5a7a13..ebbedc3ac941 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/Polyglot_Utils.java @@ -35,7 +35,6 @@ public static Object convertPolyglotValue(Value item) { if (item.isException()) { throw new WrappedDataflowError(item); } - var ret = item.as(Object.class); if (ret instanceof BigInteger && item.fitsInLong()) { return item.asLong(); diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java deleted file mode 100644 index a5dc078f8dc8..000000000000 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalPowerOp.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.enso.table.data.column.operation.map.numeric.arithmetic; - -import java.math.BigDecimal; - -import org.enso.base.polyglot.NumericConverter; -import org.enso.table.data.column.operation.map.BinaryMapOperation; -import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; -import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; -import org.enso.table.data.column.operation.map.numeric.helpers.IntegerArrayAdapter; -import org.enso.table.data.column.storage.SpecializedStorage; -import org.enso.table.data.column.storage.Storage; -import org.enso.table.data.column.storage.numeric.AbstractLongStorage; -import org.enso.table.data.column.storage.numeric.BigDecimalStorage; -import org.enso.table.data.column.storage.numeric.BigIntegerStorage; -import org.enso.table.error.UnexpectedTypeException; -import org.graalvm.polyglot.Context; - -public class BigDecimalPowerOp extends BinaryMapOperation> { - public BigDecimalPowerOp() { - super("^"); - } - - @Override - public Storage runBinaryMap( - SpecializedStorage storage, Object arg, MapOperationProblemAggregator problemAggregator) { - BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(storage); - Integer right = NumericConverter.tryConvertingToInteger(arg); - if (right == null) { - throw new IllegalArgumentException("Exponent must be an Integer."); - } - return runBigDecimalMap(left, right, problemAggregator); - } - - @Override - public Storage runZip( - SpecializedStorage storage, Storage arg, MapOperationProblemAggregator problemAggregator) { - BigDecimalArrayAdapter left = BigDecimalArrayAdapter.fromStorage(storage); - IntegerArrayAdapter right = switch(arg) { - case AbstractLongStorage lhs -> IntegerArrayAdapter.fromStorage(lhs); - case BigIntegerStorage lhs -> IntegerArrayAdapter.fromStorage(lhs); - default -> throw new IllegalStateException( - "Unsupported storage: " + arg.getClass().getCanonicalName()); - }; - return runBigDecimalZip(left, right, problemAggregator); - } - - private BigDecimalStorage runBigDecimalZip( - BigDecimalArrayAdapter a, - IntegerArrayAdapter b, - MapOperationProblemAggregator problemAggregator) { - Context context = Context.getCurrent(); - int n = a.size(); - int m = Math.min(a.size(), b.size()); - BigDecimal[] out = new BigDecimal[n]; - for (int i = 0; i < m; i++) { - BigDecimal x = a.getItem(i); - Integer y = b.getItemAsInteger(i, problemAggregator); - if (x != null && y != null) { - BigDecimal r = x.pow(y); - out[i] = r; - } - context.safepoint(); - } - - return new BigDecimalStorage(out, n); - } - - protected BigDecimalStorage runBigDecimalMap( - BigDecimalArrayAdapter a, int b, MapOperationProblemAggregator problemAggregator) { - Context context = Context.getCurrent(); - int n = a.size(); - BigDecimal[] out = new BigDecimal[n]; - for (int i = 0; i < n; i++) { - BigDecimal x = a.getItem(i); - if (x == null) { - out[i] = null; - } else { - BigDecimal r = x.pow(b); - out[i] = r; - } - - context.safepoint(); - } - - return new BigDecimalStorage(out, n); - } -} diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java deleted file mode 100644 index 299c289db3dc..000000000000 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/IntegerArrayAdapter.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.enso.table.data.column.operation.map.numeric.helpers; - -import java.math.BigInteger; -import org.enso.base.polyglot.NumericConverter; -import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; -import org.enso.table.data.column.storage.Storage; -import org.enso.table.data.column.storage.numeric.AbstractLongStorage; -import org.enso.table.data.column.storage.numeric.BigIntegerStorage; - -public interface IntegerArrayAdapter { - Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator); - - boolean isNothing(long i); - - int size(); - - static IntegerArrayAdapter fromStorage(BigIntegerStorage storage) { - return new BigIntegerStorageAsInteger(storage); - } - - static IntegerArrayAdapter fromStorage(AbstractLongStorage storage) { - return new LongStorageAsInteger(storage); - } - - class LongStorageAsInteger implements IntegerArrayAdapter { - private final AbstractLongStorage storage; - - private LongStorageAsInteger(AbstractLongStorage storage) { - this.storage = storage; - } - - @Override - public Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator) { - long x = storage.getItem(i); - if (x > Integer.MAX_VALUE || x < Integer.MIN_VALUE) { - problemAggregator.reportIllegalArgumentError("The exponent in Decimal.pow (^) must be an Integer (between -2147483648 and 2147483647), but was "+x, i); - return null; - } - return (int) x; - } - - @Override - public boolean isNothing(long i) { - return storage.isNothing(i); - } - - @Override - public int size() { - return storage.size(); - } - } - - class BigIntegerStorageAsInteger implements IntegerArrayAdapter { - private final BigIntegerStorage storage; - - private BigIntegerStorageAsInteger(BigIntegerStorage storage) { - this.storage = storage; - } - - @Override - public Integer getItemAsInteger(int i, MapOperationProblemAggregator problemAggregator) { - BigInteger x = storage.getItem(i); - if (x.compareTo(NumericConverter.INTEGER_MAX_VALUE_BIG_INTEGER) > 0 || x.compareTo(NumericConverter.INTEGER_MIN_VALUE_BIG_INTEGER) < 0) { - problemAggregator.reportIllegalArgumentError("The exponent in Decimal.pow (^) must be an Integer (between -2147483648 and 2147483647), but was "+x, i); - return null; - } - return x.intValue(); - } - - @Override - public boolean isNothing(long i) { - return storage.isNothing(i); - } - - @Override - public int size() { - return storage.size(); - } - } -} From 3cce4cb5fdfbff9bb10dcae9bfba432f9e5ec051 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 15:58:53 -0400 Subject: [PATCH 20/34] j2e on get --- .../lib/Standard/Table/0.0.0-dev/src/Column.enso | 4 ++-- .../Standard/Table/0.0.0-dev/src/Internal/Storage.enso | 10 ++++++++++ .../Column_Operations_Spec.enso | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index 675bdc03c93e..a6f3a6e3cfcf 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -2143,7 +2143,7 @@ type Column @index (self-> Numeric_Input minimum=0 maximum=self.length-1) at : Integer -> (Any | Nothing) ! Index_Out_Of_Bounds at self (index : Integer) = - java_to_enso <| self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) + self.get index (Error.throw (Index_Out_Of_Bounds.Error index self.length)) ## GROUP Standard.Base.Selections ICON parse3 @@ -2166,7 +2166,7 @@ type Column if valid_index.not then default else storage = self.java_column.getStorage if storage.isNothing index then Nothing else - storage.getItem index + java_to_enso <| storage.getItem index ## ICON data_input Returns a column containing rows of this column. diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso index 409b6b18466c..5cd8890561de 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso @@ -72,10 +72,20 @@ closest_storage_type value_type = case value_type of _ -> Error.throw (Illegal_Argument.Error "Columns of type "+value_type.to_display_text+" are currently not supported in the in-memory backend.") +## PRIVATE + + Convert an Enso value to a Java value before storing it in a Java `Column`. + This step is unnecessary for primitive and builtin values, but necessary for + values such as `Decimal`/`BigDecimal`. enso_to_java x = case x of Decimal.Value big_decimal -> big_decimal _ -> x +## PRIVATE + + Convert a Java value to an Enso value before returning it to Enso from a Java + `Column`. This step is unnecessary for primitive and builtin values, but + necessary for values such as `Decimal`/`BigDecimal`. java_to_enso x = case x of _ : BigDecimal -> Decimal.Value x _ -> x diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index cfe3602c4bce..50228d15fbcb 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1777,6 +1777,11 @@ add_specs suite_builder setup = table_builder cols = setup.table_builder cols connection=data.connection + group_builder.specify "can store and retrieve values" <| + t = table_builder [["x", [Decimal.new "23257245345.345345345"]]] + t.at "x" . at 0 . should_be_a Decimal + t.at "x" . get 0 . should_be_a Decimal + group_builder.specify "arithmetic (decimal column and decimal column)" <| t = table_builder [["x", [Decimal.new "23257245345.345345345"]], ["y", [Decimal.new "123e50"]], ["z", [Decimal.new "125e50"]], ["w", [Decimal.new 7513]], ["v", [Decimal.new "3.7"]]] (t.at "x" + t.at "y").to_vector . should_equal [Decimal.new "12300000000000000000000000000000000000000023257245345.345345345"] From 8d6068430447dec68b8b7ac46bf6c9585e81223b Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 16:32:41 -0400 Subject: [PATCH 21/34] arithmetic exception --- .../Table/0.0.0-dev/src/Internal/Storage.enso | 1 + .../map/numeric/arithmetic/BigDecimalDivideOp.java | 7 ++++++- test/Base_Tests/src/Data/Decimal_Spec.enso | 2 ++ .../Column_Operations_Spec.enso | 11 +++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso index 5cd8890561de..f21059e9d378 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Storage.enso @@ -87,6 +87,7 @@ enso_to_java x = case x of `Column`. This step is unnecessary for primitive and builtin values, but necessary for values such as `Decimal`/`BigDecimal`. java_to_enso x = case x of + _ : Nothing -> Nothing _ : BigDecimal -> Decimal.Value x _ -> x diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java index 2ca5b8c0a156..fb6680d5c781 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java @@ -14,6 +14,11 @@ public BigDecimalDivideOp() { @Override public BigDecimal doBigDecimal( BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { - return a.divide(b); + try { + return a.divide(b); + } catch (ArithmeticException e) { + problemAggregator.reportArithmeticError(e.getMessage(), ix); + return null; + } } } diff --git a/test/Base_Tests/src/Data/Decimal_Spec.enso b/test/Base_Tests/src/Data/Decimal_Spec.enso index 5d31eeeb205f..d19c6564d73f 100644 --- a/test/Base_Tests/src/Data/Decimal_Spec.enso +++ b/test/Base_Tests/src/Data/Decimal_Spec.enso @@ -651,6 +651,8 @@ add_specs suite_builder = Decimal.new "12" . div (Decimal.new "0") . should_fail_with Arithmetic_Error + ((Decimal.new "1") / (Decimal.new "3")) . should_fail_with Arithmetic_Error + suite_builder.group "pow" group_builder-> group_builder.specify "should define pow" <| Decimal.new "10" . pow 3 . should_equal 1000 diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index 50228d15fbcb..741e70430a43 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1836,6 +1836,17 @@ add_specs suite_builder setup = (t.at "y" / (Decimal.new "16.5")) . to_vector . should_equal [Decimal.new "57245348.2234235"] (t.at "x" ^ (Decimal.new "2.0")) . to_vector . should_equal [Decimal.new "5.408994610535877E20" . to_float] + group_builder.specify "arithmetic errors" <| + t = table_builder [["x", [Decimal.new "1"]], ["y", [Decimal.new "3"]], ["z", [Decimal.new "0"]]] + + r0 = t.at "x" / t.at "y" + r0 . to_vector . should_equal [Nothing] + Problems.expect_warning Arithmetic_Error r0 + + r1 = t.at "x" / t.at "z" + r1 . to_vector . should_equal [Nothing] + Problems.expect_warning Arithmetic_Error r1 + # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 6c84519b65e0a5e94919aca8a721cee0544e1fc4 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 16:43:12 -0400 Subject: [PATCH 22/34] mod 0 --- distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso | 2 +- .../src/Common_Table_Operations/Column_Operations_Spec.enso | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index a6f3a6e3cfcf..284ddba06a7f 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -138,7 +138,7 @@ type Column Arguments: - java_column: The internal representation of the column. - Value java_column + private Value java_column ## PRIVATE ADVANCED diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index 741e70430a43..86e29d9294d5 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1847,6 +1847,10 @@ add_specs suite_builder setup = r1 . to_vector . should_equal [Nothing] Problems.expect_warning Arithmetic_Error r1 + r2 = t.at "x" % t.at "z" + r2 . to_vector . should_equal [Nothing] + Problems.expect_warning Arithmetic_Error r2 + # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From 1ad53b8a3ab41977e40d9b4935d5be7fd663b441 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 16:47:19 -0400 Subject: [PATCH 23/34] cleanup --- .../column/operation/map/numeric/arithmetic/PowerOp.java | 8 -------- .../map/numeric/helpers/BigDecimalArrayAdapter.java | 1 - 2 files changed, 9 deletions(-) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java index 41c26bd6f353..a2ff5851d043 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/PowerOp.java @@ -1,7 +1,5 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; -import java.math.BigDecimal; - import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; @@ -16,10 +14,4 @@ public double doDouble( double a, double b, int ix, MapOperationProblemAggregator problemAggregator) { return Math.pow(a, b); } - - @Override - public BigDecimal doBigDecimal( - BigDecimal a, BigDecimal b, int ix, MapOperationProblemAggregator problemAggregator) { - throw new UnsupportedOperationException("unimplemented"); - } } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java index 1cc0bccf440d..433f513f794f 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java @@ -41,7 +41,6 @@ static BigDecimalArrayAdapter fromAnyStorage(Storage storage) { }; } - class BigDecimalStorageAsBigDecimal implements BigDecimalArrayAdapter { private final SpecializedStorage storage; From 30a8f92283cbbed59dd93c5548cb18aaa7912831 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 16:51:38 -0400 Subject: [PATCH 24/34] fmt --- .../table/data/column/builder/BigDecimalBuilder.java | 1 - .../column/operation/map/numeric/arithmetic/AddOp.java | 1 - .../map/numeric/arithmetic/BigDecimalDivideOp.java | 1 - .../arithmetic/NumericBinaryOpImplementation.java | 10 ++++------ .../arithmetic/NumericBinaryOpReturningBigDecimal.java | 4 ++-- .../arithmetic/NumericBinaryOpReturningDouble.java | 2 +- .../map/numeric/helpers/BigDecimalArrayAdapter.java | 1 - .../map/numeric/helpers/DoubleArrayAdapter.java | 2 +- .../Column_Operations_Spec.enso | 2 +- 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java b/std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java index 8b87a1f93fb7..e6f56cde11f4 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/builder/BigDecimalBuilder.java @@ -1,7 +1,6 @@ package org.enso.table.data.column.builder; import java.math.BigDecimal; - import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.type.BigDecimalType; diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java index 4c76ec72a2cc..2306ef136ad9 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/AddOp.java @@ -4,7 +4,6 @@ import java.math.BigInteger; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; -import org.enso.table.data.column.storage.numeric.BigDecimalStorage; import org.enso.table.data.column.storage.type.IntegerType; public class AddOp> diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java index fb6680d5c781..0e82753f6524 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java @@ -1,7 +1,6 @@ package org.enso.table.data.column.operation.map.numeric.arithmetic; import java.math.BigDecimal; - import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.storage.Storage; diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java index 2e7315942dd9..d57f5c1bfac0 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpImplementation.java @@ -5,7 +5,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.BitSet; - import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.BinaryMapOperation; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; @@ -46,9 +45,7 @@ public Storage runBinaryMap( case BigIntegerStorage s -> runBigIntegerMap( BigIntegerArrayAdapter.fromStorage(s), rhs, problemAggregator); case BigDecimalStorage s -> runBigDecimalMap( - BigDecimalArrayAdapter.fromStorage(s), - new BigDecimal(rhs), - problemAggregator); + BigDecimalArrayAdapter.fromStorage(s), new BigDecimal(rhs), problemAggregator); case DoubleStorage s -> runDoubleMap(s, rhs.doubleValue(), problemAggregator); default -> throw new IllegalStateException( "Unsupported storage: " + storage.getClass().getCanonicalName()); @@ -62,7 +59,7 @@ public Storage runBinaryMap( BigInteger.valueOf(argAsLong), problemAggregator); case BigDecimalStorage s -> runBigDecimalMap( - BigDecimalArrayAdapter.fromStorage(s), + BigDecimalArrayAdapter.fromStorage(s), BigDecimal.valueOf(argAsLong), problemAggregator); case DoubleStorage s -> runDoubleMap(s, (double) argAsLong, problemAggregator); @@ -85,7 +82,8 @@ public Storage runBinaryMap( "Unsupported storage: " + storage.getClass().getCanonicalName()); }; } else if (arg instanceof BigDecimal bd) { - return runBigDecimalMap(BigDecimalArrayAdapter.fromAnyStorage(storage), bd, problemAggregator); + return runBigDecimalMap( + BigDecimalArrayAdapter.fromAnyStorage(storage), bd, problemAggregator); } else { throw new UnexpectedTypeException("a Number."); } diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java index 0894671ee4f2..cec24ce3687d 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningBigDecimal.java @@ -4,14 +4,14 @@ import java.math.BigDecimal; import java.math.BigInteger; - import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.operation.map.numeric.helpers.BigDecimalArrayAdapter; import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.BigDecimalStorage; -public abstract class NumericBinaryOpReturningBigDecimal> +public abstract class NumericBinaryOpReturningBigDecimal< + T extends Number, I extends Storage> extends NumericBinaryOpImplementation { public NumericBinaryOpReturningBigDecimal(String name) { super(name); diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java index 2787666bca33..d256a9a58a85 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/NumericBinaryOpReturningDouble.java @@ -2,8 +2,8 @@ import static org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter.fromAnyStorage; -import java.math.BigInteger; import java.math.BigDecimal; +import java.math.BigInteger; import org.enso.base.polyglot.NumericConverter; import org.enso.table.data.column.operation.map.MapOperationProblemAggregator; import org.enso.table.data.column.operation.map.numeric.helpers.DoubleArrayAdapter; diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java index 433f513f794f..88f8f6e1bd26 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/BigDecimalArrayAdapter.java @@ -1,7 +1,6 @@ package org.enso.table.data.column.operation.map.numeric.helpers; import java.math.BigDecimal; -import java.math.BigInteger; import org.enso.table.data.column.storage.SpecializedStorage; import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.numeric.AbstractLongStorage; diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java index ba93260ff66a..1807659058bd 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/helpers/DoubleArrayAdapter.java @@ -90,7 +90,7 @@ public int size() { } } - class BigDecimalStorageAsDouble implements DoubleArrayAdapter { + class BigDecimalStorageAsDouble implements DoubleArrayAdapter { private final BigDecimalStorage storage; private BigDecimalStorageAsDouble(BigDecimalStorage storage) { diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index 86e29d9294d5..aca948f03b8c 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -19,7 +19,7 @@ import enso_dev.Base_Tests.Data.Round_Spec from project.Common_Table_Operations.Util import run_default_backend -main filter="Decimal" = run_default_backend add_specs filter +main filter=Nothing = run_default_backend add_specs filter type Data Value ~connection From ca1998a70ba852d5d4ad514a1ae271a6ec1155a8 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Fri, 24 May 2024 16:53:06 -0400 Subject: [PATCH 25/34] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e423969197..b97d885c1d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -667,6 +667,7 @@ - [Added ability to save an existing Postgres connection as a Data Link in Enso Cloud.][9957] - [Improved `Table.union`.][9968] +- [Added support for arithmetic operations on in-memory `Decimal` columns.][9950] [debug-shortcuts]: https://github.com/enso-org/enso/blob/develop/app/gui/docs/product/shortcuts.md#debug @@ -980,6 +981,7 @@ [9879]: https://github.com/enso-org/enso/pull/9879 [9957]: https://github.com/enso-org/enso/pull/9957 [9968]: https://github.com/enso-org/enso/pull/9968 +[9950]: https://github.com/enso-org/enso/pull/9950 #### Enso Compiler From 93f8f4be24c8c3968f2447827dd75e367f5b6f90 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Tue, 28 May 2024 14:18:39 -0400 Subject: [PATCH 26/34] check type first --- distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso index e9434fe385e6..b8ad4472bd64 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Column.enso @@ -90,6 +90,12 @@ type Column Value_Type.Boolean -> False Value_Type.Byte -> False _ -> True + needs_enso_to_java_conversion = case value_type of + Value_Type.Decimal _ _ -> True + Auto -> True + _ -> False + enso_to_java_maybe items = if needs_enso_to_java_conversion.not then items else + items.map enso_to_java expected_storage_type = case value_type of Auto -> Nothing _ -> Storage.from_value_type value_type on_problems=Problem_Behavior.Report_Warning @@ -103,7 +109,7 @@ type Column Invalid_Column_Names.handle_java_exception <| Polyglot_Helpers.handle_polyglot_dataflow_errors <| handle_invalid_value_type <| java_column = Java_Problems.with_problem_aggregator Problem_Behavior.Report_Warning java_problem_aggregator-> case needs_polyglot_conversion of - True -> Java_Column.fromItems name (items.map enso_to_java) expected_storage_type java_problem_aggregator + True -> Java_Column.fromItems name (enso_to_java_maybe items) expected_storage_type java_problem_aggregator False -> Java_Column.fromItemsNoDateConversion name items expected_storage_type java_problem_aggregator result = Column.Value java_column . throw_on_warning Conversion_Failure result.catch Conversion_Failure error-> From 67d2769e616c271a33ac13e9ca387db04ffbb661 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Wed, 29 May 2024 10:00:21 -0400 Subject: [PATCH 27/34] merge --- CHANGELOG.md | 2044 +------------------------------------------------- 1 file changed, 2 insertions(+), 2042 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56f3604ecc80..596792791f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2037 +1,5 @@ # Next Release -#### Visual Environment - -- [Camera is panned to newly created nodes.][3552] -- [Long names on the Node Searcher's list are truncated.][3373] The part of the - name that doesn't fit in the Searcher's window is replaced with an ellipsis - character ("…"). -- [Magnet Alignment algorithm is used while placing new nodes][3366]. When we - find an available free space for a new node, the node gets aligned with the - surrounding nodes horizontally and vertically. This helps to preserve a nice - grid-like layout for all the nodes. -- [Nodes created via the TAB key or by clicking the (+) button on the - screen are now placed below all the selected nodes when more than one node is - selected.][3361] (Previously, they were placed below the first node that was - selected.) This makes it easier to achieve a compact, vertical layout of the - graph. -- [Nodes created near existing nodes via the TAB key or by dropping a - connection are now repositioned and aligned to existing nodes.][3301] This is - to make the resulting graph prettier and avoid overlapping. In such cases, - created nodes will be placed below an existing node or on the bottom-left - diagonal if there is no space underneath. -- [Nodes can be added to the graph by double-clicking the output ports of - existing nodes (or by clicking them with the right mouse button).][3346] -- [Node Searcher preserves its zoom factor.][3327] The visible size of the node - searcher and edited node is now fixed. It simplifies node editing on - non-standard zoom levels. -- [Nodes can be added to the graph by clicking (+) button on the screen][3278]. - The button is in the bottom-left corner. Node is added at the center or pushed - down if the center is already occupied by nodes. -- [Maximum zoom factor is limited to 1.0x if IDE is not in Debug Mode.][3273] -- [Debug Mode for Graph Editor can be activated/deactivated using a - shortcut.][3264] It allows access to a set of restricted features. See - [debug-shortcuts]. -- [New nodes can be created by dragging and dropping a connection on the - scene.][3231] -- [Node connections can be dropped by pressing the Esc key while dragging - them.][3231] -- [Added support of source maps for JS-based visualizations.][3208] -- [Fixed the alignment of newly created nodes to existing nodes with - visualizations enabled.][3361] When applicable, new nodes are now placed below - visualizations. (Previously, they were placed to the left of the - visualizations.) -- [Fixed histograms coloring and added a color legend.][3153] -- [Lazy visualization for scatter plot.][3655] -- [Fixed broken node whose expression contains non-ASCII characters.][3166] -- [Fixed developer console warnings about views being created but not - registered.][3181] -- [Fixed developer console errors related to Language Server (mentioning code - 3003 and "Invalid version"), occurring during project opening and after new - node cration.][3186] -- [Fixed developer console error about failing to decode a notification - "executionContext/visualisationEvaluationFailed"][3193] -- [New Version of the Node Searcher - the Component Browser][3530] The available - methods, atoms and functions are presented in nice, categorized view. The most - popular tools are available at hand. The panel is unstable, and can be - disabled with the `--enable-new-component-browser=false` flag. -- [Fixed error handling during startup.][3648] This prevents entering IDE into a - "zombie" state, where processes were started but not visible to user. They - could cause issues with starting further IDE instances. -- [New nodes are created in the project source when the searcher is opened and a - new node is created.][3645] -- [Proper Polyglot Vector and Array Support][3667] -- [IDE uses new visualization API.][3661] -- [Visualization of long textual values improved][3665] -- [Selecting a suggestion from the searcher or component browser now updates the - visualisation of the edited node to preview the results of applying the - suggestion.][3691] -- [Remove here keyword from IDE.][3749] -- [Shortcut changes:][3823] Pressing `Enter` when no node is edited opens - Component Browser. Entering node shortcut changed to `cmd` + `Enter`. -- [Added support for scrolling by pressing and holding a mouse button on a - scrollbar.][3824] -- [Added scroll bounce animation][3836] which activates when scrolling past the - end of scrollable content. -- [The default text visualisation now loads its content lazily from the - backend][3910]. This means that the visualisation cannot be overwhelmed by - large amounts of data. -- [Added project snapshot saving on shortcut][3923] -- [The color of the displayed project name indicates whether the project's - current state is saved in a snapshot.][3950] The project name is darker when - the project is changed from the last saved snapshot and lighter when the - snapshot matches the current project state. -- [Added shortcut to interrupt the program][3967] -- [Added suggestion dropdown for function arguments][4013]. The dropdown is - present only when the argument is of type that has a predefined set of values. -- [Separate component browser navigator sections for modules imported from - different namespaces][4044] -- [Internal components (private API) are not displayed in the component - browser.][4085] -- [The correct default visualisation for tables is shown on new nodes.][4120] -- [Added restoring of last project snapshot on shortcut.][4050] -- [Added contextual suggestions to argument dropdowns][4072]. Dropdowns will now - contain suggestions which are based on evaluated data. -- [Added a shortcut to show internal components (private API) in the component - browser.][5582] -- [Improved component browser entry filtering and sorting][5645]. The component - browser will now provide suggestions matching either the component's label or - the corresponding code. -- [Improved argument placeholder resolution in more complex expressions][5656]. - It is now possible to drop node connections onto missing arguments of chained - and nested function calls. -- [The component browser suggestions take into account entry aliases][5678]. The - searcher input is now matched to entry aliases too. The alias match is used to - filter and sort component browser entries. -- [The Component Browser icons are cached on texture][5779] improving its - performance on slower machines. -- [Fixed missing result preview when editing nodes.][5757] -- [Application retries its initialization after failures][5802], allowing a - reconnecting after connectivity problems. -- [Improved Component Browser Filtering][4115]. The best match is always - selected first, and the groups are rearranged, so the best matches are on the - bottom. -- [Named arguments syntax is now recognized in IDE][5774]. Connections to - function arguments will now use named argument syntax instead of inserting - wildcards on all preceding arguments. -- [Added boilerplate React app for authorization via Cognito+AWS Amplify][5798]. - This PR adds a React app that renders the dashboard (which has been ported - from the cloud. The dashboard displays a list of projects, and allows users to - open them in the IDE (which is not part of the React app, but can be switched - to from the dashboard). The PR also adds authentication+authorization (i.e., - sign up and sign in for users), via either email/password or GitHub/Google. -- [New Enso documentation parser][5917]. Smaller and faster; enables planned - improvements to internal documentation representation. -- [Dropdown widgets now support custom labels][5705] and automatically generate - shortened labels for entries with long module paths. When an option is - selected from the dropdown, the necessary module imports are inserted, - eliminating the need for fully qualified names. -- [The IDE now has a new UI element for selecting the execution mode of the - project][6130]. -- [Added tooltips to icon buttons][6035] for improved usability. Users can now - quickly understand each button's function. -- [File associations are created on Windows and macOS][6077]. This allows - opening Enso files by double-clicking them in the file explorer. -- [AI-powered code completions][5910]. It is now possible to get AI-powered - completions when using node searcher with Tables. -- [Added capability to create node widgets with complex UI][6347]. Node widgets - such as dropdown can now be placed in the node and affect the code text flow. -- [The IDE UI element for selecting the execution mode of the project is now - sending messages to the backend.][6341]. -- [Feedback when renaming a project][6366]. When the user tries to rename the - project to an invalid name, a helpful error message is shown and the text - field stays the same as to give the user the opportunity to fix the mistake. -- [Area selectionof nodes no longer takes into account the visualisation that - belongs to the node.][6487]. -- [List Editor Widget][6470]. Now you can edit lists by clicking buttons on - nodes or by dragging the elements. -- [Visualisations now show a loading spinner while waiting on data.][6512]. -- [Fixed text visualisations which were being cut off at the last line.][6421] -- [Fixed a bug where, when scrolling or dragging on a full-screen visualization, - the view of the graph changed as well.][6530] -- [Changed the shortcut for restoring to the last saved version of a project - from cmd+r to - cmd+shift+r][6620] to make it less likely - that it would be triggered by accident. As a consequence, the program - execution shortcuts changed from - cmd+shift+t/r to - cmd+alt+t/r. -- [Fixed a bug where selecting a nested breadcrumb would cause the order of - breadcrumbs to change incorrectly.][6617] -- [Changed the shortcut to show the full-screen visualization for a node from - space space to shift+space.][6663] - so that it doesn't interfere with the shortcut for toggling the small - visualization. -- [Cloud dashboard, which supersedes the startup screen][6279]. Features also - added in various other PRs. The new dashboard includes tables for projects, - folders, files and secrets, a list of templates from which new projects can be - created, a user menu, and a search bar. -- [The Application will try to reload file in backend on synchronization - failure][6752]. It should make it more resilient to connectivity issues and - occasional bugs. The reload may be forced by the user with - cmd+shift+x shortcut. -- [When selecting a function from the main module through the component browser, - it is now referenced via the `Main` namespace instead of the project - namespace,][6719] e.g. `Main.func1` instead of `MyProject.func1`. This makes - it robust against project name changes. -- [Added a button to return from an opened project back to the project - dashboard.][6474] -- [Keyboard shortcuts for graph editing are now disabled when the full-screen - visualization is active.][6844] -- [A loading animation is now shown when opening and creating projects][6827], - as the previous behaviour of showing a blank screen while the project was - being loaded was potentially confusing to users. -- [Error message is displayed in the status bar when the backend reports - execution failed][6918]. -- [Performance and readability of documentation panel was improved][6893]. The - documentation is now split into separate pages, which are much smaller. -- [IDE no longer inserts redundant imports when selecting options from dropdown - widgets][7028]. The code was unified with the component browser, and it now - correctly handles reexports and already existing imports. -- [Fixed cursor position when ctrl-clicking the node][7014]. Sometimes - ctrl-clicking to edit the node placed the mouse cursor in the wrong position - in the text. This is fixed now. -- [Added prototype AI Searcher that can be used to create new nodes from natural - language input][7146] -- [Allow visualization resizing][7164]. Now the user can adjust the - visualization size by dragging its right and bottom borders. Visualization - width also follows the node's width, and visualizations are aligned to the - left side of the node. -- [Component Browser was redesigned][7372]. The three columns of groups turned - out to be non-practical, as they give too much information to comprehend. - Also, filtering results was kept in groups making second-best match not easily - available. Therefore, we introduced a new, impler CB design with single - column. -- [Help chat][7151]. The link to the Discord server is replaced with a chat - bridge to the Discord server. This is intended to have the chat visible at the - same time as the IDE, so that help can be much more interactive. -- [New breadcrumbs design][7362]. Breadcrumbs now optionally show the icon of - the item they represent. They also follow the new design of the component - browser. -- [The libraries' authors may put entities to groups by adding GROUP tag in the - docstring]. It was requested as more convenient way than specifying full names - in package.yaml. -- [Graph editor node was redesigned][7311]. Nodes have a color and icon matching - the selected entry in the component browser. Clear separating lines between - method arguments were added. The node selection was made easier with - additional thick interactive selection border. -- [The shortcut for opening Component Browser was changed to - enter][7527] -- [Connections to lamdas are displayed correctly][7550]. It is possible to drag - a connection to any expression inside the lambda body. -- [Atom types in dropdowns do not produce redundant imports][#7670]. The - possibility of imports conflicts is reduced. -- [Copying and pasting a single node][7618]. Using the common - cmd+C and cmd+V shortcuts, it is - now possible to copy a single selected node and paste its code to the graph or - another program. - -[5910]: https://github.com/enso-org/enso/pull/5910 -[6279]: https://github.com/enso-org/enso/pull/6279 -[6421]: https://github.com/enso-org/enso/pull/6421 -[6530]: https://github.com/enso-org/enso/pull/6530 -[6617]: https://github.com/enso-org/enso/pull/6617 -[6620]: https://github.com/enso-org/enso/pull/6620 -[6663]: https://github.com/enso-org/enso/pull/6663 -[6752]: https://github.com/enso-org/enso/pull/6752 -[6719]: https://github.com/enso-org/enso/pull/6719 -[6474]: https://github.com/enso-org/enso/pull/6474 -[6844]: https://github.com/enso-org/enso/pull/6844 -[6827]: https://github.com/enso-org/enso/pull/6827 -[6918]: https://github.com/enso-org/enso/pull/6918 -[6893]: https://github.com/enso-org/enso/pull/6893 -[7028]: https://github.com/enso-org/enso/pull/7028 -[7014]: https://github.com/enso-org/enso/pull/7014 -[7146]: https://github.com/enso-org/enso/pull/7146 -[7151]: https://github.com/enso-org/enso/pull/7151 -[7164]: https://github.com/enso-org/enso/pull/7164 -[7362]: https://github.com/enso-org/enso/pull/7362 -[7372]: https://github.com/enso-org/enso/pull/7372 -[7337]: https://github.com/enso-org/enso/pull/7337 -[7311]: https://github.com/enso-org/enso/pull/7311 -[7527]: https://github.com/enso-org/enso/pull/7527 -[7550]: https://github.com/enso-org/enso/pull/7550 -[7670]: https://github.com/enso-org/enso/pull/7670 -[7618]: https://github.com/enso-org/enso/pull/7618 - -#### EnsoGL (rendering engine) - -- [You can change font and set letters bold in the text::Area - component][3385]. Use the set_font and - set_bold_bytes respectively. -- [Fixed a text rendering issue in nested sublayer][3486]. -- [Added a new component: Grid View.][3588] It's parametrized by Entry object, - display them arranged in a Grid. It does not instantiate all entries, only - those visible, and re-use created entries during scrolling thus achieving - great performance. There are variants of grid view with selection and - highlight, scrollbars, and both. -- [Massive improvements of text rendering performance][3776]. Different text - instances are now reusing the shape shaders and the same sprite system under - the hood. This drastically reduces the amount of required draw calls for - scenes with a lot of text. -- [Text rendering quality improvements][3855]. Glyphs are now hinted in a better - way. Also, additional fine-tuning is performed per font and per host operating - system. -- [Display objects can now emit and receive events in the same style as - JavaScript DOM events][3863]. The events system implements very similar - behavior to the one described here: - https://javascript.info/bubbling-and-capturing. -- [Added a new component: Slider][3852]. It allows adjusting a numeric value - with the mouse. The precision of these adjustments can be increased or - decreased. -- [Slider component functionality improvements][3885]. The slider component now - supports multiple ways to handle out-of-range values. The slider's value can - be edited as text, and a new vertical slider layout is available. -- [Added ProjectsGrid view for Cloud Dashboard][3857]. It provides the first - steps towards migrating the Cloud Dashboard from the existing React (web-only) - implementation towards a shared structure that can be used in both the Desktop - and Web versions of the IDE. -- [Removed Cloud Dashboard][4047]. The Cloud Dashboard was being rewritten in - EnsoGL but after internal discussion we've decided to rewrite it in React, - with a shared implementation between the Desktop and Web versions of the IDE. -- [Added a new component: Dropdown][3985]. A list of selectable labeled entries, - suitable for single and multi-select scenarios. -- [Compile-time shader optimizer was implemented][4003]. It is capable of - extracting non-optimized shaders from the compiled WASM artifacts, running - stand-alone optimization toolchain (glslc, spirv-opt, spirv-cross), and - injecting optimized shaders back to WASM during its initialization process. - Unfortunately, it caused our theme system to stop working correctly, because - generated shaders differ per theme (only light theme is available, the dark - theme has been disabled). We will support multiple themes in the future, but - this is not on our priority list right now. -- [Performance monitor was extended with the ability to print details of actions - performed in a given frame][5895]. In particular, you can now inspect names of - all symbols rendered in a given frame. You can also pause the performance - monitor and inspect results recorded in the past. -- [ToggleButtons can now have tooltips][6035]. -- [Rendering of tooltips was improved.][6097] Their text is now more vertically - centered and the delay before showing them was extended. -- [Accurate GPU performance measurements have been implemented][6595]. It is - possible now to track both the time spent on both the CPU and the GPU sides. -- [Support recovery from GL context loss][7662]. This allows the application to - continue after an interruption to rendering, such as hibernation or movement - of the application window to a display rendered by a different GPU. - -[3857]: https://github.com/enso-org/enso/pull/3857 -[3985]: https://github.com/enso-org/enso/pull/3985 -[4003]: https://github.com/enso-org/enso/pull/4003 -[4047]: https://github.com/enso-org/enso/pull/4047 -[5895]: https://github.com/enso-org/enso/pull/5895 -[6035]: https://github.com/enso-org/enso/pull/6035 -[6097]: https://github.com/enso-org/enso/pull/6097 -[6130]: https://github.com/enso-org/enso/pull/6130 -[6366]: https://github.com/enso-org/enso/pull/6366 -[6341]: https://github.com/enso-org/enso/pull/6341 -[6470]: https://github.com/enso-org/enso/pull/6470 -[6595]: https://github.com/enso-org/enso/pull/6595 -[6487]: https://github.com/enso-org/enso/pull/6487 -[6512]: https://github.com/enso-org/enso/pull/6512 -[7662]: https://github.com/enso-org/enso/pull/7662 - -#### Enso Standard Library - -- [Implemented `Vector.distinct` allowing to remove duplicate elements from a - Vector][3224] -- [Implemented `Duration.time_execution` allowing timing of the execution of an - expression within the UI][3229] -- [Improved performance of `Vector.filter` and `Vector.each`; implemented - `Vector.filter_with_index`. Made `Vector.at` accept negative indices and - ensured it fails with a dataflow error on out of bounds access instead of an - internal Java exception.][3232] -- [Implemented the `Table.select_columns` operation.][3230] -- [Implemented the `Table.remove_columns` and `Table.reorder_columns` - operations.][3240] -- [Implemented the `Table.sort_columns` operation.][3250] -- [Fixed `Vector.sort` to handle tail-recursive comparators][3256] -- [Implemented `Range.find`, `Table.rename_columns` and - `Table.use_first_row_as_names` operations][3249] -- [Implemented `Text.at` and `Text.is_digit` methods][3269] -- [Implemented `Runtime.get_stack_trace` together with some utilities to process - stack traces and code locations][3271] -- [Implemented `Vector.flatten`][3259] -- [Significant performance improvement in `Natural_Order` and new `Faker` - methods added to `Standard.Test`][3276] -- [Implemented `Integer.parse`][3283] -- [Made `Text.compare_to` correctly handle Unicode normalization][3282] -- [Extend `Text.contains` API to support regex and case insensitive - search.][3285] -- [Implemented new `Text.take` and `Text.drop` functions, replacing existing - functions][3287] -- [Implemented new `Text.starts_with` and `Text.ends_with` functions, replacing - existing functions][3292] -- [Implemented `Text.to_case`, replacing `Text.to_lower_case` and - `Text.to_upper_case`][3302] -- [Implemented initial `Table.group_by` function on Standard.Table][3305] -- [Implemented `Text.pad` and `Text.trim`][3309] -- [Updated `Text.repeat` and added `*` operator shorthand][3310] -- [General improved Vector performance and new `Vector.each_with_index`, - `Vector.fold_with_index` and `Vector.take` methods.][3236] -- [Implemented new `Text.insert` method][3311] -- [Implemented `Bool.compare_to` method][3317] -- [Implemented `Map.first`, `Map.last` functions. Expanded `Table.group_by` to - also compute mode, percentile, minimum, maximum.][3318] -- [Implemented `Text.location_of` and `Text.location_of_all` methods.][3324] -- [Replaced `Table.group_by` with `Table.aggregate`][3339] -- [Implemented `Panic.catch` and helper functions for handling errors. Added a - type parameter to `Panic.recover` to recover specific types of errors.][3344] -- [Added warning handling to `Table.aggregate`][3349] -- [Improved performance of `Table.aggregate` and full warnings - implementation][3364] -- [Implemented `Text.reverse`][3377] -- [Implemented support for most Table aggregations in the Database - backend.][3383] -- [Update `Text.replace` to new API.][3393] -- [Add encoding support to `Text.bytes` and `Text.from_bytes`. Renamed and added - encoding to `File.read_text`. New `File.read` API.][3390] -- [Improved the `Range` type. Added a `down_to` counterpart to `up_to` and - `with_step` allowing to change the range step.][3408] -- [Aligned `Text.split` API with other methods and added `Text.lines`.][3415] -- [Implemented a basic reader for the `Delimited` file format.][3424] -- [Implemented a reader for the `Excel` file format.][3425] -- [Added custom encoding support to the `Delimited` file format reader.][3430] -- [Implemented `compute` method on `Vector` for statistics calculations.][3442] -- [Promote get and put to be methods of Ref type rather than of Ref - module][3457] -- [Implemented `Table.parse_values`, parsing text columns according to a - specified type.][3455] -- [Promote with, take, finalize to be methods of Managed_Resource - instance][3460] -- [Implemented automatic type detection for `Table.parse_values`.][3462] -- [Integrated value parsing with the `Delimited` file reader.][3463] -- [Implemented the `Infer` setting for headers in the `Delimited` file format - and made it the default.][3472] -- [Implemented a `Table.from Text` conversion allowing to parse strings - representing `Delimited` files without storing them on the filesystem.][3478] -- [Added rank data, correlation and covariance statistics for `Vector`][3484] -- [Implemented `Table.order_by` for the SQLite backend.][3502] -- [Implemented `Table.order_by` for the PostgreSQL backend.][3514] -- [Implemented `Table.order_by` for the in-memory table.][3515] -- [Renamed `File_Format.Text` to `Plain_Text`, updated `File_Format.Delimited` - API and added builders for customizing less common settings.][3516] -- [Allow control of sort direction in `First` and `Last` aggregations.][3517] -- [Implemented `Text.write`, replacing `File.write_text`.][3518] -- [Removed obsolete `select`, `group`, `sort` and releated types from - tables.][3519] -- [Removed obsolete `from_xls` and `from_xlsx` functions. Added support for - reading column names from first row in `File_Format.Excel`][3523] -- [Added `File_Format.Delimited` support to `Table.write` for new files.][3528] -- [Adjusted `Database.connect` API to new design.][3542] -- [Added `File_Format.Excel` support to `Table.write` for new files.][3551] -- [identity,const,flip,curry,uncurry functions][3554] -- [Added append support for `File_Format.Excel`.][3558] -- [Added support for custom encodings in `File_Format.Delimited` writing.][3564] -- [Allow filtering caught error type in `Error.catch`.][3574] -- [Implemented `Append` mode for `File_Format.Delimited`.][3573] -- [Added `Vector.write_bytes` function and removed old `File.write_bytes`][3583] -- [Added `line_endings` and `comment_character` options to - `File_Format.Delimited`.][3581] -- [Fixed the case of various type names and library paths][3590] -- [Added support for parsing `.pgpass` file and `PG*` environment variables for - the Postgres connection][3593] -- [Added `Regression` to the `Standard.Base` library and removed legacy `Model` - type from `Standard.Table`.][3601] -- [Created `Index_Sub_Range` type and updated `Text.take` and - `Text.drop`.][3617] -- [Added `Vector.from_polyglot_array` to make `Vector`s backed by polyglot - Arrays][3628] -- [Updated `Vector.take` and `Vector.drop` and removed their obsolete - counterparts.][3629] -- [Short-hand syntax for `order_by` added.][3643] -- [Expanded `Table.at` to support index access and added `Table.column_count` - method.][3644] -- [Removed `Array.set_at`.][3634] -- [Added various date part functions to `Date` and `Date_Time`.][3669] -- [Implemented `Table.take` and `Table.drop` for the in-memory backend.][3647] -- [Implemented specialized storage for the in-memory Table.][3673] -- [Implemented `Table.distinct` for the in-memory backend.][3684] -- [Added `databases`, `schemas`, `tables` support to database Connection.][3632] -- [Implemented `start_of` and `end_of` methods for date/time types allowing to - find start and end of a period of time containing the provided time.][3695] -- [Implemented `type_of` and `is_of_type` methods for getting the type of a - value and comparing types, respectively.][3722] -- [Implemented `work_days_until` for counting work dys between dates and - `add_work_days` which allows to shift a date by a number of work days.][3726] -- [Added `query` and `read` functions to Database connections.][3727] -- [Added `Date_Period.Week` to `start_of` and `end_of` methods.][3733] -- [Replaced `Table.where` with a new API relying on `Table.filter`.][3750] -- [Added `Filter_Condition` to `Vector`, `Range` and `List`.][3770] -- [Extended `Filter_Condition` with `Is_Empty`, `Not_Empty`, `Like` and - `Not_Like`.][3775] -- [Reimplemented `Duration` as a built-in type.][3759] -- [Implemented `Table.replace_text` for in-memory table.][3793] -- [Extended `Filter_Condition` with `Is_In` and `Not_In`.][3790] -- [Replaced `Table.drop_missing_rows` with `filter_blank_rows` with an updated - API.][3805] -- [Replaced `Table.drop_missing_columns` with - `Table.remove_columns Column_Selector.Blank_Columns` by adding the new column - selector variant.][3812] -- [Implemented `Table.rows` giving access to a vector of rows.][3827] -- [Define Enso epoch start as 15th October 1582][3804] -- [Implemented `Period` type][3818] -- [Implemented new functions on Column and added expression syntax support to - create derived Columns.][3782] -- [Added support for milli and micro seconds, new short form for rename_columns - and fixed issue with compare_to versus Nothing][3874] -- [Aligned `Text.match`/`Text.locate` API][3841] -- [There is a new API to lazily feed visualisation information to the - IDE.][3910] -- [Added `transpose` and `cross_tab` to the In-Memory Table.][3919] -- [Improvements to JSON, Pair, Statistics and other minor tweaks.][3964] -- [Overhauled the JSON support (now based of JavaScript), `Data.fetch` and other - minor tweaks][3987] -- [Enable Date, Time and DateTime to be read and written to Excel.][3997] -- [Aligning core APIs for Vector, List and Range. Adding some missing functions - to the types.][4026] -- [Implemented `Table.distinct` for Database backends.][4027] -- [Implemented `Table.union` for the in-memory backend.][4052] -- [Implemented `Table.cross_join` and `Table.zip` for the in-memory - backend.][4063] -- [Updated `Text.starts_with`, `Text.ends_with` and `Text.contains` to new - simpler API.][4078] -- [Updated `Table.set` to new API. New `Column.parse` function and added case - sensitivity to `Filter_Condition` and column functions.][4097] -- [Updated column selector APIs and new `Excel_Workbook` type.][5646] -- [Moved regex functionality out of `Text.locate` and `Text.locate_all` into - `Text.match` and `Text.match_all`.][5679] -- [`File.parent` may return `Nothing`.][5699] -- [Removed non-regex functionality from `is_match`, `match`, and `match_all`, - and renamed them to `match`, `find`, `find_all` (respectively).][5721] -- [Updated `rename_columns` to new API. Added `first_row`, `second_row` and - `last_row` to Table types][5719] -- [Introducing `Meta.Type`.][5768] -- [Remove many regex compile flags; separated `match` into `match` and - `match_all`.][5785] -- [Aligned names of columns created by column operations.][5850] -- [Improved `cross_tab`. Renamed `fill_missing` and `is_missing` to - `fill_nothing` and `is_nothing`. Added `fill_empty`.][5863] -- [Removed many regex compile flags from `replace`; added `only_first` and - `use_regex` flag.][5959] -- [Implemented proper support for Value Types in the Table library.][6073] -- [Removed many regex compile flags from `split`; added `only_first` and - `use_regex` flag.][6116] -- [Added `Text.tokenize`][6150] -- [Added support for Date/Time columns in the Postgres backend and added - `year`/`month`/`day` operations to Table columns.][6153] -- [`Text.split` can now take a vector of delimiters.][6156] -- [Add `has_warnings`, `remove_warnings` and `throw_on_warning` extension - methods.][6176] -- [Implemented `Table.union` for the Database backend.][6204] -- [Array & Vector have the same methods & behavior][6218] -- [Implemented `Table.split` and `Table.tokenize` for in-memory tables.][6233] -- [Added `trim` and `replace` to `Column`. Enhanced number parsing with support - for thousands and decimal point automatic detection.][6253] -- [Implemented `Table.parse_text_to_table`.][6294] -- [Added `Table.parse_to_columns`.][6383] -- [Added parsing methods for `Integer`, `Decimal`, `Json`, `Date`, `Date_Time`, - `Time_Of_Day`, `Time_Zone`, and `URI` to `Text`.][6404] -- [Implemented `create_database_table` allowing upload of in-memory - tables.][6429] -- [Added execution context control to writing files and dry run capabilities to - `Text.write`.][6459] -- [Implemented `create_database_table` allowing saving queries as database - tables.][6467] -- [Implemented `Column.format` for in-memory `Column`s.][6538] -- [Added `at_least_one` flag to `Table.tokenize_to_rows`.][6539] -- [Moved `Redshift` connector into a separate `AWS` library.][6550] -- [Added `Date_Range`.][6621] -- [Implemented the `cast` operation for `Table` and `Column`.][6711] -- [Added `.round` and `.int` to `Integer` and `Decimal`.][6743] -- [Added `.round`, `.truncate`, `.ceil`, and `.floor` to `Column`.][6817] -- [Added execution control to `Table.write` and various bug fixes.][6835] -- [Implemented `Table.add_row_number`.][6890] -- [Handling edge cases in rounding.][6922] -- [Split `Table.create_database_table` into `Connection.create_table` and - `Table.select_into_database_table`.][6925] -- [Speed improvements to `Column` `.truncate`, `.ceil`, and `.floor`.][6941] -- [Implemented addition and subtraction for `Date_Period` and - `Time_Period`.][6956] -- [Added AWS credential support and initial S3 list buckets API.][6973] -- [Added `round`, `ceil`, `floor`, `truncate` to the In-Database Column type] - [6988] -- [Implemented `Table.update_database_table`.][7035] -- [Removed `module` argument from `enso_project` and other minor tweaks.][7052] -- [Integrated Database write operations with Execution Contexts.][7072] -- [`Column.fill_nothing` and `.fill_empty` no longer rename the column. Added - `Table.fill_nothing` and `.fill_empty`.][7166] -- [Implemented `add_row_number` for Database tables.][7174] -- [Added `replace` to in-memory table. Changed replace for `Text`, in-memory - `Column`, and in-memory `Table` to take a `Regex` in addition to a `Text`.] - [7223] -- [Added `cross_join` support to database tables.][7234] -- [Improving date/time support in Table - added `date_diff`, `date_add`, - `date_part` and some shorthands. Extended `Time_Period` with milli-, micro- - and nanosecond periods.][7221] -- [Implemented `replace` on database columns.][7275] -- [Retire `Column_Selector` and allow regex based selection of columns.][7295] -- [`Text.parse_to_table` can take a `Regex`.][7297] -- [Expose `Text.normalize`.][7425] -- [Implemented new value types (various sizes of `Integer` type, fixed-length - and length-limited `Char` type) for the in-memory `Table` backend.][7557] -- [Introducing generic `Any.to` conversion method][7704] -- [Added `take` and `drop` to database tables.][7615] -- [Added ability to specify expected value type in `Column.from_vector`, - `Column.map` and `Column.zip`.][7637] -- [Added `delete_rows` method to Database Table, changed the - `update_database_table` API into `update_rows`.][7709] -- [Added `Data.post` method to write to HTTP endpoints.][7700] -- [Added support for S3. Using `Input_Stream` more for reading.][7776] -- [Renamed `Decimal` to `Float`.][7807] -- [Implemented `Date_Time_Formatter` for more user-friendly date/time format - parsing.][7826] -- [Added `Table.expand_column` and improved JSON deserialization.][7859] -- [Implemented `Table.auto_value_types` for in-memory tables.][7908] -- [Implemented Text.substring to easily select part of a Text field][7913] -- [Implemented new selector for when parameter in `filter_blank_rows`, - `select_blank_columns`, `remove_blank_columns`][7935] -- [Implemented basic XML support][7947] -- [Implemented `Table.lookup_and_replace` for the in-memory backend.][7979] -- [Added `Column_Operation` to `Table.set` allowing for more streamlined flow of - deriving column values in the GUI.][8005] -- [Implemented `Table.expand_to_rows` for the in-memory backend.][8029] -- [Added XML support for `.to Table` and `.expand_column`.][8083] -- [Added `Previous_Value` option to `fill_nothing` and `fill_empty`.][8105] -- [Added `Table.format` for the in-memory backend.][8150] -- [Implemented truncate `Date_Time` for database backend (Postgres only).][8235] -- [Initial Enso Cloud APIs.][8006] -- [Renamed `replace` to `text_replace` and renamed `lookup_and_replace` to - `merge` on `Table`.][8564] -- [Errors thrown inside `map` are wrapped in `Map_Error`.][8307] -- [Support for loading big Excel files.][8403] -- [Added new `Filter_Condition`s - `Equal_Ignore_Case`, `Is_Nan`, `Is_Infinite` - and `Is_Finite`.][8539] -- [Support `on_problems=Problem_Behavior.Report_Warning` in `Vector.map`.][8595] -- [Added text_length to Column][8606] -- [Added none delimiter option for Data.Read][8627] -- [Added text_left and text_right to Column][8691] -- [Implement relational `NULL` semantics for `Nothing` for in-memory `Column` - operations.][8816] -- [Implement relational `NULL` semantics for `Nothing` for in-memory `Table` - join operations.][8849] -- [Attach a warning when Nothing is used as a value in a comparison or `is_in` - `Filter_Condition`.][8865] -- [Added `File_By_Line` type allowing processing a file line by line. New faster - JSON parser based off Jackson.][8719] -- [Implemented `Table.replace` for the in-memory backend.][8935] -- [Allow removing rows using a Filter_Condition.][8861] -- [Added `Table.to_xml`.][8979] -- [Implemented Write support for `S3_File`.][8921] -- [Implemented `Table.replace` for the database backend.][8986] -- [Separate `Group_By` from `columns` into new argument on `aggregate`.][9027] -- [Allow `copy_to` and `move_to` to work between local and S3 files.][9054] -- [Adjusted expression handling and new `Simple_Expression` type.][9128] -- [Allow reading Data Links configured locally or in the Cloud.][9215] -- [Allow using `enso://` paths in `Data.read` and other places.][9225] -- [Update the XML methods and add more capabilities to document.][9233] -- [Added `Data.download` and a few other changes.][9249] -- [Implement Data Links to Postgres (accessing a DB connection or a table - directly)][9269] -- [Added `Xml_Document.write`][9299] -- [Added `select_by_type` and `remove_by_type` to `Table` and `DB_Table`][9334] -- [Make File./ only accept Text][9330] -- [Implemented Excel Data Link][9346] -- [Added Table.running][9346] -- [Added Google_Analytics.Read][9239] -- [Added `Table.from_union` to allow expanding a vector of tables in one - step][9343] -- [Implemented constructors, comparisons, and arithmetic for a `Decimal` - type.][9272] -- [Allow `Table.replace` to take mutiple target columns.][9406] -- [Initial Snowflake Support - ability to read and query, not a completed - dialect yet.][9435] -- [Make expand_to_rows, expand_column support Rows, Tables, Column data - types][9533] -- [Data Link for `Enso_File`.][9525] -- [Added `pow`, `remainder`, and `div` to `Decimal`.][9566] -- [Implemented `.to_integer`, `.to_float`, and `from` conversions for - `Decimal`][9462] -- [Made `Integer.%` consistent across all `Integer` values.][9589] -- [Added `Decimal.parse` and `.format`.][9637] -- [Added `Decimal.abs`, `.negate` and `.signum`.][9641] -- [Added `Decimal.min` and `.max`.][9663] -- [Added `Decimal.round`.][9672] -- [Implemented write support for Enso Cloud files.][9686] -- [Added `Integer.to_decimal` and `Float.to_decimal`.][9716] -- [Added `Decimal.floor`, `.ceil`, and `.trunc`.][9694] -- [Added `recursive` option to `File.delete`.][9719] -- [Added `Vector.build`.][9725] -- [Added `Table.running` method][9577] -- [Added `Excel_Workbook.read_many` allowing reading more than one sheet at a - time.][9759] -- [Added ability to write to Data Links.][9750] -- [Added `Vector.build_multiple`, and better for support for errors and warnings - inside `Vector.build` and `Vector.build_multiple`.][9766] -- [Added `Vector.duplicates`.][9917] -- [Log operations performed on a Postgres database connection obtained through a - Data Link.][9873] -- [Added `Text.cleanse` `Column.Text_Cleanse` and `Table.Text_Cleanse`][9879] -- [Added ability to save an existing Postgres connection as a Data Link in Enso - Cloud.][9957] -- [Improved `Table.union`.][9968] -- [Added support for arithmetic operations on in-memory `Decimal` columns.][9950] -- [Add `day_of_week` and `day_of_year` to `Column`.][10081] - -[debug-shortcuts]: - https://github.com/enso-org/enso/blob/develop/app/gui/docs/product/shortcuts.md#debug -[3153]: https://github.com/enso-org/enso/pull/3153 -[3655]: https://github.com/enso-org/enso/pull/3655 -[3166]: https://github.com/enso-org/enso/pull/3166 -[3181]: https://github.com/enso-org/enso/pull/3181 -[3186]: https://github.com/enso-org/enso/pull/3186 -[3193]: https://github.com/enso-org/enso/pull/3193 -[3208]: https://github.com/enso-org/enso/pull/3208 -[3224]: https://github.com/enso-org/enso/pull/3224 -[3229]: https://github.com/enso-org/enso/pull/3229 -[3231]: https://github.com/enso-org/enso/pull/3231 -[3232]: https://github.com/enso-org/enso/pull/3232 -[3230]: https://github.com/enso-org/enso/pull/3230 -[3240]: https://github.com/enso-org/enso/pull/3240 -[3250]: https://github.com/enso-org/enso/pull/3250 -[3256]: https://github.com/enso-org/enso/pull/3256 -[3249]: https://github.com/enso-org/enso/pull/3249 -[3264]: https://github.com/enso-org/enso/pull/3264 -[3269]: https://github.com/enso-org/enso/pull/3269 -[3271]: https://github.com/enso-org/enso/pull/3271 -[3259]: https://github.com/enso-org/enso/pull/3259 -[3273]: https://github.com/enso-org/enso/pull/3273 -[3276]: https://github.com/enso-org/enso/pull/3276 -[3278]: https://github.com/enso-org/enso/pull/3278 -[3283]: https://github.com/enso-org/enso/pull/3283 -[3282]: https://github.com/enso-org/enso/pull/3282 -[3285]: https://github.com/enso-org/enso/pull/3285 -[3287]: https://github.com/enso-org/enso/pull/3287 -[3292]: https://github.com/enso-org/enso/pull/3292 -[3301]: https://github.com/enso-org/enso/pull/3301 -[3302]: https://github.com/enso-org/enso/pull/3302 -[3305]: https://github.com/enso-org/enso/pull/3305 -[3309]: https://github.com/enso-org/enso/pull/3309 -[3310]: https://github.com/enso-org/enso/pull/3310 -[3316]: https://github.com/enso-org/enso/pull/3316 -[3236]: https://github.com/enso-org/enso/pull/3236 -[3311]: https://github.com/enso-org/enso/pull/3311 -[3317]: https://github.com/enso-org/enso/pull/3317 -[3318]: https://github.com/enso-org/enso/pull/3318 -[3324]: https://github.com/enso-org/enso/pull/3324 -[3327]: https://github.com/enso-org/enso/pull/3327 -[3339]: https://github.com/enso-org/enso/pull/3339 -[3344]: https://github.com/enso-org/enso/pull/3344 -[3346]: https://github.com/enso-org/enso/pull/3346 -[3349]: https://github.com/enso-org/enso/pull/3349 -[3361]: https://github.com/enso-org/enso/pull/3361 -[3364]: https://github.com/enso-org/enso/pull/3364 -[3373]: https://github.com/enso-org/enso/pull/3373 -[3377]: https://github.com/enso-org/enso/pull/3377 -[3366]: https://github.com/enso-org/enso/pull/3366 -[3379]: https://github.com/enso-org/enso/pull/3379 -[3381]: https://github.com/enso-org/enso/pull/3381 -[3391]: https://github.com/enso-org/enso/pull/3391 -[3383]: https://github.com/enso-org/enso/pull/3383 -[3385]: https://github.com/enso-org/enso/pull/3385 -[3392]: https://github.com/enso-org/enso/pull/3392 -[3393]: https://github.com/enso-org/enso/pull/3393 -[3390]: https://github.com/enso-org/enso/pull/3390 -[3408]: https://github.com/enso-org/enso/pull/3408 -[3415]: https://github.com/enso-org/enso/pull/3415 -[3424]: https://github.com/enso-org/enso/pull/3424 -[3425]: https://github.com/enso-org/enso/pull/3425 -[3430]: https://github.com/enso-org/enso/pull/3430 -[3442]: https://github.com/enso-org/enso/pull/3442 -[3457]: https://github.com/enso-org/enso/pull/3457 -[3455]: https://github.com/enso-org/enso/pull/3455 -[3460]: https://github.com/enso-org/enso/pull/3460 -[3462]: https://github.com/enso-org/enso/pull/3462 -[3463]: https://github.com/enso-org/enso/pull/3463 -[3472]: https://github.com/enso-org/enso/pull/3472 -[3486]: https://github.com/enso-org/enso/pull/3486 -[3478]: https://github.com/enso-org/enso/pull/3478 -[3484]: https://github.com/enso-org/enso/pull/3484 -[3502]: https://github.com/enso-org/enso/pull/3502 -[3514]: https://github.com/enso-org/enso/pull/3514 -[3515]: https://github.com/enso-org/enso/pull/3515 -[3516]: https://github.com/enso-org/enso/pull/3516 -[3517]: https://github.com/enso-org/enso/pull/3517 -[3518]: https://github.com/enso-org/enso/pull/3518 -[3519]: https://github.com/enso-org/enso/pull/3519 -[3523]: https://github.com/enso-org/enso/pull/3523 -[3528]: https://github.com/enso-org/enso/pull/3528 -[3530]: https://github.com/enso-org/enso/pull/3530 -[3542]: https://github.com/enso-org/enso/pull/3542 -[3551]: https://github.com/enso-org/enso/pull/3551 -[3552]: https://github.com/enso-org/enso/pull/3552 -[3554]: https://github.com/enso-org/enso/pull/3554 -[3558]: https://github.com/enso-org/enso/pull/3558 -[3564]: https://github.com/enso-org/enso/pull/3564 -[3574]: https://github.com/enso-org/enso/pull/3574 -[3573]: https://github.com/enso-org/enso/pull/3573 -[3583]: https://github.com/enso-org/enso/pull/3583 -[3581]: https://github.com/enso-org/enso/pull/3581 -[3588]: https://github.com/enso-org/enso/pull/3588 -[3590]: https://github.com/enso-org/enso/pull/3590 -[3593]: https://github.com/enso-org/enso/pull/3593 -[3601]: https://github.com/enso-org/enso/pull/3601 -[3617]: https://github.com/enso-org/enso/pull/3617 -[3628]: https://github.com/enso-org/enso/pull/3628 -[3629]: https://github.com/enso-org/enso/pull/3629 -[3632]: https://github.com/enso-org/enso/pull/3632 -[3641]: https://github.com/enso-org/enso/pull/3641 -[3643]: https://github.com/enso-org/enso/pull/3643 -[3644]: https://github.com/enso-org/enso/pull/3644 -[3645]: https://github.com/enso-org/enso/pull/3645 -[3648]: https://github.com/enso-org/enso/pull/3648 -[3661]: https://github.com/enso-org/enso/pull/3661 -[3665]: https://github.com/enso-org/enso/pull/3665 -[3634]: https://github.com/enso-org/enso/pull/3634 -[3667]: https://github.com/enso-org/enso/pull/3667 -[3669]: https://github.com/enso-org/enso/pull/3669 -[3647]: https://github.com/enso-org/enso/pull/3647 -[3673]: https://github.com/enso-org/enso/pull/3673 -[3684]: https://github.com/enso-org/enso/pull/3684 -[3691]: https://github.com/enso-org/enso/pull/3691 -[3695]: https://github.com/enso-org/enso/pull/3695 -[3722]: https://github.com/enso-org/enso/pull/3722 -[3726]: https://github.com/enso-org/enso/pull/3726 -[3727]: https://github.com/enso-org/enso/pull/3727 -[3733]: https://github.com/enso-org/enso/pull/3733 -[3749]: https://github.com/enso-org/enso/pull/3749 -[3750]: https://github.com/enso-org/enso/pull/3750 -[3770]: https://github.com/enso-org/enso/pull/3770 -[3775]: https://github.com/enso-org/enso/pull/3775 -[3759]: https://github.com/enso-org/enso/pull/3759 -[3793]: https://github.com/enso-org/enso/pull/3793 -[3790]: https://github.com/enso-org/enso/pull/3790 -[3805]: https://github.com/enso-org/enso/pull/3805 -[3812]: https://github.com/enso-org/enso/pull/3812 -[3823]: https://github.com/enso-org/enso/pull/3823 -[3827]: https://github.com/enso-org/enso/pull/3827 -[3824]: https://github.com/enso-org/enso/pull/3824 -[3804]: https://github.com/enso-org/enso/pull/3804 -[3818]: https://github.com/enso-org/enso/pull/3818 -[3776]: https://github.com/enso-org/enso/pull/3776 -[3855]: https://github.com/enso-org/enso/pull/3855 -[3836]: https://github.com/enso-org/enso/pull/3836 -[3782]: https://github.com/enso-org/enso/pull/3782 -[3863]: https://github.com/enso-org/enso/pull/3863 -[3874]: https://github.com/enso-org/enso/pull/3874 -[3852]: https://github.com/enso-org/enso/pull/3852 -[3841]: https://github.com/enso-org/enso/pull/3841 -[3885]: https://github.com/enso-org/enso/pull/3885 -[3910]: https://github.com/enso-org/enso/pull/3910 -[3919]: https://github.com/enso-org/enso/pull/3919 -[3923]: https://github.com/enso-org/enso/pull/3923 -[3950]: https://github.com/enso-org/enso/pull/3950 -[3964]: https://github.com/enso-org/enso/pull/3964 -[3967]: https://github.com/enso-org/enso/pull/3967 -[3987]: https://github.com/enso-org/enso/pull/3987 -[3878]: https://github.com/enso-org/enso/pull/3878 -[3997]: https://github.com/enso-org/enso/pull/3997 -[4013]: https://github.com/enso-org/enso/pull/4013 -[4026]: https://github.com/enso-org/enso/pull/4026 -[4027]: https://github.com/enso-org/enso/pull/4027 -[4044]: https://github.com/enso-org/enso/pull/4044 -[4052]: https://github.com/enso-org/enso/pull/4052 -[4063]: https://github.com/enso-org/enso/pull/4063 -[4078]: https://github.com/enso-org/enso/pull/4078 -[4085]: https://github.com/enso-org/enso/pull/4085 -[4097]: https://github.com/enso-org/enso/pull/4097 -[4115]: https://github.com/enso-org/enso/pull/4115 -[4120]: https://github.com/enso-org/enso/pull/4120 -[4050]: https://github.com/enso-org/enso/pull/4050 -[4072]: https://github.com/enso-org/enso/pull/4072 -[5582]: https://github.com/enso-org/enso/pull/5582 -[5645]: https://github.com/enso-org/enso/pull/5645 -[5646]: https://github.com/enso-org/enso/pull/5646 -[5656]: https://github.com/enso-org/enso/pull/5656 -[5678]: https://github.com/enso-org/enso/pull/5678 -[5679]: https://github.com/enso-org/enso/pull/5679 -[5699]: https://github.com/enso-org/enso/pull/5699 -[5719]: https://github.com/enso-org/enso/pull/5719 -[5721]: https://github.com/enso-org/enso/pull/5721 -[5757]: https://github.com/enso-org/enso/pull/5757 -[5768]: https://github.com/enso-org/enso/pull/5768 -[5774]: https://github.com/enso-org/enso/pull/5774 -[5779]: https://github.com/enso-org/enso/pull/5779 -[5785]: https://github.com/enso-org/enso/pull/5785 -[5798]: https://github.com/enso-org/enso/pull/5798 -[5802]: https://github.com/enso-org/enso/pull/5802 -[5850]: https://github.com/enso-org/enso/pull/5850 -[5863]: https://github.com/enso-org/enso/pull/5863 -[5917]: https://github.com/enso-org/enso/pull/5917 -[5705]: https://github.com/enso-org/enso/pull/5705 -[5959]: https://github.com/enso-org/enso/pull/5959 -[6073]: https://github.com/enso-org/enso/pull/6073 -[6116]: https://github.com/enso-org/enso/pull/6116 -[6150]: https://github.com/enso-org/enso/pull/6150 -[6153]: https://github.com/enso-org/enso/pull/6153 -[6156]: https://github.com/enso-org/enso/pull/6156 -[6176]: https://github.com/enso-org/enso/pull/6176 -[6204]: https://github.com/enso-org/enso/pull/6204 -[6077]: https://github.com/enso-org/enso/pull/6077 -[6218]: https://github.com/enso-org/enso/pull/6218 -[6233]: https://github.com/enso-org/enso/pull/6233 -[6253]: https://github.com/enso-org/enso/pull/6253 -[6294]: https://github.com/enso-org/enso/pull/6294 -[6383]: https://github.com/enso-org/enso/pull/6383 -[6404]: https://github.com/enso-org/enso/pull/6404 -[6347]: https://github.com/enso-org/enso/pull/6347 -[6429]: https://github.com/enso-org/enso/pull/6429 -[6459]: https://github.com/enso-org/enso/pull/6459 -[6467]: https://github.com/enso-org/enso/pull/6467 -[6538]: https://github.com/enso-org/enso/pull/6538 -[6539]: https://github.com/enso-org/enso/pull/6539 -[6550]: https://github.com/enso-org/enso/pull/6550 -[6621]: https://github.com/enso-org/enso/pull/6621 -[6711]: https://github.com/enso-org/enso/pull/6711 -[6743]: https://github.com/enso-org/enso/pull/6743 -[6817]: https://github.com/enso-org/enso/pull/6817 -[6835]: https://github.com/enso-org/enso/pull/6835 -[6890]: https://github.com/enso-org/enso/pull/6890 -[6922]: https://github.com/enso-org/enso/pull/6922 -[6925]: https://github.com/enso-org/enso/pull/6925 -[6941]: https://github.com/enso-org/enso/pull/6941 -[6956]: https://github.com/enso-org/enso/pull/6956 -[6973]: https://github.com/enso-org/enso/pull/6973 -[6988]: https://github.com/enso-org/enso/pull/6988 -[7035]: https://github.com/enso-org/enso/pull/7035 -[7052]: https://github.com/enso-org/enso/pull/7052 -[7072]: https://github.com/enso-org/enso/pull/7072 -[7166]: https://github.com/enso-org/enso/pull/7166 -[7174]: https://github.com/enso-org/enso/pull/7174 -[7223]: https://github.com/enso-org/enso/pull/7223 -[7234]: https://github.com/enso-org/enso/pull/7234 -[7221]: https://github.com/enso-org/enso/pull/7221 -[7275]: https://github.com/enso-org/enso/pull/7275 -[7295]: https://github.com/enso-org/enso/pull/7295 -[7297]: https://github.com/enso-org/enso/pull/7297 -[7425]: https://github.com/enso-org/enso/pull/7425 -[7557]: https://github.com/enso-org/enso/pull/7557 -[7704]: https://github.com/enso-org/enso/pull/7704 -[7615]: https://github.com/enso-org/enso/pull/7615 -[7637]: https://github.com/enso-org/enso/pull/7637 -[7700]: https://github.com/enso-org/enso/pull/7700 -[7709]: https://github.com/enso-org/enso/pull/7709 -[7776]: https://github.com/enso-org/enso/pull/7776 -[7807]: https://github.com/enso-org/enso/pull/7807 -[7826]: https://github.com/enso-org/enso/pull/7826 -[7859]: https://github.com/enso-org/enso/pull/7859 -[7908]: https://github.com/enso-org/enso/pull/7908 -[7913]: https://github.com/enso-org/enso/pull/7913 -[7935]: https://github.com/enso-org/enso/pull/7935 -[7947]: https://github.com/enso-org/enso/pull/7947 -[7979]: https://github.com/enso-org/enso/pull/7979 -[8005]: https://github.com/enso-org/enso/pull/8005 -[8006]: https://github.com/enso-org/enso/pull/8006 -[8029]: https://github.com/enso-org/enso/pull/8029 -[8083]: https://github.com/enso-org/enso/pull/8083 -[8105]: https://github.com/enso-org/enso/pull/8105 -[8150]: https://github.com/enso-org/enso/pull/8150 -[8235]: https://github.com/enso-org/enso/pull/8235 -[8307]: https://github.com/enso-org/enso/pull/8307 -[8403]: https://github.com/enso-org/enso/pull/8403 -[8539]: https://github.com/enso-org/enso/pull/8539 -[8564]: https://github.com/enso-org/enso/pull/8564 -[8595]: https://github.com/enso-org/enso/pull/8595 -[8606]: https://github.com/enso-org/enso/pull/8606 -[8627]: https://github.com/enso-org/enso/pull/8627 -[8691]: https://github.com/enso-org/enso/pull/8691 -[8719]: https://github.com/enso-org/enso/pull/8719 -[8816]: https://github.com/enso-org/enso/pull/8816 -[8849]: https://github.com/enso-org/enso/pull/8849 -[8865]: https://github.com/enso-org/enso/pull/8865 -[8935]: https://github.com/enso-org/enso/pull/8935 -[8861]: https://github.com/enso-org/enso/pull/8861 -[8921]: https://github.com/enso-org/enso/pull/8921 -[8979]: https://github.com/enso-org/enso/pull/8979 -[8986]: https://github.com/enso-org/enso/pull/8986 -[9027]: https://github.com/enso-org/enso/pull/9027 -[9054]: https://github.com/enso-org/enso/pull/9054 -[9128]: https://github.com/enso-org/enso/pull/9128 -[9215]: https://github.com/enso-org/enso/pull/9215 -[9225]: https://github.com/enso-org/enso/pull/9225 -[9233]: https://github.com/enso-org/enso/pull/9233 -[9239]: https://github.com/enso-org/enso/pull/9239 -[9249]: https://github.com/enso-org/enso/pull/9249 -[9269]: https://github.com/enso-org/enso/pull/9269 -[9272]: https://github.com/enso-org/enso/pull/9272 -[9299]: https://github.com/enso-org/enso/pull/9299 -[9330]: https://github.com/enso-org/enso/pull/9330 -[9334]: https://github.com/enso-org/enso/pull/9334 -[9346]: https://github.com/enso-org/enso/pull/9346 -[9382]: https://github.com/enso-org/enso/pull/9382 -[9343]: https://github.com/enso-org/enso/pull/9343 -[9406]: https://github.com/enso-org/enso/pull/9406 -[9435]: https://github.com/enso-org/enso/pull/9435 -[9462]: https://github.com/enso-org/enso/pull/9462 -[9533]: https://github.com/enso-org/enso/pull/9533 -[9525]: https://github.com/enso-org/enso/pull/9525 -[9566]: https://github.com/enso-org/enso/pull/9566 -[9589]: https://github.com/enso-org/enso/pull/9589 -[9637]: https://github.com/enso-org/enso/pull/9637 -[9641]: https://github.com/enso-org/enso/pull/9641 -[9663]: https://github.com/enso-org/enso/pull/9663 -[9672]: https://github.com/enso-org/enso/pull/9672 -[9686]: https://github.com/enso-org/enso/pull/9686 -[9694]: https://github.com/enso-org/enso/pull/9694 -[9716]: https://github.com/enso-org/enso/pull/9716 -[9719]: https://github.com/enso-org/enso/pull/9719 -[9725]: https://github.com/enso-org/enso/pull/9725 -[9759]: https://github.com/enso-org/enso/pull/9759 -[9577]: https://github.com/enso-org/enso/pull/9577 -[9750]: https://github.com/enso-org/enso/pull/9750 -[9766]: https://github.com/enso-org/enso/pull/9766 -[9917]: https://github.com/enso-org/enso/pull/9917 -[9873]: https://github.com/enso-org/enso/pull/9873 -[9879]: https://github.com/enso-org/enso/pull/9879 -[9957]: https://github.com/enso-org/enso/pull/9957 -[9968]: https://github.com/enso-org/enso/pull/9968 -[9950]: https://github.com/enso-org/enso/pull/9950 -[10081]: https://github.com/enso-org/enso/pull/10081 - -#### Enso Compiler - -- [Added overloaded `from` conversions.][3227] -- [Upgraded to Graal VM 21.3.0][3258] -- [Added the ability to decorate values with warnings.][3248] -- [Fixed issues related to constructors' default arguments][3330] -- [Fixed compiler issue related to module cache.][3367] -- [Fixed execution of defaulted arguments of Atom Constructors][3358] -- [Converting Enso Date to java.time.LocalDate and back][3559] -- [Incremental Reparsing of a Simple Edits][3508] -- [Functions with all-defaulted arguments now execute automatically][3414] -- [Provide `tagValues` for function arguments in the language server][3422] -- [Delay construction of Truffle nodes to speed initialization][3429] -- [Frgaal compiler integration to allow for latest Java constructs][3421] -- [Support for Chrome developer tools --inspect option][3432] -- [Move Builtin Types and Methods definitions to stdlib][3363] -- [Reduce boilerplate by generating BuiltinMethod nodes from simple method - signatures][3444] -- [Generate boilerplate classes related to error handling and varargs in - builtins from method signatures][3454] -- [Avoid needless concatenations of warning/error messages][3465] -- [Added a full-blown DSL for builtins][3471] -- [Integration of Enso with Ideal Graph Visualizer][3533] -- [Lazy evaluation of RHS argument for || and &&][3492] -- [Drop Core implementation of IR][3512] -- [Replace `this` with `self`][3524] -- [Introduce a smaller version of the standard library, just for testing][3531] -- [Remove `here` and make method name resolution case-sensitive][3531] -- [Explicit `self`][3569] -- [Added benchmarking tool for the language server][3578] -- [Support module imports using a qualified name][3608] -- [Using parser written in Rust.][3611] -- [Enable caching in visualisation functions][3618] -- [Update Scala compiler and libraries][3631] -- [Support importing module methods][3633] -- [Support Autosave for open buffers][3637] -- [Generate native-image for engine-runner][3638] -- [Support pattern matching on constants][3641] -- [Builtin Date_Time, Time_Of_Day and Zone types for better polyglot - support][3658] -- [Implement new specification of data types: `type` has a runtime - representation, every atom has a type][3671] -- [main = "Hello World!" is valid Enso sample][3696] -- [Invalidate module's IR cache if imported module changed][3703] -- [Don't rename imported Main module that only imports names][3710] -- [Notify node status to the IDE][3729] -- [Make instance methods callable like statics][3764] -- [Distinguish static and instance methods][3740] -- [By-type pattern matching][3742] -- [Fix performance of method calls on polyglot arrays][3781] -- [Improved support for static and non-static builtins][3791] -- [Missing foreign language generates proper Enso error][3798] -- [Connecting IGV 4 Enso with Engine sources][3810] -- [Made Vector performance to be on par with Array][3811] -- [Introduced IO Permission Contexts][3828] -- [Accept Array-like object seamlessly in builtins][3817] -- [Initialize Builtins at Native Image build time][3821] -- [Split Atom suggestion entry to Type and Constructor][3835] -- [Any number can be converted to double][3865] -- [Update to GraalVM 22.3.0][3663] -- [Connecting IGV 4 Enso with Engine sources][3810] -- [Add the `Self` keyword referring to current type][3844] -- [Support VCS for projects in Language Server][3851] -- [Support multiple exports of the same module][3897] -- [Import modules' extension methods only with unqualified imports][3906] -- [Support expression evaluation in chromeinspector console][3941] -- [Don't export polyglot symbols][3915] -- [From/all import must not include module in name resolution][3931] -- [Vector returns warnings of individual elements][3938] -- [Enso.getMetaObject, Type.isMetaInstance and Meta.is_a consolidation][3949] -- [Add executionContext/interrupt API command][3952] -- [Any.== is a builtin method][3956] -- [Simplify exception handling for polyglot exceptions][3981] -- [Simplify compilation of nested patterns][4005] -- [IGV can jump to JMH sources & more][4008] -- [Basic support of VSCode integration][4014] -- [Sync language server with file system after VCS restore][4020] -- [`ArrayOverBuffer` behaves like an `Array` and `Array.sort` no longer sorts in - place][4022] -- [Implement hashing functionality for all objects][3878] -- [Introducing Meta.atom_with_hole][4023] -- [Report failures in name resolution in type signatures][4030] -- [Attach visualizations to sub-expressions][4048] -- [Add Meta.get_annotation method][4049] -- [Resolve Fully Qualified Names][4056] -- [Optimize Atom storage layouts][3862] -- [Make instance methods callable like statics for builtin types][4077] -- [Convert large longs to doubles, safely, for host calls][4099] -- [Consistent ordering with comparators][4067] -- [Profile engine startup][4110] -- [Report type of polyglot values][4111] -- [Engine can now recover from serialization failures][5591] -- [Use sbt runEngineDistribution][5609] -- [Update to GraalVM 22.3.1][5602] -- [Cache library bindings to optimize import/export resolution][5700] -- [Comparators support partial ordering][5778] -- [Merge ordered and unordered comparators][5845] -- [Use SHA-1 for calculating hashes of modules' IR and bindings][5791] -- [Don't install Python component on Windows][5900] -- [Detect potential name conflicts between exported types and FQNs][5966] -- [Ensure calls involving warnings remain instrumented][6067] -- [One can define lazy atom fields][6151] -- [Replace IOContexts with Execution Environment and generic Context][6171] -- [Vector.sort handles incomparable types][5998] -- [Removing need for asynchronous thread to execute ResourceManager - finalizers][6335] -- [Warning.get_all returns only unique warnings][6372] -- [Reimplement `enso_project` as a proper builtin][6352] -- [Limit number of reported warnings per value][6577] -- [Experimental support for Espresso Java interpreter][6966] -- [Suggestions are updated only when the type of the expression changes][6755] -- [Add project creation time to project metadata][6780] -- [Upgrade GraalVM to 22.3.1 JDK17][6750] -- [Ascribed types are checked during runtime][6790] -- [Add compiler pass that discovers ambiguous and duplicated symbols][6868] -- [Improve and colorize compiler's diagnostic messages][6931] -- [Execute some runtime commands synchronously to avoid race conditions][6998] -- [Automatic conversion for runtime checked arguments][7009] -- [Scala 2.13.11 update][7010] -- [Add special handling for static method calls on Any][7033] -- [Improve parallel execution of commands and jobs in Language Server][7042] -- [Added retries when executing GraalVM updater][7079] -- [Add method call info for infix operators][7090] -- [`executionComplete` response is sent on successful execution only][7143] -- [Send info about function values][7168] -- [Cache dataflow errors][7193] -- [Add endpoint for downloading a project][7291] -- [Update to GraalVM 23.0.0][7176] -- [Using official BigInteger support][7420] -- [Allow users to give a project other than Upper_Snake_Case name][7397] -- [Support renaming variable or function][7515] -- [Replace custom logging service with off the shelf library][7559] -- [Only use types as State keys][7585] -- [Allow Java Enums in case of branches][7607] -- [Notification about the project rename action][7613] -- [Use `numpy` & co. from Enso!][7678] -- [Changed layout of local libraries directory, making it easier to reference - projects next to each other][7634] -- [Support runtime checks of intersection types][7769] -- [Merge `Small_Integer` and `Big_Integer` types][7636] -- [Inline type ascriptions][7796] -- [Always persist `TRACE` level logs to a file][7825] -- [Meta.instrument & Instrumentor API][7833] -- [Downloadable VSCode extension][7861] -- [New `project/status` route for reporting LS state][7801] -- [Add Enso-specific assertions][7883] -- [Modules can be `private`][7840] -- [HTTPS and WSS support in Language Server][7937] -- [Export of non-existing symbols results in error][7960] -- [Upgrade GraalVM to 23.1.0 JDK21][7991] -- [Added opt-in type checks of return type][8502] -- [Introduce Arrow language][8512] -- [DataflowError.withoutTrace doesn't store stacktrace][8608] -- [Derive --in-project from --run source location][8775] -- [Binary operator resolution based on that value][8779] -- [Add run_google_report method][8907] -- [Execute and debug individual Enso files in VSCode extension][8923] -- [Check type of `self` when calling a method using the static syntax][8867] -- [Autoscoped constructors][9190] -- [Allow Oracle GraalVM JDK][9322] -- [`Table.join` can access its `right` argument][9410] -- [Atom constructors can be project-private][9692] - -[3227]: https://github.com/enso-org/enso/pull/3227 -[3248]: https://github.com/enso-org/enso/pull/3248 -[3258]: https://github.com/enso-org/enso/pull/3258 -[3330]: https://github.com/enso-org/enso/pull/3330 -[3358]: https://github.com/enso-org/enso/pull/3358 -[3360]: https://github.com/enso-org/enso/pull/3360 -[3367]: https://github.com/enso-org/enso/pull/3367 -[3559]: https://github.com/enso-org/enso/pull/3559 -[3508]: https://github.com/enso-org/enso/pull/3508 -[3412]: https://github.com/enso-org/enso/pull/3412 -[3414]: https://github.com/enso-org/enso/pull/3414 -[3417]: https://github.com/enso-org/enso/pull/3417 -[3422]: https://github.com/enso-org/enso/pull/3422 -[3429]: https://github.com/enso-org/enso/pull/3429 -[3421]: https://github.com/enso-org/enso/pull/3421 -[3432]: https://github.com/enso-org/enso/pull/3432 -[3363]: https://github.com/enso-org/enso/pull/3363 -[3444]: https://github.com/enso-org/enso/pull/3444 -[3453]: https://github.com/enso-org/enso/pull/3453 -[3454]: https://github.com/enso-org/enso/pull/3454 -[3461]: https://github.com/enso-org/enso/pull/3461 -[3465]: https://github.com/enso-org/enso/pull/3465 -[3471]: https://github.com/enso-org/enso/pull/3471 -[3533]: https://github.com/enso-org/enso/pull/3533 -[3492]: https://github.com/enso-org/enso/pull/3492 -[3493]: https://github.com/enso-org/enso/pull/3493 -[3505]: https://github.com/enso-org/enso/pull/3505 -[3512]: https://github.com/enso-org/enso/pull/3512 -[3524]: https://github.com/enso-org/enso/pull/3524 -[3531]: https://github.com/enso-org/enso/pull/3531 -[3562]: https://github.com/enso-org/enso/pull/3562 -[3538]: https://github.com/enso-org/enso/pull/3538 -[3569]: https://github.com/enso-org/enso/pull/3569 -[3578]: https://github.com/enso-org/enso/pull/3578 -[3611]: https://github.com/enso-org/enso/pull/3611 -[3618]: https://github.com/enso-org/enso/pull/3618 -[3608]: https://github.com/enso-org/enso/pull/3608 -[3608]: https://github.com/enso-org/enso/pull/3608 -[3631]: https://github.com/enso-org/enso/pull/3631 -[3633]: https://github.com/enso-org/enso/pull/3633 -[3637]: https://github.com/enso-org/enso/pull/3637 -[3638]: https://github.com/enso-org/enso/pull/3638 -[3641]: https://github.com/enso-org/enso/pull/3641 -[3658]: https://github.com/enso-org/enso/pull/3658 -[3671]: https://github.com/enso-org/enso/pull/3671 -[3696]: https://github.com/enso-org/enso/pull/3696 -[3703]: https://github.com/enso-org/enso/pull/3703 -[3710]: https://github.com/enso-org/enso/pull/3710 -[3729]: https://github.com/enso-org/enso/pull/3729 -[3740]: https://github.com/enso-org/enso/pull/3740 -[3764]: https://github.com/enso-org/enso/pull/3764 -[3742]: https://github.com/enso-org/enso/pull/3742 -[3781]: https://github.com/enso-org/enso/pull/3781 -[3791]: https://github.com/enso-org/enso/pull/3791 -[3798]: https://github.com/enso-org/enso/pull/3798 -[3810]: https://github.com/enso-org/enso/pull/3810 -[3811]: https://github.com/enso-org/enso/pull/3811 -[3817]: https://github.com/enso-org/enso/pull/3817 -[3821]: https://github.com/enso-org/enso/pull/3821 -[3828]: https://github.com/enso-org/enso/pull/3828 -[3835]: https://github.com/enso-org/enso/pull/3835 -[3865]: https://github.com/enso-org/enso/pull/3865 -[3663]: https://github.com/enso-org/enso/pull/3663 -[3810]: https://github.com/enso-org/enso/pull/3810 -[3844]: https://github.com/enso-org/enso/pull/3844 -[3851]: https://github.com/enso-org/enso/pull/3851 -[3862]: https://github.com/enso-org/enso/pull/3862 -[3897]: https://github.com/enso-org/enso/pull/3897 -[3906]: https://github.com/enso-org/enso/pull/3906 -[3941]: https://github.com/enso-org/enso/pull/3941 -[3915]: https://github.com/enso-org/enso/pull/3915 -[3931]: https://github.com/enso-org/enso/pull/3931 -[3938]: https://github.com/enso-org/enso/pull/3938 -[3949]: https://github.com/enso-org/enso/pull/3949 -[3952]: https://github.com/enso-org/enso/pull/3952 -[3956]: https://github.com/enso-org/enso/pull/3956 -[3981]: https://github.com/enso-org/enso/pull/3981 -[4005]: https://github.com/enso-org/enso/pull/4005 -[4008]: https://github.com/enso-org/enso/pull/4008 -[4014]: https://github.com/enso-org/enso/pull/4014 -[4020]: https://github.com/enso-org/enso/pull/4020 -[4022]: https://github.com/enso-org/enso/pull/4022 -[4023]: https://github.com/enso-org/enso/pull/4023 -[4030]: https://github.com/enso-org/enso/pull/4030 -[4048]: https://github.com/enso-org/enso/pull/4048 -[4049]: https://github.com/enso-org/enso/pull/4049 -[4056]: https://github.com/enso-org/enso/pull/4056 -[4067]: https://github.com/enso-org/enso/pull/4067 -[4077]: https://github.com/enso-org/enso/pull/4077 -[4099]: https://github.com/enso-org/enso/pull/4099 -[4110]: https://github.com/enso-org/enso/pull/4110 -[4111]: https://github.com/enso-org/enso/pull/4111 -[5591]: https://github.com/enso-org/enso/pull/5591 -[5609]: https://github.com/enso-org/enso/pull/5609 -[5602]: https://github.com/enso-org/enso/pull/5602 -[5700]: https://github.com/enso-org/enso/pull/5700 -[5778]: https://github.com/enso-org/enso/pull/5778 -[5845]: https://github.com/enso-org/enso/pull/5845 -[5791]: https://github.com/enso-org/enso/pull/5791 -[5900]: https://github.com/enso-org/enso/pull/5900 -[5966]: https://github.com/enso-org/enso/pull/5966 -[5998]: https://github.com/enso-org/enso/pull/5998 -[6067]: https://github.com/enso-org/enso/pull/6067 -[6151]: https://github.com/enso-org/enso/pull/6151 -[6171]: https://github.com/enso-org/enso/pull/6171 -[6335]: https://github.com/enso-org/enso/pull/6335 -[6372]: https://github.com/enso-org/enso/pull/6372 -[6352]: https://github.com/enso-org/enso/pull/6352 -[6577]: https://github.com/enso-org/enso/pull/6577 -[6966]: https://github.com/enso-org/enso/pull/6966 -[6750]: https://github.com/enso-org/enso/pull/6750 -[6755]: https://github.com/enso-org/enso/pull/6755 -[6780]: https://github.com/enso-org/enso/pull/6780 -[6790]: https://github.com/enso-org/enso/pull/6790 -[6868]: https://github.com/enso-org/enso/pull/6868 -[6931]: https://github.com/enso-org/enso/pull/6931 -[6998]: https://github.com/enso-org/enso/pull/6998 -[7009]: https://github.com/enso-org/enso/pull/7009 -[7010]: https://github.com/enso-org/enso/pull/7010 -[7033]: https://github.com/enso-org/enso/pull/7033 -[7042]: https://github.com/enso-org/enso/pull/7042 -[7079]: https://github.com/enso-org/enso/pull/7079 -[7090]: https://github.com/enso-org/enso/pull/7090 -[7143]: https://github.com/enso-org/enso/pull/7143 -[7168]: https://github.com/enso-org/enso/pull/7168 -[7176]: https://github.com/enso-org/enso/pull/7176 -[7193]: https://github.com/enso-org/enso/pull/7193 -[7291]: https://github.com/enso-org/enso/pull/7291 -[7420]: https://github.com/enso-org/enso/pull/7420 -[7397]: https://github.com/enso-org/enso/pull/7397 -[7515]: https://github.com/enso-org/enso/pull/7515 -[7559]: https://github.com/enso-org/enso/pull/7559 -[7585]: https://github.com/enso-org/enso/pull/7585 -[7607]: https://github.com/enso-org/enso/pull/7607 -[7613]: https://github.com/enso-org/enso/pull/7613 -[7678]: https://github.com/enso-org/enso/pull/7678 -[7634]: https://github.com/enso-org/enso/pull/7634 -[7769]: https://github.com/enso-org/enso/pull/7769 -[7636]: https://github.com/enso-org/enso/pull/7636 -[7796]: https://github.com/enso-org/enso/pull/7796 -[7801]: https://github.com/enso-org/enso/pull/7801 -[7825]: https://github.com/enso-org/enso/pull/7825 -[7833]: https://github.com/enso-org/enso/pull/7833 -[7861]: https://github.com/enso-org/enso/pull/7861 -[7883]: https://github.com/enso-org/enso/pull/7883 -[7840]: https://github.com/enso-org/enso/pull/7840 -[7937]: https://github.com/enso-org/enso/pull/7937 -[7960]: https://github.com/enso-org/enso/pull/7960 -[7991]: https://github.com/enso-org/enso/pull/7991 -[8502]: https://github.com/enso-org/enso/pull/8502 -[8512]: https://github.com/enso-org/enso/pull/8512 -[8608]: https://github.com/enso-org/enso/pull/8608 -[8775]: https://github.com/enso-org/enso/pull/8775 -[8779]: https://github.com/enso-org/enso/pull/8779 -[8907]: https://github.com/enso-org/enso/pull/8907 -[8923]: https://github.com/enso-org/enso/pull/8923 -[8867]: https://github.com/enso-org/enso/pull/8867 -[9190]: https://github.com/enso-org/enso/pull/9190 -[9322]: https://github.com/enso-org/enso/pull/9322 -[9692]: https://github.com/enso-org/enso/pull/9692 -[9410]: https://github.com/enso-org/enso/pull/9410 - -# Enso 2.0.0-alpha.18 (2021-10-12) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.30][engine-0.2.31]. If you're interested - in the enhancements and fixes made to the Enso compiler, you can find their - release notes - [here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Fixed freezing after inactivity.][1776] When the IDE window was minimized or - covered by other windows or invisible for any other reason for a duration - around one minute or longer then it would often be frozen for some seconds on - return. Now it is possible to interact with the IDE instantly, no matter how - long it had been inactive. - -
- -[1776]: https://github.com/enso-org/ide/pull/1776 - -# Enso 2.0.0-alpha.17 (2021-09-23) - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Correct handling of command-line flags.][1815] Command line arguments of the - form `--backend=false` or `--backend false` are now handled as expected and - turn off the "backend" option. The same fix has been applied to all other - boolean command-line options as well. -- [Visualizations will be attached after project is ready.][1825] This addresses - a rare issue when initially opened visualizations were automatically closed - rather than filled with data. - -
- -[1815]: https://github.com/enso-org/ide/pull/1815 -[1825]: https://github.com/enso-org/ide/pull/1825 - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.30][engine-0.2.30]. If you're interested - in the enhancements and fixes made to the Enso compiler, you can find their - release notes - [here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[engine-0.2.30]: https://github.com/enso-org/enso/blob/develop/RELEASES.md - -# Enso 2.0.0-alpha.16 (2021-09-16) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Auto-layout for new nodes.][1755] When a node is selected and a new node gets - created below using Tab then the new node is automatically - positioned far enough to the right to find sufficient space and avoid - overlapping with existing nodes. - -[1755]: https://github.com/enso-org/ide/pull/1755 - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.29][engine-0.2.29]. If you're interested - in the enhancements and fixes made to the Enso compiler, you can find their - release notes - [here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[engine-0.2.29]: https://github.com/enso-org/enso/blob/develop/RELEASES.md - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Sharp rendering on screens with fractional pixel ratios.][1820] - -[1820]: https://github.com/enso-org/ide/pull/1820 - -
- -# Enso 2.0.0-alpha.15 (2021-09-09) - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Fixed parsing of the `--no-data-gathering` command line option.][1831] Flag's - name has been changed to `--data-gathering`, so now `--data-gathering=false` - and `--data-gathering=true` are supported as well. - -[1831]: https://github.com/enso-org/ide/pull/1831 - -# Enso 2.0.0-alpha.14 (2021-09-02) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Visualization previews are disabled.][1817] Previously, hovering over a - node's output port for more than four seconds would temporarily reveal the - node's visualization. This behavior is disabled now. - -[1817]: https://github.com/enso-org/ide/pull/1817 - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.28][1829]. If you're interested in the - enhancements and fixes made to the Enso compiler, you can find their release - notes [here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[1829]: https://github.com/enso-org/ide/pull/1829 - -# Enso 2.0.0-alpha.13 (2021-08-27) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.27][1811]. If you're interested in the - enhancements and fixes made to the Enso compiler, you can find their release - notes [here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[1811]: https://github.com/enso-org/ide/pull/1811 - -# Enso 2.0.0-alpha.12 (2021-08-13) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Improvements to visualization handling][1804]. These improvements are fixing - possible performance issues around attaching and detaching visualizations. -- [GeoMap visualization will ignore points with `null` coordinates][1775]. Now - the presence of such points in the dataset will not break initial map - positioning. - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.26][1801]. If you're interested in the - enhancements and fixes made to the Enso compiler, you can find their release - notes [here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[1801]: https://github.com/enso-org/ide/pull/1801 -[1775]: https://github.com/enso-org/ide/pull/1775 -[1798]: https://github.com/enso-org/ide/pull/1798 -[1804]: https://github.com/enso-org/ide/pull/1804 - -# Enso 2.0.0-alpha.11 (2021-08-09) - -This update contains major performance improvements and exposes new privacy user -settings. We will work towards stabilizing it in the next weeks in order to make -these updates be shipped in a stable release before the end of the year. - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [New look of open project dialog][1700]. Now it has a "Open project" title at - the top. -- [Documentation coments are displayed next to the nodes.][1744]. - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.22][1762]. If you are interested in the - enhancements and fixes made to the Enso compiler, you can find out more - details in - [the engine release notes](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Fixed a bug where edited node expression was sometimes altered.][1743] When - editing node expression, the changes were occasionally reverted, or the - grayed-out parameter names were added to the actual expression.
- -[1700]: https://github.com/enso-org/ide/pull/1700 -[1742]: https://github.com/enso-org/ide/pull/1742 -[1726]: https://github.com/enso-org/ide/pull/1762 -[1743]: https://github.com/enso-org/ide/pull/1743 -[1744]: https://github.com/enso-org/ide/pull/1744 - -# Enso 2.0.0-alpha.10 (2021-07-23) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.15][1710]. If you're interested in the - enhancements and fixes made to the Enso compiler, you can find out more - details in - [the engine release notes](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -
- -[1710]: https://github.com/enso-org/ide/pull/1710 - -# Enso 2.0.0-alpha.9 (2021-07-16) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Improved undo-redo][1653]. Node selection, enabling/disabling visualisations - and entering a node are now affected by undo/redo and are restored on project - startup. - -
- -[1640]: https://github.com/enso-org/ide/pull/1653 - -# Enso 2.0.0-alpha.8 (2021-06-09) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.12][1640]. If you're interested in the - enhancements and fixes made to the Enso compiler, you can find out more - details in - [the engine release notes](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[1640]: https://github.com/enso-org/ide/pull/1640 - -
- -# Enso 2.0.0-alpha.7 (2021-06-06) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [User Authentication][1653]. Users can sign in to Enso using Google, GitHub or - email accounts. - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Fix node selection bug ][1664]. Fix nodes not being deselected correctly in - some circumstances. This would lead to nodes moving too fast when dragged - [1650] or the internal state of the project being inconsistent [1626]. - -[1653]: https://github.com/enso-org/ide/pull/1653 -[1664]: https://github.com/enso-org/ide/pull/1664 - -
- -# Enso 2.0.0-alpha.6 (2021-06-28) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Profling mode.][1546] The IDE contains a profiling mode now which can be - entered through a button in the top-right corner or through the keybinding - ctrl+p. This mode does not display any information yet. - In the future, it will display the running times of nodes and maybe more - useful statistics. -- [Area selection][1588]. You can now select multiple nodes at once. Just click - and drag on the background of your graph and see the beauty of the area - selection appear. -- [Opening projects in application graphical interface][1587]. Press `cmd`+`o` - to bring the list of projects. Select a project on the list to open it. -- [Initial support for undo-redo][1602]. Press cmd+z to - undo last action and cmd+z to redo last undone action. - This version of undo redo does not have proper support for text editor and - undoing UI changes (like selecting nodes). - -#### EnsoGL (rendering engine) - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Nodes in graph no longer overlap panels][1577]. The Searcher, project name, - breadcrumbs and status bar are displayed "above" nodes. - -#### Enso Compiler - -[1588]: https://github.com/enso-org/ide/pull/1588 -[1577]: https://github.com/enso-org/ide/pull/1577 -[1587]: https://github.com/enso-org/ide/pull/1587 -[1602]: https://github.com/enso-org/ide/pull/1602 -[1602]: https://github.com/enso-org/ide/pull/1664 -[1602]: https://github.com/enso-org/ide/pull/1650 -[1602]: https://github.com/enso-org/ide/pull/1626 - -# Enso 2.0.0-alpha.5 (2021-05-14) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Create New Project action in Searcher][1566]. When you bring the searcher - with tab having no node selected, a new action will be available next to the - examples and code suggestions: `Create New Project`. When you choose it by - clicking with mouse or selecting and pressing enter, a new unnamed project - will be created and opened in the application. Then you can give a name to - this project. -- [Signed builds.][1366] Our builds are signed and will avoid warnings from the - operating system about being untrusted. - -#### EnsoGL (rendering engine) - -- [Components for picking numbers and ranges.][1524]. We now have some internal - re-usable UI components for selecting numbers or a range. Stay tuned for them - appearing in the IDE. - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Delete key will delete selected nodes][1538]. Only the non-intuitive - backspace key was assigned to this action before. -- [It is possible to move around after deleting a node with a selected - visualization][1556]. Deleting a node while its attached visualization was - selected made it impossible to pan or zoom around the stage afterwards. This - error is fixed now. -- [Fixed an internal error that would make the IDE fail on some browser.][1561]. - Instead of crashing on browser that don't support the feature we use, we are - now just start a little bit slower. - -#### Enso Compiler - -- [Updated Enso engine to version 0.2.11][1541]. - -If you're interested in the enhancements and fixes made to the Enso compiler, -you can find their release notes -[here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[1366]: https://github.com/enso-org/ide/pull/1366 -[1541]: https://github.com/enso-org/ide/pull/1541 -[1538]: https://github.com/enso-org/ide/pull/1538 -[1524]: https://github.com/enso-org/ide/pull/1524 -[1556]: https://github.com/enso-org/ide/pull/1556 -[1561]: https://github.com/enso-org/ide/pull/1561 -[1566]: https://github.com/enso-org/ide/pull/1566 - -
- -# Enso 2.0.0-alpha.4 (2021-05-04) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Window management buttons.][1511]. The IDE now has components for - "fullscreen" and "close" buttons. They will when running IDE in a cloud - environment where no native window buttons are available. -- [Customizable backend options][1531]. When invoking Enso IDE through command - line interface, it is possible to add the `--` argument separator. All - arguments following the separator will be passed to the backend. -- [Added `--verbose` parameter][1531]. If `--verbose` is given as command line - argument, the IDE and the backend will produce more detailed logs. - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Some command line arguments were not applied correctly in the IDE][1536]. - Some arguments were not passed correctly to the IDE leading to erroneous - behavior or appearance of the electron app. This is now fixed. - -#### Enso Compiler - -If you're interested in the enhancements and fixes made to the Enso compiler, -you can find their release notes -[here](https://github.com/enso-org/enso/blob/develop/RELEASES.md). - -[1511]: https://github.com/enso-org/ide/pull/1511 -[1536]: https://github.com/enso-org/ide/pull/1536 -[1531]: https://github.com/enso-org/ide/pull/1531 - -
- -# Enso 2.0.0-alpha.3 (2020-04-13) - -
![New Learning Resources](/docs/assets/tags/new_learning_resources.svg) - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [The status bar reports connectivity issues][1316]. The IDE maintains a - connection to the Enso Language Server. If this connection is lost, any - unsaved and further work will be lost. In this build we have added a - notification in the status bar to signal that the connection has been lost and - that the IDE must be restarted. In future, the IDE will try to automatically - reconnect. -- [Visualizations can now be maximised to fill the screen][1355] by selecting - the node and pressing space twice. To quit this view, press space again. -- [Visualizations are previewed when you hover over an output port.][1363] There - is now a quick preview for visualizations and error descriptions. Hovering - over a node output will first show a tooltip with the type information and - then, after some time, will show the visualization of the node. This preview - visualization will be located above other nodes, whereas the normal view, will - be shown below nodes. Errors will show the preview visualization immediately. - Nodes without type information will also show the visualization immediately. - You can enter a quick preview mode by pressing ctrl (or command on macOS), - which will show the preview visualization immediately when hovering above a - node's output port. -- [Database Visualizations][1335]. Visualizations for the Database library have - been added. The Table visualization now automatically executes the underlying - query to display its results as a table. In addition, the SQL Query - visualization allows the user to see the query that is going to be run against - the database. -- [Histogram and Scatter Plot now support Dataframes.][1377] The `Table` and - `Column` datatypes are properly visualized. Scatter Plot can display points of - different colors, shapes and sizes, all as defined by the data within the - `Table`. -- [Many small visual improvements.][1419] See the source issue for more details. -- The dark theme is officially supported now. You can start the IDE with the - `--theme=dark` option to enable it. -- You can hide the node labels with the `--no-node-labels` option. This is - useful when creating demo videos. -- [Added a Heatmap visualization.][1438] Just as for the Scatter Plot, it - supports visualizing `Table`, but also `Vector`. -- [Add a background to the status bar][1447]. -- [Display breadcrumbs behind nodes and other objects][1471]. -- [Image visualization.][1367]. Visualizations for the Enso Image library. Now - you can display the `Image` type and a string with an image encoded in base64. - The histogram visualization has been adjusted, allowing you to display the - values of the precomputed bins, which is useful when the dataset is relatively - big, and it's cheaper to send the precomputed bins rather than the entire - dataset. -- [Output type labels.][1427] The labels, that show the output type of a node on - hover, appear now in a fixed position right below the node, instead of a - pop-up, as they did before. - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [Not adding spurious imports][1209]. Fixed cases where the IDE was adding - unnecessary library imports when selecting hints from the node searcher. This - makes the generated textual code much easier to read, and reduces the - likelihood of accidental name collisions. -- [Hovering over an output port shows a pop-up with the result type of a - node][1312]. This allows easy discovery of the result type of a node, which - can help with both debugging and development. -- [Visualizations can define the context for preprocessor evaluation][1291]. - Users can now decide which module's context should be used for visualization - preprocessor. This allows providing visualizations with standard library - functionalities or defining utilities that are shared between multiple - visualizations. -- [Fixed an issue with multiple instances of the IDE running.][1314] This fixes - an issue where multiple instances of the IDE (or even other applications) - could lead to the IDE not working. -- [Allow JS to log arbitrary objects.][1313] Previously using `console.log` in a - visualisation or during development would crash the IDE. Now it correctly logs - the string representation of the object. This is great for debugging custom - visualizations. -- [Fix the mouse cursor offset on systems with fractional display - scaling][1064]. The cursor now works with any display scaling, instead of - there being an offset between the visible cursor and the cursor selection. -- [Disable area selection][1318]. The area selection was visible despite being - non-functional. To avoid confusion, area selection has been disabled until it - is [correctly implemented][479]. -- [Fix an error after adding a node][1332]. Sometimes, after picking a - suggestion, the inserted node was spuriously annotated with "The name could - not be found" error. -- [Handle syntax errors in custom-defined visualizations][1341]. The IDE is now - able to run properly, even if some of the custom visualizations inside a - project contain syntax errors. -- [Fix issues with pasting multi-line text into single-line text fields][1348]. - The line in the copied text will be inserted and all additional lines will be - ignored. -- [Users can opt out of anonymous data gathering.][1328] This can be done with - the `--no-data-gathering` command-line flag when starting the IDE. -- [Provide a theming API for JavaScript visualizations][1358]. It is now - possible to use the Enso theming engine while developing custom visualizations - in JavaScript. You can query it for all IDE colors, including the colors used - to represent types. -- [You can now start the IDE service without a window again.][1353] The command - line argument `--no-window` now starts all the required backend services - again, and prints the port on the command line. This allows you to open the - IDE in a web browser of your choice. -- [JS visualizations have gestures consistent with the IDE][1291]. Panning and - zooming now works just as expected using both a trackpad and mouse. -- [Running `watch` command works on first try.][1395]. Running the build command - `run watch` would fail if it was run as the first command on a clean - repository. This now works. -- [The `inputType` field of visualizations is actually taken into - consideration][1384]. The visualization chooser shows only the entries that - work properly for the node's output type. -- [Fix applying the output of the selected node to the expression of a new - node][1385]. For example, having selected a node with `Table` output and - adding a new node with expression `at "x" == "y"`, the selected node was - applied to the right side of `==`: `at "x" == operator1."y"` instead of - `operator1.at "x" == "y"`. -- [`Enso_Project.data` is visible in the searcher][1393]. -- [The Geo Map visualization recognizes columns regardless of the case of their - name][1392]. This allows visualizing tables with columns like `LONGITUDE` or - `Longitude`, where previously only `longitude` was recognized. -- [It is possible now to switch themes][1390]. Additionally, the theme manager - was integrated with the FRP event engine, which has been a long-standing issue - in the IDE. Themes management was exposed to JavaScript with the - `window.theme` variable. It is even possible to change and develop themes live - by editing theme variables directly in the Chrome Inspector. Use the following - command to give this a go: - `theme.snapshot("t1"); theme.get("t1").interactiveMode()`. -- [The active visualization is highlighted.][1412] Now it is clearly visible - when the mouse events are passed to the visualization. -- [Fixed an issue where projects containing certain language constructs failed - to load.][1413] -- [Fixed a case where IDE could lose connection to the backend after some - time.][1428] -- [Improved the performance of the graph editor, particularly when opening a - project for the first time.][1445] - -#### EnsoGL (rendering engine) - -- [Unified shadow generation][1411]. Added a toolset to create shadows for - arbitrary UI components. - -#### Enso Compiler - -If you're interested in the enhancements and fixes made to the Enso compiler, -you can find their release notes -[here](https://github.com/enso-org/enso/blob/develop/RELEASES.md#enso-0210-2021-04-07). - -[1064]: https://github.com/enso-org/ide/pull/1064 -[1209]: https://github.com/enso-org/ide/pull/1209 -[1291]: https://github.com/enso-org/ide/pull/1291 -[1311]: https://github.com/enso-org/ide/pull/1311 -[1313]: https://github.com/enso-org/ide/pull/1313 -[1314]: https://github.com/enso-org/ide/pull/1314 -[1316]: https://github.com/enso-org/ide/pull/1316 -[1318]: https://github.com/enso-org/ide/pull/1318 -[1328]: https://github.com/enso-org/ide/pull/1328 -[1355]: https://github.com/enso-org/ide/pull/1355 -[1332]: https://github.com/enso-org/ide/pull/1332 -[1341]: https://github.com/enso-org/ide/pull/1341 -[1341]: https://github.com/enso-org/ide/pull/1341 -[1348]: https://github.com/enso-org/ide/pull/1348 -[1353]: https://github.com/enso-org/ide/pull/1353 -[1395]: https://github.com/enso-org/ide/pull/1395 -[1363]: https://github.com/enso-org/ide/pull/1363 -[1384]: https://github.com/enso-org/ide/pull/1384 -[1385]: https://github.com/enso-org/ide/pull/1385 -[1390]: https://github.com/enso-org/ide/pull/1390 -[1392]: https://github.com/enso-org/ide/pull/1392 -[1393]: https://github.com/enso-org/ide/pull/1393 -[479]: https://github.com/enso-org/ide/issues/479 -[1335]: https://github.com/enso-org/ide/pull/1335 -[1358]: https://github.com/enso-org/ide/pull/1358 -[1377]: https://github.com/enso-org/ide/pull/1377 -[1411]: https://github.com/enso-org/ide/pull/1411 -[1412]: https://github.com/enso-org/ide/pull/1412 -[1419]: https://github.com/enso-org/ide/pull/1419 -[1413]: https://github.com/enso-org/ide/pull/1413 -[1428]: https://github.com/enso-org/ide/pull/1428 -[1438]: https://github.com/enso-org/ide/pull/1438 -[1367]: https://github.com/enso-org/ide/pull/1367 -[1445]: https://github.com/enso-org/ide/pull/1445 -[1447]: https://github.com/enso-org/ide/pull/1447 -[1471]: https://github.com/enso-org/ide/pull/1471 -[1511]: https://github.com/enso-org/ide/pull/1511 - -
- -# Enso 2.0.0-alpha.2 (2020-03-04) - -This is a release focused on bug-fixing, stability, and performance. It improves -the performance of workflows and visualizations, and improves the look and feel -of the graphical interface. In addition, the graphical interface now informs the -users about errors and where they originate. - -
![New Learning Resources](/docs/assets/tags/new_learning_resources.svg) - -- [Learn how to define custom data visualizations in - Enso][podcast-custom-visualizations]. -- [Learn how to use Java libraries in Enso, to build a - webserver][podcast-java-interop]. -- [Learn how to use Javascript libraries in Enso, to build custom server-side - website rendering][podcast-http-server]. -- [Discover why Enso Compiler is so fast and how it was built to support a - dual-representation language][podcast-compiler-internals]. -- [Learn more about the vision behind Enso and about its planned - future][podcast-future-of-enso]. - -
![New Features](/docs/assets/tags/new_features.svg) - -#### Visual Environment - -- [Errors in workflows are now displayed in the graphical interface][1215]. - Previously, these errors were silently skipped, which was non-intuitive and - hard to understand. Now, the IDE displays both dataflow errors and panics in a - nice and descriptive fashion. -- [Added geographic map support for Tables (data frames).][1187] Tables that - have `latitude`, `longitude`, and optionally `label` columns can now be shown - as points on a map. -- [Added a shortcut for live reloading of visualization files.][1190] This - drastically improves how quickly new visualizations can be tested during their - development. This is _currently_ limited in that, after reloading - visualization definitions, the currently visible visualizations must be - switched to another and switched back to refresh their content. See the [video - podcast about building custom visualizations][podcast-custom-visualizations] - to learn more. -- [Added a visual indicator of the ongoing standard library compilation][1264]. - Currently, each time IDE is started, the backend needs to compile the standard - library before it can provide IDE with type information and values. Because of - that, not all functionalities are ready to work directly after starting the - IDE. Now, there is a visible indication of the ongoing background process. -- [Added the ability to reposition visualisations.][1096] There is now an icon - in the visualization action bar that allows dragging the visualization away - from a node. Once the visualization has been moved, another icon appears that - can pin the visualization back to the node. -- [There is now an API to show Version Control System (like Git) status for - nodes][1160]. - -
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) - -#### Visual Environment - -- [You can now use the table visualization to display data frames][1181]. Please - note, that large tables will get truncated to 2000 entries. This limitation - will be lifted in future releases. -- [Performance improvements during visual workflow][1067]. Nodes added with the - searcher will have their values automatically assigned to newly generated - variables, which allows the Enso Engine to cache intermediate values and hence - improve visualization performance. -- [Minor documentation rendering fixes][1098]. Fixed cases where text would be - misinterpreted as a tag, added support for new tag types, added support for - more common characters, properly renders overflowing text. -- [Improved handling of projects created with other IDE versions][1214]. The IDE - is now better at dealing with incompatible metadata in files, which stores - node visual position information, the history of chosen searcher suggestions, - etc. This will allow IDE to correctly open projects that were created using a - different IDE version and prevent unnecessary loss of metadata. -- Pressing and holding up and down arrow keys make the list view selection move - continuously. -- The shortcuts to close the application and to toggle the developer tools at - runtime now work on all supported platforms. -- [The loading progress indicator remains visible while IDE initializes][1237]. - Previously the loading progress indicator completed too quickly and stopped - spinning before the IDE was ready. Now it stays active, giving a visual - indication that the initialization is still in progress. -- [Fixed visual glitch where a node's text was displayed as white on a white - background][1264]. Most notably this occurred with the output node of a - function generated using the node collapse refactoring. -- Many visual glitches were fixed, including small "pixel-like" artifacts - appearing on the screen. -- [Several parser improvements][1274]. The parser used in the IDE has been - updated to the latest version. This resolves several issues with language - constructs like `import`, lambdas, and parentheses, whereupon typing certain - text the edit could be automatically reverted. -- [The auto-import functionality was improved][1279]. Libraries' `Main` modules - are omitted in expressions inserted by the searcher. For example, the `point` - method of `Geo` library will be displayed as `Geo.point` and will insert - import `Geo` instead of `Geo.Main`. -- Cursors in text editors behave correctly now (they are not affected by scene - pan and zoom). This was possible because of the new multi-camera management - system implemented in EnsoGL. -- [Fixed method names highlighted in pink.][1408] There was a bug introduced - after one of the latest Engine updates, that sent `Unresolved_symbol` types, - which made all methods pink. This is fixed now. - -#### EnsoGL (rendering engine) - -- A new multi-camera management system, allowing the same shape systems to be - rendered on different layers from different cameras. The implementation - automatically caches the same shape system definitions per scene layer in - order to minimize the amount of WebGL draw calls and hence improve - performance. -- A new depth-ordering mechanism for symbols and shapes. It is now possible to - define depth order dependencies between symbols, shapes, and shape systems. -- Various performance improvements, especially for the text rendering engine. -- Display objects handle visibility correctly now. Display objects are not - visible by default and need to be attached to a visible parent to be shown on - the screen. - -#### Enso Compiler - -If you're interested in the enhancements and fixes made to the Enso compiler, -you can find their release notes -[here](https://github.com/enso-org/enso/blob/develop/RELEASES.md#enso-026-2021-03-02). - -[1067]: https://github.com/enso-org/ide/pull/1067 -[1096]: https://github.com/enso-org/ide/pull/1096 -[1098]: https://github.com/enso-org/ide/pull/1098 -[1181]: https://github.com/enso-org/ide/pull/1181 -[1215]: https://github.com/enso-org/ide/pull/1215 -[1160]: https://github.com/enso-org/ide/pull/1160 -[1190]: https://github.com/enso-org/ide/pull/1190 -[1187]: https://github.com/enso-org/ide/pull/1187 -[1068]: https://github.com/enso-org/ide/pull/1068 -[1214]: https://github.com/enso-org/ide/pull/1214 -[1237]: https://github.com/enso-org/ide/pull/1237 -[1264]: https://github.com/enso-org/ide/pull/1264 -[1274]: https://github.com/enso-org/ide/pull/1274 -[1279]: https://github.com/enso-org/ide/pull/1279 -[podcast-java-interop]: - https://www.youtube.com/watch?v=bcpOEX1x06I&t=468s&ab_channel=Enso -[podcast-compiler-internals]: - https://www.youtube.com/watch?v=BibjcUjdkO4&ab_channel=Enso -[podcast-custom-visualizations]: - https://www.youtube.com/watch?v=wFkh5LgAZTs&t=5439s&ab_channel=Enso -[podcast-http-server]: - https://www.youtube.com/watch?v=BYUAL4ksEgY&ab_channel=Enso -[podcast-future-of-enso]: - https://www.youtube.com/watch?v=rF8DuJPOfTs&t=1863s&ab_channel=Enso -[1312]: https://github.com/enso-org/ide/pull/1312 -[1408]: https://github.com/enso-org/ide/pull/1408 - -
- -# Enso 2.0.0-alpha.1 (2020-01-26) - -This is the first release of Enso, a general-purpose programming language and -environment for interactive data processing. It is a tool that spans the entire -stack, going from high-level visualization and communication to the nitty-gritty -of backend services, all in a single language. -
![Release Notes](/docs/assets/tags/release_notes.svg) #### Anonymous Data Collection @@ -2044,14 +12,6 @@ snippets of out of context code that specifically leads to the error, like "the method 'foo' does not exist on Number". The following data will be collected: - Session length. -- Graph editing events (node create, dele, position change, connect, disconnect, - collapse, edit start, edit end). This will not include any information about - node expressions used. -- Navigation events (camera movement, scope change). -- Visualization events (visualization open, close, switch). This will not - include any information about the displayed data nor the rendered - visualization itself. - Project management events (project open, close, rename). -- Errors (IDE crashes, WASM panics, Project Manager errors, Language Server - errors, Compiler errors). -- Performance statistics (minimum, maximum, average GUI refresh rate). +- Errors (IDE crashes, Project Manager errors, Language Server errors, Compiler + errors). From c2b15216210a8a995e39f63f251bea163135e729 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Thu, 30 May 2024 13:58:02 -0400 Subject: [PATCH 28/34] mc error message --- .../lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso | 7 ++++--- .../map/numeric/arithmetic/BigDecimalDivideOp.java | 3 ++- test/Base_Tests/src/Data/Decimal_Spec.enso | 3 ++- .../Common_Table_Operations/Column_Operations_Spec.enso | 7 ++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso index 8795d1421672..77fafbdd2e33 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso @@ -499,7 +499,8 @@ type Decimal # => Decimal.new 45.7 divide : Decimal -> Math_Context | Nothing -> Decimal ! Arithmetic_Error divide self (that : Decimal) (math_context : Math_Context | Nothing = Nothing) -> Decimal ! Arithmetic_Error = - handle_java_exception <| + extra_message = " Please use `.divide` with an explicit `Math_Context` to limit the numeric precision." + handle_java_exception extra_message=extra_message <| case math_context of Nothing -> Decimal.Value (self.big_decimal.divide that.big_decimal) _ -> Decimal.Value (self.big_decimal.divide that.big_decimal math_context.math_context) @@ -1042,9 +1043,9 @@ attach_loss_of_numeric_precision x value = Warning.attach (Loss_Of_Numeric_Precision.Warning x value) value ## PRIVATE -handle_java_exception ~action = +handle_java_exception ~action (extra_message : Text = "") = Panic.catch ArithmeticException action caught_panic-> - Error.throw (Arithmetic_Error.Error caught_panic.payload.getMessage) + Error.throw (Arithmetic_Error.Error caught_panic.payload.getMessage+extra_message) ## PRIVATE handle_unsupported_argument_types ~action = diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java index 0e82753f6524..2ed343e708e6 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java @@ -16,7 +16,8 @@ public BigDecimal doBigDecimal( try { return a.divide(b); } catch (ArithmeticException e) { - problemAggregator.reportArithmeticError(e.getMessage(), ix); + String extraMessage = " Please use `.divide` with an explicit `Math_Context` to limit the numeric precision."; + problemAggregator.reportArithmeticError(e.getMessage() + extraMessage, ix); return null; } } diff --git a/test/Base_Tests/src/Data/Decimal_Spec.enso b/test/Base_Tests/src/Data/Decimal_Spec.enso index d19c6564d73f..f71277f936f8 100644 --- a/test/Base_Tests/src/Data/Decimal_Spec.enso +++ b/test/Base_Tests/src/Data/Decimal_Spec.enso @@ -651,7 +651,8 @@ add_specs suite_builder = Decimal.new "12" . div (Decimal.new "0") . should_fail_with Arithmetic_Error - ((Decimal.new "1") / (Decimal.new "3")) . should_fail_with Arithmetic_Error + nt_error = Arithmetic_Error.Error "Non-terminating decimal expansion; no exact representable decimal result. Please use `.divide` with an explicit `Math_Context` to limit the numeric precision." + ((Decimal.new "1") / (Decimal.new "3")) . should_fail_with nt_error suite_builder.group "pow" group_builder-> group_builder.specify "should define pow" <| diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index e34cd96bc16d..8ab285c458bf 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -1862,15 +1862,16 @@ add_specs suite_builder setup = r0 = t.at "x" / t.at "y" r0 . to_vector . should_equal [Nothing] - Problems.expect_warning Arithmetic_Error r0 + nt_error = Arithmetic_Error.Error "Non-terminating decimal expansion; no exact representable decimal result. Please use `.divide` with an explicit `Math_Context` to limit the numeric precision. (at rows [0])." + Problems.expect_only_warning nt_error r0 r1 = t.at "x" / t.at "z" r1 . to_vector . should_equal [Nothing] - Problems.expect_warning Arithmetic_Error r1 + Problems.expect_only_warning Arithmetic_Error r1 r2 = t.at "x" % t.at "z" r2 . to_vector . should_equal [Nothing] - Problems.expect_warning Arithmetic_Error r2 + Problems.expect_only_warning Arithmetic_Error r2 # A dummy value used to force the in-memory backend to trigger a infer a mixed type for the given column. type Mixed_Type_Object From ef4ff688ad89999c328facd959a04c1011e6df4a Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 3 Jun 2024 14:19:26 -0400 Subject: [PATCH 29/34] add BD case to Builder.java --- .../main/java/org/enso/table/data/column/builder/Builder.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/builder/Builder.java b/std-bits/table/src/main/java/org/enso/table/data/column/builder/Builder.java index 9b6782e92f87..8fb6296d8d2a 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/builder/Builder.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/builder/Builder.java @@ -2,6 +2,7 @@ import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.type.AnyObjectType; +import org.enso.table.data.column.storage.type.BigDecimalType; import org.enso.table.data.column.storage.type.BigIntegerType; import org.enso.table.data.column.storage.type.BooleanType; import org.enso.table.data.column.storage.type.DateTimeType; @@ -38,6 +39,7 @@ public static Builder getForType( case IntegerType integerType -> NumericBuilder.createLongBuilder( size, integerType, problemAggregator); case TextType textType -> new StringBuilder(size, textType); + case BigDecimalType x -> new BigDecimalBuilder(size); case BigIntegerType x -> new BigIntegerBuilder(size, problemAggregator); case null -> new InferredBuilder(size, problemAggregator); }; From 517c36ce1bfef9fe6f1189662a1160cfff2e86c5 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 3 Jun 2024 14:22:43 -0400 Subject: [PATCH 30/34] fmt --- .../operation/map/numeric/arithmetic/BigDecimalDivideOp.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java index 2ed343e708e6..e5e20b5b86fe 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/map/numeric/arithmetic/BigDecimalDivideOp.java @@ -16,7 +16,8 @@ public BigDecimal doBigDecimal( try { return a.divide(b); } catch (ArithmeticException e) { - String extraMessage = " Please use `.divide` with an explicit `Math_Context` to limit the numeric precision."; + String extraMessage = + " Please use `.divide` with an explicit `Math_Context` to limit the numeric precision."; problemAggregator.reportArithmeticError(e.getMessage() + extraMessage, ix); return null; } From d80d32f48ac80c50d6f31ef4488b64dfc1d69738 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 3 Jun 2024 14:43:01 -0400 Subject: [PATCH 31/34] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bb016a6cf9d..57aeeb43a0ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,12 @@ #### Enso Standard Library - [Added Statistic.Product][10122] +- [Added `Decimal` column to the in-memory database, with some arithmetic + operations.][9950] [debug-shortcuts]: +[9950]: https://github.com/enso-org/enso/pull/9950 [10122]: https://github.com/enso-org/enso/pull/10122
![Release Notes](/docs/assets/tags/release_notes.svg) From 345422ecfd3b6551f91944278acc34a8b36d06cf Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 3 Jun 2024 15:35:39 -0400 Subject: [PATCH 32/34] add BD case to StorageConverter.java --- .../enso/table/data/column/operation/cast/StorageConverter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java index 2714f7f7ce95..aca591eb42af 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java @@ -2,6 +2,7 @@ import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.type.AnyObjectType; +import org.enso.table.data.column.storage.type.BigDecimalType; import org.enso.table.data.column.storage.type.BigIntegerType; import org.enso.table.data.column.storage.type.BooleanType; import org.enso.table.data.column.storage.type.DateTimeType; @@ -29,6 +30,7 @@ static StorageConverter fromStorageType(StorageType storageType) { case TextType textType -> new ToTextStorageConverter(textType); case TimeOfDayType timeOfDayType -> new ToTimeOfDayStorageConverter(); case BigIntegerType bigIntegerType -> new ToBigIntegerConverter(); + case BigDecimalType bigDecimalType -> throw new UnsupportedOperationException("Conversion to BigDecimal is not yet supported."); }; } } From e680e3081b580f8fb24cda05fca4ebbd2ab12f9e Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Mon, 3 Jun 2024 16:49:39 -0400 Subject: [PATCH 33/34] fmt --- .../table/data/column/operation/cast/StorageConverter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java b/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java index aca591eb42af..4933d843b749 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/operation/cast/StorageConverter.java @@ -30,7 +30,8 @@ static StorageConverter fromStorageType(StorageType storageType) { case TextType textType -> new ToTextStorageConverter(textType); case TimeOfDayType timeOfDayType -> new ToTimeOfDayStorageConverter(); case BigIntegerType bigIntegerType -> new ToBigIntegerConverter(); - case BigDecimalType bigDecimalType -> throw new UnsupportedOperationException("Conversion to BigDecimal is not yet supported."); + case BigDecimalType bigDecimalType -> throw new UnsupportedOperationException( + "Conversion to BigDecimal is not yet supported."); }; } } From c0467d98cf7af7d33626a7c345272b6aad10bb51 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Tue, 4 Jun 2024 10:28:55 -0400 Subject: [PATCH 34/34] fix test --- test/Table_Tests/src/In_Memory/Column_Spec.enso | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Table_Tests/src/In_Memory/Column_Spec.enso b/test/Table_Tests/src/In_Memory/Column_Spec.enso index 08ae64eb3c34..23838d89ff7b 100644 --- a/test/Table_Tests/src/In_Memory/Column_Spec.enso +++ b/test/Table_Tests/src/In_Memory/Column_Spec.enso @@ -2,6 +2,7 @@ from Standard.Base import all import project.Util +import Standard.Base.Data.Vector.Map_Error import Standard.Base.Errors.Common.Arithmetic_Error import Standard.Base.Errors.Common.Index_Out_Of_Bounds import Standard.Base.Errors.Common.Type_Error @@ -95,7 +96,7 @@ add_specs suite_builder = if x == 1 then Error.throw "X" else x col = Column.from_vector "Test" [foo 0, foo 1, foo 2] col . should_fail_with Text - col.catch . should_equal "X" + col.catch . should_equal (Map_Error.Error 1 'X') group_builder.specify "should not allow invalid column names" <| c1 = Column.from_vector "" [1, 2, 3]