azure - 如何在 Azure Data Factory 中比较一列与另一列的最大最小值

标签 azure azure-data-factory

enter image description here

enter image description here

enter image description here

在下图中,如上所述,我有两个数据集,并且我在 azure 数据工厂中创建了一个数据流。 我想从 dataset1 获取最大和最小日期并将其与 dataset2 进行比较。 如下面的示例所示,我有 min(date_time) = 11-04-2020 01:17:40 和 max(date_time) = 30-06-2020 22:00:00。因此,介于这两个最大值和最小值之间的日期将与 dataset2 中的 Event_time 列进行比较,所有匹配的日期应在 Dataset1_Data_available 列中打印为“Y”,不匹配的日期应打印为“N”。 谢谢!!

最佳答案

请尝试这个:

我的测试数据流的屏幕截图 enter image description here

1.source1 是您的 Dataset1,“Aggregate1”的设置: enter image description here

enter image description here

“Aggregate1”的数据预览: enter image description here

2.source2是您的Dataset2,“Lookup1”的设置(在查找条件下,请确保左列值永远不等于右列值): enter image description here

enter image description here

“Lookup1”的数据预览: enter image description here

3.使用“DerivedColumn1”更改“Dataset1_Data_available”的值

表达式:iif(greaterOrEqual(Event_time, minDateTime) && lesserOrEqual(Event_time, maxDateTime),'Y','N') enter image description here

“DerivedColumn1”的数据预览 enter image description here

4.您可以在sink中使用“select”或“mapping”删除不需要的列,然后输出结果。

<小时/>

更新

我创建了一些测试样本数据。 sorce1 的数据预览(预计最小日期应为“11-04-2020 01:17:40”,最大日期应为“24-07-2020 08:09:02”): enter image description here

当我们在 'Aggregate1' 中使用 min(date_time)max(date_time) 时(min Date:'07-06-2020 04:30:40' max日期:'30-04-2020 00:56:56'): enter image description here

使用时 min(toTimestamp(substring(date_time, 4, 2)+'-'+substring(date_time, 1,2) + substring(date_time,6,14),'MM-dd-yyyy HH :mm:ss'))max(toTimestamp(substring(date_time, 4, 2)+'-'+substring(date_time, 1,2) + substring(date_time,6,14), 'MM-dd-yyyy HH:mm:ss'))(与我们期望的值相同): enter image description here

关于azure - 如何在 Azure Data Factory 中比较一列与另一列的最大最小值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63615915/

相关文章:

azure - 使用 azure blob 存储的 mp4 流媒体问题

azure - 自动发布数据工厂生成ARM模板

c# - VS 更新破坏了 microsoft.analytics.dll

Azure Powershell 脚本参数

node.js - 用于从 Node 连接到本地服务总线的连接字符串

azure - 将动态内容添加到 Azure 数据工厂中的注释

Azure数据流如何获取最大id并仅返回具有最大id的行

azure-data-factory - 如何使用 Azure 数据工厂和自托管运行时读取本地 csv 文件?

azure - 我们如何使用 Azure Function 重新处理 Cosmos 租赁文档?

azure - 如何在azure发布管道上创建自定义参数