Copilot commented on code in PR #6288:
URL: https://github.com/apache/texera/pull/6288#discussion_r3553059355
##########
frontend/src/app/workspace/component/result-panel/error-frame/error-frame.component.ts:
##########
@@ -72,11 +72,39 @@ export class ErrorFrameComponent implements OnInit {
errorMessages = errorMessages.filter(err => err.operatorId ===
this.operatorId);
}
this.categoryToErrorMapping = errorMessages.reduce((acc, obj) => {
- const key = obj.type.name;
+ let key = obj.type.name;
+ let message = obj.message;
+ let details = obj.details;
+
+ if (key === "COMPILATION_ERROR") {
+ // Strip out common Java exception class names and formatting to make
it more user-friendly
+ const exceptionRegex =
/^\s*(?:[a-zA-Z0-9_]+\.)+[a-zA-Z0-9_]+Exception:\s*/;
+ const requirementFailedRegex = /^\s*requirement failed:\s*/;
+ const genericExceptionRegex = /^\s*Exception:\s*/;
+
+ if (message) {
+ message = message.replace(exceptionRegex, "");
+ message = message.replace(requirementFailedRegex, "");
+ message = message.replace(genericExceptionRegex, "");
+ }
+
+ if (details) {
+ details = details.replace(exceptionRegex, "");
+ details = details.replace(requirementFailedRegex, "");
+ details = details.replace(genericExceptionRegex, "");
+ }
Review Comment:
This new compilation-error formatting logic isn’t covered by unit tests.
There is an existing spec for this component, but it currently only asserts
creation, so regressions in the regex stripping (message vs. details, and
COMPILATION_ERROR-only behavior) won’t be caught.
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/csv/CSVScanSourceOpDesc.scala:
##########
@@ -78,10 +78,22 @@ class CSVScanSourceOpDesc extends ScanSourceOpDesc {
}
override def sourceSchema(): Schema = {
- if (customDelimiter.isEmpty || !fileResolved()) {
- return null
+ if (customDelimiter.forall(_.isEmpty)) {
+ customDelimiter = Option(",")
+ }
+ require(
+ fileResolved(),
+ "No file selected. Please select a valid .csv file from the 'File'
dropdown in the right panel."
+ )
Review Comment:
This new `require(fileResolved(), ...)` changes the compilation error
message for missing CSV file selection. There is an existing compiler contract
test that currently asserts `err.message.contains("no input file name")` for
`CSVScanSourceOpDesc` with no fileName, which will fail once the error is now a
`requirement failed: No file selected...` message.
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/csvOld/CSVOldScanSourceOpDesc.scala:
##########
@@ -75,11 +75,20 @@ class CSVOldScanSourceOpDesc extends ScanSourceOpDesc {
}
override def sourceSchema(): Schema = {
- if (customDelimiter.isEmpty || !fileResolved()) {
- return null
+ require(customDelimiter.isDefined, "Please specify a delimiter in the
properties panel.")
+ require(
+ fileResolved(),
+ "No file selected. Please select a valid .csv file from the 'File'
dropdown in the right panel."
+ )
+
Review Comment:
`customDelimiter.isDefined` doesn’t prevent an empty delimiter string (e.g.,
`Some("")`). In that case `customDelimiter.get.charAt(0)` will throw, producing
a cryptic error instead of the intended user-friendly validation. The other CSV
scan operators normalize empty delimiters to ","; this one should do the same
(or require non-empty).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]