Ternary operator in a tranform


Can I do conditional (ternary) operations in a transform such as the following?

@canonicalTransform(condition='(exists(someCondition) && exists(value1) && exists(value2) && exists(Time))')
type TransformCanonicalSomeMeasurementToSomeMeasurementType mixes SomeMeasurementType transforms CanonicalSomeMeasurement {
    field: ~ expression "(someCondition)? {\"id\": \"value1\"}: {\"id\": \"value2\"}"

I’ve tried this and received:

Global Exception:Upsert Batch failed for type= SomeMeasurementType, partitionKey=null, url=null, error=c3.engine.database.DbException: Write failed: Value is required for field partitionKey in type FileDataStaging

(Related: Operations allowed in metric engine)


Your partition key field is empty! make sure you’re filling it with some value.

is field your partition key or is it parent as I see you’re mixing measurement-like type.