{"action":"created","issue":{"url":"https://api.github.com/repos/databricks/spark-csv/issues/392","repository_url":"https://api.github.com/repos/databricks/spark-csv","labels_url":"https://api.github.com/repos/databricks/spark-csv/issues/392/labels{/name}","comments_url":"https://api.github.com/repos/databricks/spark-csv/issues/392/comments","events_url":"https://api.github.com/repos/databricks/spark-csv/issues/392/events","html_url":"https://github.com/databricks/spark-csv/issues/392","id":186486312,"number":392,"title":"how to write \"DATE\" data type in spark-csv","user":{"login":"engrsriram","id":3539040,"avatar_url":"https://avatars.githubusercontent.com/u/3539040?v=3","gravatar_id":"","url":"https://api.github.com/users/engrsriram","html_url":"https://github.com/engrsriram","followers_url":"https://api.github.com/users/engrsriram/followers","following_url":"https://api.github.com/users/engrsriram/following{/other_user}","gists_url":"https://api.github.com/users/engrsriram/gists{/gist_id}","starred_url":"https://api.github.com/users/engrsriram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/engrsriram/subscriptions","organizations_url":"https://api.github.com/users/engrsriram/orgs","repos_url":"https://api.github.com/users/engrsriram/repos","events_url":"https://api.github.com/users/engrsriram/events{/privacy}","received_events_url":"https://api.github.com/users/engrsriram/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-01T08:56:20Z","updated_at":"2016-11-02T06:54:48Z","closed_at":null,"body":"i have data similar to this. \r\n\r\n```\r\n    no,full_name,Ocupation,DOB\r\n    1,Eugene Perry,Physical Therapy Assistant,11/22/1972\r\n    2,Scott Evans,Account Executive,8/25/1961\r\n    3,Harold Porter,Community Outreach Specialist,4/5/1986\r\n    4,Roger Turner,Account Coordinator,12/24/1989\r\n    5,Patrick Freeman,Geological Engineer,2/11/1990\r\n    6,Jonathan Hart,Safety Technician I,7/24/1963\r\n    7,Susan Jenkins,Nurse,4/17/1967\r\n    8,Jason Graham,Internal Auditor,10/18/1966\r\n    9,Mark Wells,VP Marketing,2/20/1990\r\n\r\n```\r\n\r\nMy Code Similar to this:(Java)\r\n\r\n \r\n\r\n```\r\n     SparkSession spark = SparkSession\r\n                    .builder()\r\n                    .appName(\"Java Spark SQL Example\")\r\n                    .config(\"spark.some.config.option\", \"some-value\")\r\n                    .config(\"spark.sql.warehouse.dir\", \"file:///C:/tmp/\") \r\n                    .getOrCreate();\r\n           \r\n           StructType Const = new StructType(new StructField[] {\r\n       \t\t    new StructField(\"no\", DataTypes.IntegerType, true, Metadata.empty()),\r\n       \t\t    new StructField(\"full_name\", DataTypes.StringType, true, Metadata.empty()),\r\n       \t\t    new StructField(\"Ocupation\", DataTypes.StringType, true, Metadata.empty()),\r\n       \t\t    new StructField(\"DOB\", DataTypes.DateType, true, Metadata.empty())\r\n       \t\t});\r\n    \t\t\t\tDataset<Row> Tem  =  spark.read().format(\"com.databricks.spark.csv\")\r\n    \t\t\t\t\t\t.schema(Const).option(\"header\", \"true\").option(\"delimiter\", \",\").option(\"dateFormat\", \"MM/DD/YYYY\")\r\n    \t\t\t\t\t\t.load(\"E:\\\\Datasets\\\\people.csv\");\r\n    \t\t\r\n    \t\t\t\tTem.show();\r\n    \t\t\t\tTem.printSchema();\r\n    \t\t\t\tTem.coalesce(1).write()\r\n    \t\t\t        .format(\"com.databricks.spark.csv\")\r\n    \t\t\t        .option(\"header\", \"true\").option(\"dateFormat\", \"MM/DD/YYYY\")\r\n    \t\t\t        .save(\"E:\\\\Datasets\\\\output\");\r\n```\r\n\r\nAbove code works fine without errors,but DATE datatype( \"DOB\" )column is not properly printed in flat file. \r\n\r\nmy Actual result is :\r\n\r\n```\r\n    no,full_name,Ocupation,DOB\r\n    1,Eugene Perry,Physical Therapy Assistant,724\r\n    2,Scott Evans,Account Executive,-3287\r\n    3,Harold Porter,Community Outreach Specialist,5841\r\n    4,Roger Turner,Account Coordinator,6940\r\n    5,Patrick Freeman,Geological Engineer,7304\r\n    6,Jonathan Hart,Safety Technician I,-2559\r\n```\r\n\r\neven though i am using `.option(\"dateFormat\", \"MM/DD/YYYY\")` .  in last column , \"DATE\" formatting isn't working in .csv file. \r\ni am not sure what i am missing. \r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/databricks/spark-csv/issues/comments/257786808","html_url":"https://github.com/databricks/spark-csv/issues/392#issuecomment-257786808","issue_url":"https://api.github.com/repos/databricks/spark-csv/issues/392","id":257786808,"user":{"login":"falaki","id":512364,"avatar_url":"https://avatars.githubusercontent.com/u/512364?v=3","gravatar_id":"","url":"https://api.github.com/users/falaki","html_url":"https://github.com/falaki","followers_url":"https://api.github.com/users/falaki/followers","following_url":"https://api.github.com/users/falaki/following{/other_user}","gists_url":"https://api.github.com/users/falaki/gists{/gist_id}","starred_url":"https://api.github.com/users/falaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falaki/subscriptions","organizations_url":"https://api.github.com/users/falaki/orgs","repos_url":"https://api.github.com/users/falaki/repos","events_url":"https://api.github.com/users/falaki/events{/privacy}","received_events_url":"https://api.github.com/users/falaki/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T06:54:48Z","updated_at":"2016-11-02T06:54:48Z","body":"What version of spark-csv are you using? What is your spark version?"}}
{"actor":{"display_login":"falaki"}}