Question: I need to shift columns left based on other column in the dataframe. Please note I'm using spark 2.1

```
ID  Col1 Col2 Col3 Col4 shift
1    1    2    3    4     1
2    5    6    7    8     3
3    9    10   11   12    2
4    13   14   15   16    0
5    17   18   19   20    5

```

Expected Output:

```
ID  Col1 Col2 Col3 Col4
1    2    3     4   1
2    8    5     6   7
3    11   12    9   10
4    13   14    15  16
5    18   19    20  17

```

Answer: 
As long as the string in `uartRX_data` is NULL terminated you should be able to use `strcmp` like so:

```
if (strcmp((const char *)uartRX_data, RESP_OK) == 0)
{
  // handle OK
}
else if (strcmp((const char *)uartRX_data, RESP_ERROR) == 0)
{
  // handle ERROR
}
else if (strcmp((const char *)uartRX_data, RESP_FAIL) == 0)
{
  // handle FAIL
}
else
{
  // handle unknown response
}

```
Most conversions between the types `char`, `signed char`, `unsigned char`, `int8_t` and `uint8_t` can be regarded as safe. These are *the character types* and come with various special exceptions that make them more "rugged" than other types.

Specifically, the character types:

* Cannot be misaligned.
* Cannot contain padding bits or trap representations.
* Have exceptions from the effective type/strict aliasing rules.
* Are always of size 1 byte.

Meaning you can do all manner of wild conversions between different character types. With a few exceptions:

* When going from unsigned to signed types the data may not necessarily fit and you'll overwrite the sign bit. This will potentially cause bugs.
* It is dangerous to "cast away" `const` or `volatile` qualifiers, if present.

Therefore it is safe to convert from `uint8_t*` to `char*` and de-reference the data as another type, `(char*)uartRX_data`. Especially if you know that the `uint8_t` array contains valid 7 bit characters only with MSB never set, and with a null termination in the end of the array.