to_unsigned_long.asciidoc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. [discrete]
  2. [[esql-to_unsigned_long]]
  3. === `TO_UNSIGNED_LONG`
  4. *Aliases*
  5. `TO_ULONG`, `TO_UL`
  6. *Syntax*
  7. [source,esql]
  8. ----
  9. TO_UNSIGNED_LONG(v)
  10. ----
  11. *Parameters*
  12. `v`::
  13. Input value. The input can be a single- or multi-valued column or an expression.
  14. *Description*
  15. Converts an input value to an unsigned long value.
  16. *Supported types*
  17. The input type must be of a boolean, date, string or numeric type.
  18. If the input parameter is of a date type, its value will be interpreted as
  19. milliseconds since the {wikipedia}/Unix_time[Unix epoch], converted to unsigned
  20. long.
  21. Boolean *true* will be converted to unsigned long *1*, *false* to *0*.
  22. *Example*
  23. [source.merge.styled,esql]
  24. ----
  25. include::{esql-specs}/ints.csv-spec[tag=to_unsigned_long-str]
  26. ----
  27. [%header.monospaced.styled,format=dsv,separator=|]
  28. |===
  29. include::{esql-specs}/ints.csv-spec[tag=to_unsigned_long-str-result]
  30. |===
  31. Note that in this example, the last conversion of the string isn't
  32. possible. When this happens, the result is a *null* value. In this case a
  33. _Warning_ header is added to the response. The header will provide information
  34. on the source of the failure:
  35. `"Line 1:133: evaluation of [TO_UL(str3)] failed, treating result as null. Only first 20 failures recorded."`
  36. A following header will contain the failure reason and the offending value:
  37. `"java.lang.NumberFormatException: Character f is neither a decimal digit number, decimal point, nor \"e\" notation exponential mark."`