Skip to content

Commit

Permalink
fix build failures
Browse files Browse the repository at this point in the history
  • Loading branch information
thirtiseven committed Jul 20, 2023
1 parent 9f17539 commit 729fe35
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ case class GpuParseUrl(children: Seq[Expression],

override def checkInputDataTypes(): TypeCheckResult = {
if (children.size > 3 || children.size < 2) {
RapidsErrorUtils.parseUrlWrongNumArgs(children.size)
} else {
super[ExpectsInputTypes].checkInputDataTypes()
RapidsErrorUtils.parseUrlWrongNumArgs(children.size) match {
case res: Some[TypeCheckResult] => return res.get
case _ => // error message has been thrown
}
}
super[ExpectsInputTypes].checkInputDataTypes()
}

private def getPattern(key: UTF8String): RegexProgram = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ object RapidsErrorUtils {
throw new AnalysisException(s"$tableIdentifier already exists.")
}

def parseUrlWrongNumArgs(actual: Int): TypeCheckResult = {
TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments")
def parseUrlWrongNumArgs(actual: Int): Option[TypeCheckResult] = {
Some(TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments"))
}

def invalidUrlException(url: UFT8String, e: Throwable): Throwable = {
def invalidUrlException(url: UTF8String, e: Throwable): Throwable = {
new IllegalArgumentException(s"Find an invaild url string ${url.toString}", e)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ object RapidsErrorUtils {
QueryCompilationErrors.tableIdentifierExistsError(tableIdentifier)
}

def parseUrlWrongNumArgs(actual: Int): TypeCheckResult = {
TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments")
def parseUrlWrongNumArgs(actual: Int): Option[TypeCheckResult] = {
Some(TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments"))
}

def invalidUrlException(url: UTF8String, e: URISyntaxException): Throwable = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ object RapidsErrorUtils {
QueryCompilationErrors.tableIdentifierExistsError(tableIdentifier)
}

def parseUrlWrongNumArgs(actual: Int): TypeCheckResult = {
TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments")
def parseUrlWrongNumArgs(actual: Int): Option[TypeCheckResult] = {
Some(TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments"))
}

def invalidUrlException(url: UTF8String, e: URISyntaxException): Throwable = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ object RapidsErrorUtils extends RapidsErrorUtilsFor330plus {
new ArrayIndexOutOfBoundsException("SQL array indices start at 1")
}

def parseUrlWrongNumArgs(actual: Int): TypeCheckResult = {
TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments")
def parseUrlWrongNumArgs(actual: Int): Option[TypeCheckResult] = {
Some(TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments"))
}

def invalidUrlException(url: UTF8String, e: URISyntaxException): Throwable = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ object RapidsErrorUtils extends RapidsErrorUtilsFor330plus {
QueryExecutionErrors.intervalDividedByZeroError(origin.context)
}

def parseUrlWrongNumArgs(actual: Int): TypeCheckResult = {
TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments")
def parseUrlWrongNumArgs(actual: Int): Option[TypeCheckResult] = {
Some(TypeCheckResult.TypeCheckFailure(s"parse_url function requires two or three arguments"))
}

def invalidUrlException(url: UTF8String, e: URISyntaxException): Throwable = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import java.net.URISyntaxException
import org.apache.spark.SparkDateTimeException
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult
import org.apache.spark.sql.catalyst.trees.{Origin, SQLQueryContext}
import org.apache.spark.sql.errors.QueryExecutionErrors
import org.apache.spark.sql.errors.{QueryCompilationErrors, QueryExecutionErrors}
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types.{DataType, Decimal, DecimalType}
import org.apache.spark.unsafe.types.UTF8String
Expand Down Expand Up @@ -92,10 +92,11 @@ object RapidsErrorUtils extends RapidsErrorUtilsFor330plus {
QueryExecutionErrors.intervalDividedByZeroError(origin.context)
}

def parseUrlWrongNumArgs(actual: Int): Throwable = {
def parseUrlWrongNumArgs(actual: Int): Option[TypeCheckResult] = {
throw QueryCompilationErrors.wrongNumArgsError(
"parse_url", Seq("[2, 3]"), actualNumber
"parse_url", Seq("[2, 3]"), actual
)
None
}

def invalidUrlException(url: UTF8String, e: URISyntaxException): Throwable = {
Expand Down

0 comments on commit 729fe35

Please sign in to comment.