Repository navigation
fix(salesforce): emit the Tua expression syntax on calculated dimensions - #539
Conversation
A calculated dimension declared the Ossie dialect name as its expression syntax, which the Salesforce semantic model API rejects with "Invalid value for Invalid Expression Syntax Type: TABLEAU", failing the whole model. Calculated measurements already emit "Tua", the only syntax type the API accepts; name it once and use it on both paths.
jbonofre
left a comment
There was a problem hiding this comment.
It looks good overall. Switching calculated dimensions to syntax: Tua and sharing the constants with MetricMappingHandler is consistent, and the export and round-trip tests cover the change.
I have one question: the metric path compiles expressions through the Tua compiler before writing syntax: Tua. createSemanticCalculatedDimension copies the Tableau-style expression through unchanged (e.g. YEAR([Orders].[order_data])) and only relabels it. Is that text already valid Tua, or could Salesforce reject it on import? If it's been verified against a real org, a short note in the PR would be enough. If not, it may be worth running dimension expressions through the same compiler.
I would be happy to approve once that's clarified.
|
Verified against a live org, so I have added the note to the description. The Tableau text passes through unchanged and is accepted: the model posts Reusing the metric compiler is not possible as it stands. Checked on this branch:
|
jbonofre
left a comment
There was a problem hiding this comment.
LGTM! Thanks @RyutoYoda!
The fix cleanly aligns calculated dimensions with measurements using ConverterConstants.SYNTAX_TUA, and resolves the round-trip preservation bug. Full test suite and license checks pass cleanly.
Summary
With #526 and #532 merged an Ossie model now reaches the Salesforce semantic model
API, and this is the next failure it hits. Thanks for the quick reviews on those.
FieldMappingHandler.createSemanticCalculatedDimensionwrites the Ossie dialectname as the expression syntax. The API only accepts
Tua, so a model carryingeven one calculated dimension is rejected in full:
Calculated measurements already emit
TuainMetricMappingHandler, so only thedimension path is affected. The round trip breaks for the same reason:
syntaximported from Salesforce is kept in
custom_extensions, butrestoreSalesforceCustomExtensiondoes not overwrite a key the export alreadywrote, so the stored
Tuanever comes back.SYNTAXandSYNTAX_TUAare now named inConverterConstantsand used on bothpaths, so the one accepted value lives in a single place.
Salesforce's own published model carries no
syntaxon its calculateddimensions, so omitting the key works too;
Tuais used here to match themeasurement path.
Verification
Against a live org (
v66.0 ssot/semantic/models), one synthetic model with asingle calculated dimension:
syntaxTABLEAU400, model rejectedTua201, persisted asTua,isQueryable: Queryable201, persisted with no syntaxA model generated by the patched converter posts with
201. The Tableau-dialectexpression is passed through unchanged, and the dimension persists with
isQueryable: Queryable; a query grouping by it returns rows, so the text isevaluated as Tua. Every model created for this was deleted again.
Related Issues
No existing issue covers this.
Checklist
Sections this change does not touch (Specification, Ontology, Validation,
Documentation, Examples) are omitted rather than left unchecked.
Converters
Tests
mvn -B -DrequireSalesforceSchema=true clean verify: 301 tests, 0 failures, 0 errors, 0 skipped;apache-rat:checkcleanexpected: <Tua> but was: <TABLEAU>Compliance