diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Delimited_Reader.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Delimited_Reader.enso index 447a2092178ec..7afa29d3fd71f 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Delimited_Reader.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Internal/Delimited_Reader.enso @@ -3,7 +3,7 @@ import Standard.Table import Standard.Base.Error.Common as Errors from Standard.Base.Error.Problem_Behavior as Problem_Behavior_Module import Problem_Behavior -from Standard.Table.Error as Table_Errors import Invalid_Row, Mismatched_Quote, Parser_Error, Additional_Invalid_Rows +from Standard.Table.Error as Table_Errors import Duplicate_Output_Column_Names, Invalid_Output_Column_Names, Invalid_Row, Mismatched_Quote, Parser_Error, Additional_Invalid_Rows from Standard.Base.Data.Text.Encoding as Encoding_Module import Encoding, Encoding_Error from Standard.Table.Io.File_Format import Infer from Standard.Table.Data.Data_Formatter as Data_Formatter_Module import Data_Formatter @@ -13,6 +13,8 @@ polyglot java import org.enso.table.read.ParsingFailedException polyglot java import org.enso.table.parsing.problems.InvalidRow polyglot java import org.enso.table.parsing.problems.MismatchedQuote polyglot java import org.enso.table.parsing.problems.AdditionalInvalidRows +polyglot java import org.enso.table.util.problems.DuplicateNames +polyglot java import org.enso.table.util.problems.InvalidNames polyglot java import java.lang.IllegalArgumentException polyglot java import java.io.IOException polyglot java import com.univocity.parsers.common.TextParsingException @@ -105,7 +107,9 @@ read_from_reader format java_reader on_problems max_columns=4096 = if Java.is_instance java_problem InvalidRow then Invalid_Row java_problem.source_row java_problem.table_index (Vector.Vector java_problem.row) else if Java.is_instance java_problem MismatchedQuote then Mismatched_Quote else if Java.is_instance java_problem AdditionalInvalidRows then Additional_Invalid_Rows java_problem.count else - java_problem + if Java.is_instance java_problem DuplicateNames then Duplicate_Output_Column_Names java_problem.duplicatedNames else + if Java.is_instance java_problem InvalidNames then Invalid_Output_Column_Names java_problem.invalidNames else + java_problem translate_illegal_argument caught_panic = Error.throw (Illegal_Argument_Error caught_panic.payload.cause.getMessage) @@ -132,6 +136,6 @@ read_from_reader format java_reader on_problems max_columns=4096 = formatter = format.value_formatter.if_nothing Data_Formatter TypeInferringParser.new formatter.get_specific_type_parsers.to_array IdentityParser.new reader = DelimitedReader.new java_reader format.delimiter format.quote format.quote_escape java_headers skip_rows row_limit max_columns value_parser cell_type_guesser format.keep_invalid_rows warnings_as_errors - result = Table.Table reader.read - parsing_problems = Vector.Vector reader.getReportedProblems . map translate_parsing_problem - on_problems.attach_problems_after result parsing_problems + result_with_problems = reader.read + parsing_problems = Vector.Vector (result_with_problems.problems) . map translate_parsing_problem + on_problems.attach_problems_after (Table.Table result_with_problems.value) parsing_problems diff --git a/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso b/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso index cab22a14c85e3..57e74ad01f566 100644 --- a/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso +++ b/distribution/lib/Standard/Test/0.0.0-dev/src/Main.enso @@ -731,7 +731,12 @@ report_pending_group name reason config = Spec.print_report : Suite_Config -> Nothing Spec.print_report config = if config.should_output_junit then - config.builder.append ('') + config.builder.append ('') + this.behaviors.reverse.each behavior-> config.builder.append ('') case behavior.result of diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/DatatypeParser.java b/std-bits/table/src/main/java/org/enso/table/parsing/DatatypeParser.java index 3cb87741ca216..d9e6ef19952a9 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/DatatypeParser.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/DatatypeParser.java @@ -3,7 +3,7 @@ import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.StringStorage; import org.enso.table.parsing.problems.ProblemAggregator; -import org.enso.table.read.WithProblems; +import org.enso.table.problems.WithProblems; /** A base type for a parser capable of parsing a column of text values into some other type. */ public abstract class DatatypeParser { diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/IdentityParser.java b/std-bits/table/src/main/java/org/enso/table/parsing/IdentityParser.java index 5baeb28962a6b..f2e035360d4ae 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/IdentityParser.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/IdentityParser.java @@ -5,7 +5,7 @@ import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.StringStorage; import org.enso.table.parsing.problems.ProblemAggregator; -import org.enso.table.read.WithProblems; +import org.enso.table.problems.WithProblems; /** A parser that just returns its input. Useful as a fallback. */ public class IdentityParser extends IncrementalDatatypeParser { diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/IncrementalDatatypeParser.java b/std-bits/table/src/main/java/org/enso/table/parsing/IncrementalDatatypeParser.java index 56fb44ca0a602..f3fbe23ea8726 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/IncrementalDatatypeParser.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/IncrementalDatatypeParser.java @@ -4,7 +4,7 @@ import org.enso.table.data.column.storage.Storage; import org.enso.table.data.column.storage.StringStorage; import org.enso.table.parsing.problems.ProblemAggregatorImpl; -import org.enso.table.read.WithProblems; +import org.enso.table.problems.WithProblems; /** * A base type for a datatype parsing strategy which relies on a method parsing a single value. diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/TypeInferringParser.java b/std-bits/table/src/main/java/org/enso/table/parsing/TypeInferringParser.java index 9d0c71912f9c8..9c9c4952a2716 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/TypeInferringParser.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/TypeInferringParser.java @@ -6,7 +6,7 @@ import org.enso.table.parsing.problems.ProblemAggregator; import org.enso.table.parsing.problems.ProblemAggregatorImpl; import org.enso.table.parsing.problems.SimplifiedProblemAggregator; -import org.enso.table.read.WithProblems; +import org.enso.table.problems.WithProblems; /** * The type inferring parser tries to parse the given column using a set of provided parsers. It diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/AdditionalInvalidRows.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/AdditionalInvalidRows.java index c624870493dda..2b4ebfb19080f 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/AdditionalInvalidRows.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/AdditionalInvalidRows.java @@ -1,4 +1,6 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + /** A problem which indicates how many additional invalid rows were encountered. */ -public record AdditionalInvalidRows(long count) implements ParsingProblem {} +public record AdditionalInvalidRows(long count) implements Problem {} diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidFormat.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidFormat.java index 5d0235d758155..0ebb8e50bf306 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidFormat.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidFormat.java @@ -1,6 +1,8 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + import java.util.List; /** Indicates that a text value did not match the format expected of a datatype. */ -public record InvalidFormat(String column, List cells) implements ParsingProblem {} +public record InvalidFormat(String column, List cells) implements Problem {} diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidRow.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidRow.java index 32717c90290a7..6e310ee1a3c1c 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidRow.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/InvalidRow.java @@ -1,4 +1,6 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + /** A problem indicating that a row contained more or less columns than expected. */ -public record InvalidRow(long source_row, Long table_index, String[] row) implements ParsingProblem {} +public record InvalidRow(long source_row, Long table_index, String[] row) implements Problem {} diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/LeadingZeros.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/LeadingZeros.java index 6ddccbae93730..3e9cfe609bf00 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/LeadingZeros.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/LeadingZeros.java @@ -1,6 +1,8 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + import java.util.List; /** Indicates that some values contained leading zeros when leading zeros where not allowed in the given numeric conversion. */ -public record LeadingZeros(String column, List cells) implements ParsingProblem {} +public record LeadingZeros(String column, List cells) implements Problem {} diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/MismatchedQuote.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/MismatchedQuote.java index fd84d1fe4aba7..0579f486dbce2 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/MismatchedQuote.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/MismatchedQuote.java @@ -1,4 +1,6 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + /** A problem indicating that a quote has been opened and never closed. */ -public record MismatchedQuote() implements ParsingProblem {} +public record MismatchedQuote() implements Problem {} diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/NoOpProblemAggregator.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/NoOpProblemAggregator.java index ca56dea3b6236..8d1f684ab95f0 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/NoOpProblemAggregator.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/NoOpProblemAggregator.java @@ -1,5 +1,7 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + import java.util.List; /** A problem aggregator which ignores problems. */ @@ -20,7 +22,7 @@ public boolean hasProblems() { } @Override - public List getAggregatedProblems() { + public List getAggregatedProblems() { throw new IllegalStateException("This implementation does not provide problem information."); } } diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregator.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregator.java index f39ac791a9f14..f13a5953d33be 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregator.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregator.java @@ -1,5 +1,7 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + import java.util.List; /** An aggregator for parsing problems. */ @@ -28,5 +30,5 @@ public interface ProblemAggregator { boolean hasProblems(); /** Return an aggregated summary of problems that have been reported. */ - List getAggregatedProblems(); + List getAggregatedProblems(); } diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregatorImpl.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregatorImpl.java index 00419a80c2978..5467fc88e3411 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregatorImpl.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/ProblemAggregatorImpl.java @@ -1,5 +1,7 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + import java.util.ArrayList; import java.util.List; @@ -34,8 +36,8 @@ public boolean hasProblems() { } @Override - public List getAggregatedProblems() { - List problems = new ArrayList<>(); + public List getAggregatedProblems() { + List problems = new ArrayList<>(); if (!invalidFormatCells.isEmpty()) { problems.add(new InvalidFormat(relatedColumnName, invalidFormatCells)); diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/SimplifiedProblemAggregator.java b/std-bits/table/src/main/java/org/enso/table/parsing/problems/SimplifiedProblemAggregator.java index 6977288bfb418..541796967d4dd 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/SimplifiedProblemAggregator.java +++ b/std-bits/table/src/main/java/org/enso/table/parsing/problems/SimplifiedProblemAggregator.java @@ -1,5 +1,7 @@ package org.enso.table.parsing.problems; +import org.enso.table.problems.Problem; + import java.util.List; public class SimplifiedProblemAggregator implements ProblemAggregator { @@ -27,7 +29,7 @@ public boolean hasProblems() { } @Override - public List getAggregatedProblems() { + public List getAggregatedProblems() { throw new IllegalStateException("Problem aggregation is not available in this implementation."); } } diff --git a/std-bits/table/src/main/java/org/enso/table/parsing/problems/ParsingProblem.java b/std-bits/table/src/main/java/org/enso/table/problems/Problem.java similarity index 61% rename from std-bits/table/src/main/java/org/enso/table/parsing/problems/ParsingProblem.java rename to std-bits/table/src/main/java/org/enso/table/problems/Problem.java index 6fd5d3ea6b7a2..089e2947ee2f4 100644 --- a/std-bits/table/src/main/java/org/enso/table/parsing/problems/ParsingProblem.java +++ b/std-bits/table/src/main/java/org/enso/table/problems/Problem.java @@ -1,7 +1,7 @@ -package org.enso.table.parsing.problems; +package org.enso.table.problems; /** * A parent class for parsing problems which may be reported as warnings or errors, depending on the * setup. */ -public interface ParsingProblem {} +public interface Problem {} diff --git a/std-bits/table/src/main/java/org/enso/table/problems/WithProblems.java b/std-bits/table/src/main/java/org/enso/table/problems/WithProblems.java new file mode 100644 index 0000000000000..061fb8191e1d5 --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/problems/WithProblems.java @@ -0,0 +1,6 @@ +package org.enso.table.problems; + +import java.util.List; + +/** A value annotated with problems that occurred when it was being computed. */ +public record WithProblems(T value, List problems) {} diff --git a/std-bits/table/src/main/java/org/enso/table/read/DelimitedReader.java b/std-bits/table/src/main/java/org/enso/table/read/DelimitedReader.java index 25bbf70870ef7..eeda8ae3bb989 100644 --- a/std-bits/table/src/main/java/org/enso/table/read/DelimitedReader.java +++ b/std-bits/table/src/main/java/org/enso/table/read/DelimitedReader.java @@ -6,6 +6,7 @@ import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import org.enso.table.data.column.builder.string.StringStorageBuilder; @@ -14,13 +15,14 @@ import org.enso.table.data.index.DefaultIndex; import org.enso.table.data.table.Column; import org.enso.table.data.table.Table; +import org.enso.table.problems.WithProblems; import org.enso.table.parsing.DatatypeParser; import org.enso.table.parsing.TypeInferringParser; import org.enso.table.parsing.problems.AdditionalInvalidRows; import org.enso.table.parsing.problems.InvalidRow; import org.enso.table.parsing.problems.MismatchedQuote; import org.enso.table.parsing.problems.NoOpProblemAggregator; -import org.enso.table.parsing.problems.ParsingProblem; +import org.enso.table.problems.Problem; import org.enso.table.util.NameDeduplicator; /** A helper for reading delimited (CSV-like) files. */ @@ -36,7 +38,7 @@ public class DelimitedReader { private final long skipRows; private final long rowLimit; private final int maxColumns; - private final List warnings = new ArrayList<>(); + private final List warnings = new ArrayList<>(); private final CsvParser parser; private final DatatypeParser valueParser; private final TypeInferringParser cellTypeGuesser; @@ -181,8 +183,10 @@ private void reportInvalidRow(long source_row, Long table_index, String[] row) { } /** Returns a list of currently reported problems encountered when parsing the input. */ - public List getReportedProblems() { - List result = new ArrayList<>(warnings); + private List getReportedProblems(List nameProblems) { + List result = new ArrayList<>(nameProblems.size() + warnings.size() + 1); + result.addAll(nameProblems); + result.addAll(warnings); if (invalidRowsCount > invalidRowsLimit) { long additionalInvalidRows = invalidRowsCount - invalidRowsLimit; result.add(new AdditionalInvalidRows(additionalInvalidRows)); @@ -190,7 +194,7 @@ public List getReportedProblems() { return result; } - private void reportProblem(ParsingProblem problem) { + private void reportProblem(Problem problem) { if (warningsAsErrors) { throw new ParsingFailedException(problem); } else { @@ -220,7 +224,7 @@ private void appendRow(String[] row) { builders[i] = builders[i].parseAndAppend(row[i]); } - // If the current row had less columns than expected, nulls are inserted for the missing + // If the current row had fewer columns than expected, nulls are inserted for the missing // values. // If it had more columns, the excess columns are discarded. for (int i = row.length; i < builders.length; i++) { @@ -248,18 +252,21 @@ private void appendRowIfLimitPermits(String[] row) { } } - private List headersFromRow(String[] row) { + private WithProblems> headersFromRow(String[] row) { List preprocessedHeaders = Arrays.stream(row).map(this::parseHeader).collect(Collectors.toList()); - return new NameDeduplicator().makeUnique(preprocessedHeaders); + + NameDeduplicator deduplicator = new NameDeduplicator(); + List names = deduplicator.makeUnique(preprocessedHeaders); + return new WithProblems<>(names, deduplicator.getProblems()); } - private List generateDefaultHeaders(int columnCount) { - ArrayList headerNames = new ArrayList<>(columnCount); + private WithProblems> generateDefaultHeaders(int columnCount) { + List headerNames = new ArrayList<>(columnCount); for (int i = 0; i < columnCount; ++i) { headerNames.add(COLUMN_NAME + "_" + (i + 1)); } - return headerNames; + return new WithProblems<>(headerNames, Collections.emptyList()); } /** @@ -274,8 +281,8 @@ private boolean isPlainText(String cell) { } /** Reads the input stream and returns a Table. */ - public Table read() { - List headerNames; + public WithProblems read() { + WithProblems> headerNames; String[] currentRow = readNextRow(); // Skip the first N rows. @@ -285,7 +292,7 @@ public Table read() { // If there are no rows to even infer the headers, we return an empty table. if (currentRow == null) { - return new Table(new Column[0]); + return new WithProblems<>(new Table(new Column[0]), Collections.emptyList()); } int expectedColumnCount = currentRow.length; @@ -335,7 +342,7 @@ public Table read() { Column[] columns = new Column[builders.length]; for (int i = 0; i < builders.length; i++) { - String columnName = headerNames.get(i); + String columnName = headerNames.value().get(i); StringStorage col = builders[i].seal(); WithProblems parseResult = valueParser.parseColumn(columnName, col); @@ -346,7 +353,7 @@ public Table read() { columns[i] = new Column(columnName, new DefaultIndex(storage.size()), storage); } - return new Table(columns); + return new WithProblems<>(new Table(columns), getReportedProblems(headerNames.problems())); } private void initBuilders(int count) { diff --git a/std-bits/table/src/main/java/org/enso/table/read/ParsingFailedException.java b/std-bits/table/src/main/java/org/enso/table/read/ParsingFailedException.java index 0f20d4b7b2344..e18c29b8da7b4 100644 --- a/std-bits/table/src/main/java/org/enso/table/read/ParsingFailedException.java +++ b/std-bits/table/src/main/java/org/enso/table/read/ParsingFailedException.java @@ -1,15 +1,15 @@ package org.enso.table.read; -import org.enso.table.parsing.problems.ParsingProblem; +import org.enso.table.problems.Problem; /** * An exception thrown when a problem occured during parsing and the parser is running in a mode * that does not try recovering, so the parsing is stopped. */ public class ParsingFailedException extends RuntimeException { - public final ParsingProblem problem; + public final Problem problem; - public ParsingFailedException(ParsingProblem problem) { + public ParsingFailedException(Problem problem) { this.problem = problem; } } diff --git a/std-bits/table/src/main/java/org/enso/table/read/WithProblems.java b/std-bits/table/src/main/java/org/enso/table/read/WithProblems.java deleted file mode 100644 index 486fe9003e691..0000000000000 --- a/std-bits/table/src/main/java/org/enso/table/read/WithProblems.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.enso.table.read; - -import java.util.List; -import org.enso.table.parsing.problems.ParsingProblem; - -/** A value annotated with problems that occurred when it was being computed. */ -public record WithProblems(T value, List problems) {} diff --git a/std-bits/table/src/main/java/org/enso/table/util/NameDeduplicator.java b/std-bits/table/src/main/java/org/enso/table/util/NameDeduplicator.java index 036db655a4c28..adf884a10ec2b 100644 --- a/std-bits/table/src/main/java/org/enso/table/util/NameDeduplicator.java +++ b/std-bits/table/src/main/java/org/enso/table/util/NameDeduplicator.java @@ -1,5 +1,9 @@ package org.enso.table.util; +import org.enso.table.problems.Problem; +import org.enso.table.util.problems.DuplicateNames; +import org.enso.table.util.problems.InvalidNames; + import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -14,7 +18,7 @@ public class NameDeduplicator { public String makeValid(String input) { if (input == null || input.isEmpty()) { this.invalidNames.add(input); - return "Column"; + return "Column"; } return input; @@ -57,4 +61,15 @@ public String[] getInvalidNames() { public String[] getDuplicatedNames() { return this.duplicatedNames.toArray(String[]::new); } + + public List getProblems() { + List output = new ArrayList<>(2); + if (!this.invalidNames.isEmpty()) { + output.add(new InvalidNames(this.getInvalidNames())); + } + if (!this.duplicatedNames.isEmpty()) { + output.add(new DuplicateNames(this.getDuplicatedNames())); + } + return output; + } } diff --git a/std-bits/table/src/main/java/org/enso/table/util/problems/DuplicateNames.java b/std-bits/table/src/main/java/org/enso/table/util/problems/DuplicateNames.java new file mode 100644 index 0000000000000..0811d8ab3106a --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/util/problems/DuplicateNames.java @@ -0,0 +1,6 @@ +package org.enso.table.util.problems; + +import org.enso.table.problems.Problem; + +public record DuplicateNames(String[] duplicatedNames) implements Problem { +} diff --git a/std-bits/table/src/main/java/org/enso/table/util/problems/InvalidNames.java b/std-bits/table/src/main/java/org/enso/table/util/problems/InvalidNames.java new file mode 100644 index 0000000000000..2cfa709186f68 --- /dev/null +++ b/std-bits/table/src/main/java/org/enso/table/util/problems/InvalidNames.java @@ -0,0 +1,5 @@ +package org.enso.table.util.problems; + +import org.enso.table.problems.Problem; + +public record InvalidNames(String[] invalidNames) implements Problem {} diff --git a/test/Table_Tests/src/Common_Table_Spec.enso b/test/Table_Tests/src/Common_Table_Spec.enso index 46dbe044ab1cc..d94a2b85c5e91 100644 --- a/test/Table_Tests/src/Common_Table_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Spec.enso @@ -472,7 +472,7 @@ spec prefix table_builder supports_case_sensitive_columns pending=Nothing = map = Column_Mapping.By_Position ["alpha", Nothing] action = table.rename_columns map on_problems=_ tester = expect_column_names ["alpha", "Column_1", "gamma", "delta"] - problems = [Invalid_Output_Column_Names [""]] + problems = [Invalid_Output_Column_Names [Nothing]] Problems.test_problem_handling action problems tester Test.specify "should correctly handle problems: duplicate names" <| diff --git a/test/Table_Tests/src/Spreadsheet_Spec.enso b/test/Table_Tests/src/Spreadsheet_Spec.enso index 7a6dd26c87399..67cb223d9261d 100644 --- a/test/Table_Tests/src/Spreadsheet_Spec.enso +++ b/test/Table_Tests/src/Spreadsheet_Spec.enso @@ -35,7 +35,7 @@ spec_fmt header file read_method = Test.specify "should gracefully handle duplicate column names and formulas" <| t = read_method file sheet="Duplicate Columns" t.columns.map .name . should_equal ['Item', 'Price', 'Quantity', 'Price_1'] - t.at 'Price 1' . to_vector . should_equal [20, 40, 0, 60, 0, 10] + t.at 'Price_1' . to_vector . should_equal [20, 40, 0, 60, 0, 10] Test.specify "should allow reading with cell range specified" <| t_1 = read_method file sheet="Simple" cell_range="B:C" diff --git a/test/Table_Tests/src/Table_Spec.enso b/test/Table_Tests/src/Table_Spec.enso index 7a39b1fcdcad3..540dba5475fc6 100644 --- a/test/Table_Tests/src/Table_Spec.enso +++ b/test/Table_Tests/src/Table_Spec.enso @@ -665,7 +665,7 @@ spec = table = Table.new [c_0, c_2] action = table.use_first_row_as_names on_problems=_ tester = expect_column_names ["A", "Column_1"] - problems = [Invalid_Output_Column_Names [""]] + problems = [Invalid_Output_Column_Names [Nothing]] Problems.test_problem_handling action problems tester Test.specify "should correctly handle problems: duplicate names" <|