SPLK-1002 · Question #169
Which of the following eval commands will provide a new value for host from src if it exists?
The correct answer is D. | eval host = if (isnotnull (src), src, host). The goal is to replace host with the value of src only when src actually has a value (is not null). Option D - | eval host = if(isnotnull(src), src, host) - correctly reads: 'if src is not null (i.e., it exists and has a value), set host to src; otherwise keep host.' Option A use
Question
Which of the following eval commands will provide a new value for host from src if it exists?
Options
- A| eval host = if (isnu11 (src), src, host)
- B| eval host = if (NOT src = host, src, host)
- C| eval host = if (src = host, src, host)
- D| eval host = if (isnotnull (src), src, host)
How the community answered
(22 responses)- A5% (1)
- C5% (1)
- D91% (20)
Explanation
The goal is to replace host with the value of src only when src actually has a value (is not null). Option D - | eval host = if(isnotnull(src), src, host) - correctly reads: 'if src is not null (i.e., it exists and has a value), set host to src; otherwise keep host.' Option A uses isnull(src) which has the condition backwards (it would use src when it's null). Options B and C compare src to host using equality, which tests whether the values match, not whether src exists - neither reliably checks for field existence.
Topics
Community Discussion
No community discussion yet for this question.