implemented ``cast`` scalar function

can you add a commit here to explain the returnDataType.value(0) ?