Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm trying to fill up the null values with peek:
Key | Timestamp | New_Field |
---|---|---|
12345 | 01.01.2018 05:45 | Test |
12345 | 01.01.2018 10:00 | |
12345 | 01.01.2018 12:00 | |
12345 | 01.01.2018 13:01 | Test 2 |
12345 | 01.01.2018 15:15 | |
12345 | 01.01.2018 20:33 |
I need this table:
Key | Timestamp | New_Field |
---|---|---|
12345 | 01.01.2018 05:45 | Test |
12345 | 01.01.2018 10:00 | Test |
12345 | 01.01.2018 12:00 | Test |
12345 | 01.01.2018 13:01 | Test 2 |
12345 | 01.01.2018 15:15 | Test 2 |
12345 | 01.01.2018 20:33 | Test 2 |
That is my script:
load
Key,
Timestamp,
if(len(trim(New_Field)) = '0' and peek(Key) = Key, peek(New_Field),New_Field) as New_Field
resident Table
order by Key, Timestamp;
The table I get is:
Key | Timestamp | New_Field |
---|---|---|
12345 | 01.01.2018 05:45 | Test |
12345 | 01.01.2018 10:00 | Test |
12345 | 01.01.2018 12:00 | |
12345 | 01.01.2018 13:01 | Test 2 |
12345 | 01.01.2018 15:15 | Test 2 |
12345 | 01.01.2018 20:33 |
It's not working for all fields.
Can someone please help me?
Try this
LOAD Key,
Timestamp,
New_Field,
If(Len(Trim(New_Field)) = '0' and Peek(Key) = Key, Peek('New_Field1'), New_Field) as New_Field1
Resident Table
Order By Key, Timestamp;
DROP Table Table;
DROP Field New_Field;
RENAME Field New_Field1 to New_Field;
Try this
LOAD Key,
Timestamp,
New_Field,
If(Len(Trim(New_Field)) = '0' and Peek(Key) = Key, Peek('New_Field1'), New_Field) as New_Field1
Resident Table
Order By Key, Timestamp;
DROP Table Table;
DROP Field New_Field;
RENAME Field New_Field1 to New_Field;
That works perfect!
Thank you very much!