to_unsigned_long.asciidoc 1.4 KB

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