Hi,

Try something like

SELECT
    CASE WHEN field1_old is not null THEN field1_old
    ELSE field1_renamed as field1,
    field2,
    field3
FROM yourjsonfiles;

On 15 January 2018 at 04:09, Divya Gehlot <divya.htco...@gmail.com> wrote:

> Hi,
> I am processing json data files in Apache Drill.
>
> Earlier the format of files were
>
> {
>   "field2": [
>     "296dOmWrTK-dunFoei2gQg"
>   ],
>   "field3": {
>     "name": "SE_21",
>     "count": 0
>   },
>   "field1_old": "Qsa87PoaTgCIEab0z8VmgQ",
>   "timestamp": 1514105922659
> }
>
> Later the files format changes to
>
> {
>   "field1_renamed": "OiJ4FeiMEeexdAaIPcVKTA",
>   "filed2": [
>     "kwj5GD3EQYa1joxIWrPWEw"
>   ],
>   "filed3": {
>     "name": "SE_16",
>     "count": 0
>   },
>   "timestamp": 1515545336591
>
>
> The only change in the files data is field1_old and field1_renamed
> I know I can process the files in two queries  and name field 1_old and
> field _renamed as field1
> I am looking for  better ideas to process these files in one query .
>
> Thanks,
> Divya
>

Reply via email to