Apache Drill - CONVERT_FROM() Function



The following program shows the query for this function −

Query

0: jdbc:drill:zk = local> Select CONVERT_FROM ('{x:1, y:2}' ,'JSON') AS Convertion from (values(1));

Result

+--------------------+
|     Conversion     |
+--------------------+
|   {"x":1,"y":2}    |
+--------------------+

The above query converts varchar data to JSON format. Similarly, you can use other data types to Drill supported data format. For naming columns, you can use the alias method.

apache_drill_sql_operations.htm
Advertisements