Reg:JavaScript Parser

Hi ,
I have to parse a log file in following format

2016-06-11 03:19:00 column1=xyz, column2=xyz, column3=xyz

timestamp and first column are not separated by comma so i decided to use javascript parser

My json file for ingestion looks like this

{

“type” : “index”,

“spec” : {

“ioConfig” : {

  "type" : "index",

    "firehose": {

    "type": "local",

    "baseDir": "/home/priyankas",

    "filter": "temp.csv"

  }

},

"dataSchema" : {

  "dataSource" : "ppriyanka",

“parser” : {

“type” : “string”,

    "parseSpec" : {

      "format" : "javascript",

“timestampSpec” : {

            "column": "time",

            "format": "yyyy-MM-dd HH:mm:ss"

      },

“dimensionsSpec” : { “dimensions” : [“time”,“column1”,“column2”,“column3”]

},

“function” : “function(str) {var parts = str.split(”,"); one:parts[0],two:parts[1].substring(0,18);return{one: parts[0],two:parts[1].substr(parts[1].indexOf("=") + 1)} }"

  },

“granularitySpec” : {

    "type" : "uniform",

    "segmentGranularity" : "hour",

    "queryGranularity" : "none",

    "intervals": ["2000/2019"]

},

  "metricsSpec" : [

    {

      "name" : "count",

      "type" : "count"

    }

  ]

}}}}

but i am not able to submit the job it gives me {“error”:“Instantiation of [simple type, class io.druid.segment.indexing.DataSchema] value failed: null”} error.

I am a naive in Druid Can somebody help me out.

Hi,
In the specified json, you have wrongly specified metricsSpec & granularitySpec under parser, they need to be moved out and specified under DataSchema.