1

While configuring a conditional split component with the following expression:

[VersionStamp_Source] == (DT_I8)[VersionStamp_Destination]

I am getting the following error:

The data type DT_BYTES cannot be used with binary operator "==".

Screenshot:

enter image description here

Hadi
  • 36,233
  • 13
  • 65
  • 124
Gidda
  • 25
  • 6
  • What is the source for your `VersionStamp_Source` and `VersionStamp_Destination` columns? What is the length of your binary strings? – billinkc Nov 20 '21 at 20:34

1 Answers1

1

As shown in the error message, one of the columns used in the conditional split expression has a data type of DT_BYTES which cannot be compared using binary operators.

You need to cast this column to another data type. As mentioned in the official documentation, DT_BYTES can be converted to DT_I8 or to a string data type.

enter image description here

As @billinkc mentioned in the comments, casting DT_BYTES to a string data type is more preferable since some values cannot be converted to an 8-byte integer.

To solve your problem, try using the following expression:

    (DT_WSTR,255)[VersionStamp_Source] == (DT_WSTR,255)[VersionStamp_Destination]

Also, make sure to use an accurate length for the string casting operator. You can increase the string length to 4000

Hadi
  • 36,233
  • 13
  • 65
  • 124
  • 1
    Whether a DT_BYTES can be converted to an integer is entirely dependent upon the length of the binary data. If this is the result of a standard hashing algorithm, even the least good MD2/3/5 will result in a 16byte value which is double what you can store in an 8 byte signed integer. String conversion though makes a lot of sense and one I'd advocate for the user – billinkc Nov 20 '21 at 20:40
  • Well noted, @billinkc. I edited my answer to mention that. Thanks a lot! – Hadi Nov 20 '21 at 21:25
  • 1
    Thanks Hadi , Using the (DT_WSTR,255)[VersionStamp_Source] == (DT_WSTR,255)[VersionStamp_Destination] fixed the issue. – Gidda Nov 21 '21 at 06:18
  • @Gidda please **[mark the answer as accepted](https://stackoverflow.com/tour)** – Hadi Nov 21 '21 at 10:17