Partition keys should propagate to newly created vertices
Assume a pre-existing graph whose vertices are on different partitions (and thus have different partition keys).
Now, consider adding new vertices through new edges in bulk through the Gremlin API, e.g. like this:
g.V().addE('l').to(__.addV('newVertex').property('PartitionKey', 'p')
This would work just fine but it would possibly place the source and sink vertices into different partitions. If we would want them to remain on the same partition, we're currently lost with CosmosDB.
The Tinkerpop API allows the property-step to specify a traversal, so the following query is actually possible in the Tinkerpop reference implementation and would solve the issue:
g.V().as('source').addE('l').to(.addV('newVertex').property('PartitionKey', .select('source').id())
This would be a feasible workaround. A much cleaner approach however would be to let the partition key propagate to the sink. I am aware that a single Gremlin query may establish multiple out-edges to a single sink, but in this case a best effort-approach is still possible.
