Non-partitioned Stream Analytics Job output

Viewed 79

In Azure I have an Event Hub with partition count 5 and a Stream Analytics Job which persists data from the hub to blob storage as is in json format. So now there are 5 files created to store incoming data.

Is it possible without changing hub partition to configure stream analytics job so it saves all the data to a single file?

2 Answers

For reference, what is taken into consideration for how to split output files is described here.

In your case, the condition that is met is:

If the query is fully partitioned, and a new file is created for each output partition

That's the trick here, if your query is passthrough (no shuffling around partitions) from event hub (partitioned) to storage account (matching incoming partitions via splitting files) then your job is always fully partitioned.

What you can do, if you don't care about performance, is to break the partition alignment. For that you can repartition your input or your query (via snapshot aggregation).

In my opinion though, you should look into using another tool (ADF, Power BI Dataflow) to process these downstream. You should see those files are landing files, optimized for query throughput. If you remove the partition alignment from your job, you severely limit its capability to scale and absorb spikes in incoming traffic.

After experimenting with partitioning suggested by this answer I found out that my goal can be achieved by changing Stream Analytics Job configuration.

There are different compatibility levels for stream analytics jobs and the latest one at the moment (1.2) introduced automatic parallel query execution for input sources with multiple partitions:

Previous levels: Azure Stream Analytics queries required the use of PARTITION BY clause to parallelize query processing across input source partitions.

1.2 level: If query logic can be parallelized across input source partitions, Azure Stream Analytics creates separate query instances and runs computations in parallel.

So when I changed compatibility level of the job to 1.1 it started to write all the output to a single file in a blob storage.

Related