Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Add dealing with dates and timestamps from MySQL. #37

Merged
merged 1 commit into from Sep 9, 2016

Conversation

eliasah
Copy link
Member

@eliasah eliasah commented Sep 9, 2016

No description provided.

…-group-by-key

Be smart about group by key. Resolves awesome-spark#27
case x if x.dataType.isInstanceOf[TimestampType] => StructField(x.name, x.dataType, true)
case y if !y.dataType.isInstanceOf[TimestampType] => y
}
}
Copy link
Member

@zero323 zero323 Sep 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

import org.apache.spark.sql.types._

df.schema.map {
  case ts @ StructField(_, TimestampType, false, _) => ts.copy(nullable = true)
  case sf => sf
}

or even more specific:

import org.apache.spark.sql.types._

df.schema.map {
  case ts @ StructField("column_name", _, _, _) => ts.copy(nullable = true)
  case sf => sf
}

@zero323 zero323 merged commit b8de648 into awesome-spark:master Sep 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants