Skip to content
Snippets Groups Projects
Commit d188b8ba authored by wangfei's avatar wangfei Committed by Reynold Xin
Browse files

[SQL][Minor] rename DataTypeParser.apply to DataTypeParser.parse

rename DataTypeParser.apply to DataTypeParser.parse to make it more clear and readable.
/cc rxin

Author: wangfei <wangfei1@huawei.com>

Closes #5710 from scwf/apply and squashes the following commits:

c319977 [wangfei] rename apply to parse
parent ca55dc95
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,7 @@ object PhysicalOperation extends PredicateHelper {
}
def collectAliases(fields: Seq[Expression]): Map[Attribute, Expression] = fields.collect {
case a @ Alias(child, _) => a.toAttribute.asInstanceOf[Attribute] -> child
case a @ Alias(child, _) => a.toAttribute -> child
}.toMap
def substitute(aliases: Map[Attribute, Expression])(expr: Expression): Expression = {
......
......@@ -108,7 +108,7 @@ private[sql] object DataTypeParser {
override val lexical = new SqlLexical
}
def apply(dataTypeString: String): DataType = dataTypeParser.toDataType(dataTypeString)
def parse(dataTypeString: String): DataType = dataTypeParser.toDataType(dataTypeString)
}
/** The exception thrown from the [[DataTypeParser]]. */
......
......@@ -23,13 +23,13 @@ class DataTypeParserSuite extends FunSuite {
def checkDataType(dataTypeString: String, expectedDataType: DataType): Unit = {
test(s"parse ${dataTypeString.replace("\n", "")}") {
assert(DataTypeParser(dataTypeString) === expectedDataType)
assert(DataTypeParser.parse(dataTypeString) === expectedDataType)
}
}
def unsupported(dataTypeString: String): Unit = {
test(s"$dataTypeString is not supported") {
intercept[DataTypeException](DataTypeParser(dataTypeString))
intercept[DataTypeException](DataTypeParser.parse(dataTypeString))
}
}
......
......@@ -647,7 +647,7 @@ class Column(protected[sql] val expr: Expression) extends Logging {
*
* @group expr_ops
*/
def cast(to: String): Column = cast(DataTypeParser(to))
def cast(to: String): Column = cast(DataTypeParser.parse(to))
/**
* Returns an ordering used in sorting.
......
......@@ -871,7 +871,7 @@ private[hive] case class MetastoreRelation
private[hive] object HiveMetastoreTypes {
def toDataType(metastoreType: String): DataType = DataTypeParser(metastoreType)
def toDataType(metastoreType: String): DataType = DataTypeParser.parse(metastoreType)
def toMetastoreType(dt: DataType): String = dt match {
case ArrayType(elementType, _) => s"array<${toMetastoreType(elementType)}>"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment