Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update checkInputColumn to print more info if needed
  • Loading branch information
rekhajoshm committed Jul 2, 2015
commit 33ddd2e3fa56212f48c748dee7751eeafe6763f0
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ object SchemaUtils {
* @param colName column name
* @param dataType required column data type
*/
def checkColumnType(schema: StructType, colName: String, dataType: DataType,
def checkColumnType(schema: StructType,
colName: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please follow the Spark code style guide and use 4-space indentation for arguments: https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide

dataType: DataType,
msg: String = ""): Unit = {
val actualDataType = schema(colName).dataType
val message = if (msg != null && msg.trim.length > 0) " " + msg else ""
require(actualDataType.equals(dataType),
s"Column $colName must be of type $dataType but was actually $actualDataType.$msg")
s"Column $colName must be of type $dataType but was actually $actualDataType.$message")
}

/**
Expand Down