Skip to content

Commit

Permalink
update more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed Feb 9, 2015
1 parent fede90a commit f88079f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,17 @@ class Analyzer(catalog: Catalog,
case StructType(fields) =>
val actualField = fields.filter(f => resolver(f.name, fieldName))
if (actualField.length == 0) {
sys.error(
throw new AnalysisException(
s"No such struct field $fieldName in ${fields.map(_.name).mkString(", ")}")
} else if (actualField.length == 1) {
val field = actualField(0)
GetField(expr, field, fields.indexOf(field))
} else {
sys.error(s"Ambiguous reference to fields ${actualField.mkString(", ")}")
throw new AnalysisException(
s"Ambiguous reference to fields ${actualField.mkString(", ")}")
}
case otherType => sys.error(s"GetField is not valid on fields of type $otherType")
case otherType =>
throw new AnalysisException(s"GetField is not valid on columns of type $otherType")
}
}
}
Expand Down

0 comments on commit f88079f

Please sign in to comment.