Conversation
MetricMappingHandler.mapOssieToSalesforce() was a stub that discarded every metric mapping and returned without writing anything, so an Ossie model's metrics never appeared in the exported Salesforce semanticCalculatedMeasurements. Wire up the existing generic name/description mapping (mappings.yaml already declared metrics.name/metrics.description, unused until now), and add unwrapExpressions() to flatten each metric's expression into a Salesforce-compatible string. TABLEAU is preferred when present since that is what Salesforce/Tableau CRM speaks; a model authored without one falls back to its ANSI_SQL expression unresolved/untranslated, since actually resolving/rewriting into TABLEAU syntax depends on apache#222's still-open expression-language work, not this fix. A metric with neither dialect fails the conversion with an actionable error naming the metric, rather than being silently dropped. Fixes apache#399
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #399.
MetricMappingHandler.mapOssieToSalesforce()was a stub that discarded every metric mapping and returned without writing tooutputData, so an Ossie model'smetrics[]never appeared in the exported SalesforcesemanticCalculatedMeasurements, even thoughmappings.yamlalready declaredmetrics.name/metrics.descriptionand the reverse (SF→Ossie) direction was fully implemented.Changes
mapOssieToSalesforce()up to the existingGenericMappingEngine.applyMappings()(same patternDatasetMappingHandler/RelationshipMappingHandleralready use), so name/description map through the declared config instead of being silently dropped.unwrapExpressions(), mirroring the existingwrapExpressions()on the SF→Ossie side: flattens each metric'sexpression.dialects[]into the Salesforceexpressionstring field, and mapsdatatypevia the existingSalesforceDataTypeMapper.TABLEAUfirst (what Salesforce/Tableau CRM actually speaks), falling back toANSI_SQLunresolved/untranslated when there's noTABLEAUentry (logged as a warning). Actually resolving/rewriting an expression intoTABLEAUsyntax is out of scope here -- that's Adds a SqlGlot implementation of the OSI SQL dialect #222's expression-language engine (ossie_sql), which is Python and still open/unmerged, with no cross-language story yet for using it from this Java converter. This scope was proposed and left open on Salesforce converter drops OSI metrics during export #399 before starting.TABLEAUnorANSI_SQLexpression fails the conversion with an error naming the metric, rather than being silently omitted -- per Salesforce converter drops OSI metrics during export #399's proposed behavior.Test plan
testMetricsConvertedToSemanticCalculatedMeasurements(name/description/datatype/expression all present, exercising the existing fixture's ANSI_SQL-only metrics via the fallback path).testMetricExpressionPrefersTableauDialectOverAnsiSql(TABLEAU wins when both dialects are present).testMetricWithNoConvertibleDialectFailsConversion(a metric with a schema-valid dialect that is neither TABLEAU nor ANSI_SQL fails loudly and names the metric).testMetricsNotConvertedInOssieToSalesforce, which asserted the bug (assertNullonsemanticCalculatedMeasurements) as the expected behavior.mvn testonconverters/salesforce: 55 run, 0 failures, 0 errors (14 skipped -- pre-existing, gated on the Salesforce JSON schema file not being present in this environment; unrelated to this change).