Conversation
Replaces `Collection<text>` for interpreting tables.
1ddd369 to
a742cf3
Compare
georg-schwarz
left a comment
There was a problem hiding this comment.
Awesome! I'll trigger copilt but good to go from my side!
There was a problem hiding this comment.
Pull request overview
This PR implements RFC 0021, which introduces a new SheetRow type and dot operator (.) syntax for accessing sheet row cells, replacing the previous Collection<text> type and cellInColumn operator. This change simplifies the syntax for row transformations in tabular data processing.
Changes:
- Introduced new
SheetRowprimitive value type for representing sheet rows - Replaced
cellInColumnoperator with.operator for cell access (e.g.,r . "column"orr . 0) - Updated all transform definitions across examples, standard library, and test files to use the new syntax
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
libs/language-server/src/lib/ast/wrappers/value-type/primitive/sheetrow-value-type.ts |
New SheetRow value type implementation |
libs/language-server/src/lib/ast/wrappers/value-type/primitive/primitive-value-type-provider.ts |
Added SheetRow to primitive type provider |
libs/language-server/src/lib/ast/wrappers/value-type/primitive/index.ts |
Exported SheetRow type |
libs/language-server/src/lib/ast/wrappers/value-type/value-type.ts |
Added visitSheetRow method to visitor interface |
libs/language-server/src/lib/ast/expressions/evaluators/dot-operator-evaluator.ts |
Renamed from CellInColumnOperatorEvaluator to DotOperatorEvaluator |
libs/language-server/src/lib/ast/expressions/type-computers/dot-operator-type-computer.ts |
Renamed from CellInColumnOperatorTypeComputer to DotOperatorTypeComputer |
libs/language-server/src/lib/ast/expressions/operator-registry.ts |
Updated operator registry to use . instead of cellInColumn |
libs/language-server/src/grammar/expression.langium |
Changed grammar to use . operator |
libs/language-server/src/lib/validation/checks/transform-body.ts |
Updated error message (but validation logic needs fix) |
libs/language-server/src/lib/ast/wrappers/value-type/primitive/collection/abstract-collection-value-type.ts |
Removed isReferenceableByUser() override (Collections now non-referenceable by users) |
libs/execution/src/lib/types/value-types/visitors/*.ts |
Added visitSheetRow implementations to all value type visitors |
libs/execution/src/lib/transforms/transform-executor.ts |
Minor refactoring using onlyElementOrUndefined |
Multiple .jv example and test files |
Updated all transform definitions to use SheetRow and . operator |
Comments suppressed due to low confidence (1)
libs/language-server/src/lib/validation/checks/transform-body.ts:166
- The validation logic still checks for
Collection<text>type (line 157) but the error message saysSheetRow(line 160). The condition should be updated to check forSheetRowinstead:
Change line 136-138 from:
const textCollection = props.valueTypeProvider.createCollectionValueTypeOf(
props.valueTypeProvider.Primitives.Text,
);
to:
const sheetRow = props.valueTypeProvider.Primitives.SheetRow;
And change line 157 from:
if (!inputValueType.equals(textCollection)) {
to:
if (!inputValueType.equals(sheetRow)) {
const textCollection = props.valueTypeProvider.createCollectionValueTypeOf(
props.valueTypeProvider.Primitives.Text,
);
const input = onlyElementOrUndefined(inputs);
const inputValueType = props.wrapperFactories.ValueType.wrap(
input?.valueType,
);
assert(input !== undefined);
if (inputValueType === undefined) {
props.validationContext.accept(
'error',
'Transforms with a table row expression must have exactly one input',
{
node: transformBody,
},
);
return;
}
if (!inputValueType.equals(textCollection)) {
props.validationContext.accept(
'error',
'This input must be of type `SheetRow',
{
node: input.valueType,
},
);
return;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: asText (r."name"), | ||
| mpg: asDecimal (r . "mpg"), | ||
| cyl: asInteger (r.2), |
There was a problem hiding this comment.
Inconsistent spacing around the dot operator. Lines 96 and 98 have no space before the dot (r."name" and r.2), while all other lines have spaces (r . "mpg"). For consistency, standardize the spacing throughout the file. Based on the majority pattern in this file and other files, the correct format should be r . "name" and r . 2 with spaces around the dot operator.
| name: asText (r."name"), | |
| mpg: asDecimal (r . "mpg"), | |
| cyl: asInteger (r.2), | |
| name: asText (r . "name"), | |
| mpg: asDecimal (r . "mpg"), | |
| cyl: asInteger (r . 2), |
| props.validationContext.accept( | ||
| 'error', | ||
| 'This input must be of type `Collection<text>', | ||
| 'This input must be of type `SheetRow', |
There was a problem hiding this comment.
The error message is missing a closing backtick. It should be 'This input must be of type SheetRow' (with a closing backtick after SheetRow).
| 'This input must be of type `SheetRow', | |
| 'This input must be of type `SheetRow`', |
This PR implements RFC 0021 (#689)