Skip to content

Sql Select Expressions

The sql_expressions node lets you execute sql expressions on a dataset. It is very useful to select, rename or cast some columns of your dataset rows.

Here is a simple example to select and cast a single column.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
    {
        type: sql_select_expressions
        component: sql_select_expressions
        settings: {
            select_expressions: [
                CAST(value AS STRING)
            ]
        }
        subscribe: [
            {
                component: input
                stream: data
            }
        ]
        publish: [
            {
                stream: data
            }
        ]
    }

to_json and from_json

The spark sql to_json and from_json builtin functions are very useful to deal with json string value.

!!! tip refer to this databrick documentation