Azure数据工厂根据行数动态地对csv/txt文件进行分区 [英] Azure Data Factory DYNAMICALLY partition a csv/txt file based on rowcount

查看:78
本文介绍了Azure数据工厂根据行数动态地对csv/txt文件进行分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用azure数据流将定界文件(csv/txt)转换为json.但是我想根据最大行数5,000动态地分离文件,因为我不会每次都知道行数.因此,如果我有一个具有10,000行的csv文件,则管道将输出两个相等的json文件,分别为file1.json和file2.json.在Azure数据工厂中根据行数实际获取源行数和正确的n个分区的最佳方法是什么?

I am using azure dataflow to transform delimited files (csv/txt) to json. But I want to separate the files dynamically based on a max row count of 5,000 because I will not know the row count every time. So if I have a csv file with 10,000 rows the pipeline will output two equal json files, file1.json and file2.json. What is the best way to actually get the row count of my sources and the correct n number of partitions based on that row count within Azure Data Factory?

推荐答案

一种方法是使用mod或%运算符.

One way to achieve this is to use the mod or % operator.

  1. 首先要在CSV文件上设置代理密钥,或在数据中使用任何顺序的密钥.
  2. 添加包含group by子句的聚合步骤,该子句是您的关键%行计数
  3. 将Aggregates函数设置为collect()

您的输出现在应该是一个行数组,每行中都包含预期的计数.

Your output should now be a array of rows with the expected count in each.

这篇关于Azure数据工厂根据行数动态地对csv/txt文件进行分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆