CONVERT_FROM

Converts a binary string from the given data type to a Spice type.

Syntax

CONVERT_FROM(binary_value value_to_convert, data_type name_of_type) → varies

  • binary_value: The binary string to convert to a Spice data type.

  • data_type: The data type of the specified binary string.

Examples

Returns a LIST from the specified JSON.
SELECT CONVERT_FROM('["apple", "strawberry", "banana"]', 'json')
-- ['apple', 'strawberry', 'banana']
Returns a STRUCT from the specified JSON.
SELECT CONVERT_FROM('{"name":"Gnarly", "age":7, "car":null}', 'json')
-- {"name:"Gnarly","age":7}

Usage Notes

You can convert from binary values that are in these data formats:

  • BIGINT_BE

  • BIGINT_HADOOPV

  • BIGINT

  • BOOLEAN_BYTE

  • DATE_EPOCH_BE

  • DATE_EPOCH

  • DOUBLE_BE

  • DOUBLE

  • FLOAT_BE

  • FLOAT

  • INT_BE

  • INT_HADOOPV

  • INT

  • JSON

  • TIME_EPOCH_BE

  • TIME_EPOCH

  • TIMESTAMP_EPOCH_BE

  • TIMESTAMP_EPOCH

  • TIMESTAMP_IMPALA_LOCALTIMEZONE

  • TIMESTAMP_IMPALA

  • UTF8

Last updated