Dealing with null values

Comments

3 comments

  • Avatar
    Derek Hall

    Hi Kelly,

    You can use the if operator with the isNull Operator to replace those values. Try running this:

    collector= dsjobs "emrusage"
    |json auto "fulla.cost", "pyspark.cost", "followrecommendations.cost", "sqoop.cost" as fullacost, pysparkcost, followcost, sqoopcost nodrop
    | if(isNull(sqoopcost), "0", sqoopcost) as sqoopcost
    | if(isNull(follow_cost), "0", follow_cost) as follow_cost
    | (fullacost + pysparkcost + followcost +sqoopcost) as totalcost |timeslice 10m
    |avg(fullacost) as fullaavg, avg(pysparkcost) as pysparkavg, avg(followcost) as followavg, avg(sqoopcost) as sqoopavg, avg(totalcost) as total by timeslice

    Does this accomplish what you're looking for?

    Best,
    Derek

    0
    Comment actions Permalink
  • Avatar
    Kelly Burdine

    Derek

    Thank you! This worked well.

    0
    Comment actions Permalink
  • Avatar
    David Marcoux

    Something like this might work:

    if(isnull(sqoopcost),0,sqoopcost ) as sqoopcost

    0
    Comment actions Permalink

Please sign in to leave a comment.