Skip to content

Commit

Permalink
use toSQLId
Browse files Browse the repository at this point in the history
  • Loading branch information
panbingkun committed Oct 16, 2024
1 parent cd8e9db commit 4720854
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.apache.spark.SparkException
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.analysis.{FunctionRegistry, TypeCheckResult, UnresolvedSeed}
import org.apache.spark.sql.catalyst.analysis.TypeCheckResult.DataTypeMismatch
import org.apache.spark.sql.catalyst.expressions.ExpectsInputTypes.{ordinalNumber, toSQLExpr, toSQLType}
import org.apache.spark.sql.catalyst.expressions.ExpectsInputTypes.{ordinalNumber, toSQLExpr, toSQLId, toSQLType}
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, CodeGenerator, ExprCode, FalseLiteral}
import org.apache.spark.sql.catalyst.expressions.codegen.Block._
import org.apache.spark.sql.catalyst.trees.{BinaryLike, TernaryLike, UnaryLike}
Expand Down Expand Up @@ -263,7 +263,7 @@ case class Uniform(min: Expression, max: Expression, seedExpression: Expression,
result = DataTypeMismatch(
errorSubClass = "NON_FOLDABLE_INPUT",
messageParameters = Map(
"inputName" -> name,
"inputName" -> toSQLId(name),
"inputType" -> requiredType,
"inputExpr" -> toSQLExpr(expr)))
} else expr.dataType match {
Expand Down Expand Up @@ -381,7 +381,7 @@ case class RandStr(
result = DataTypeMismatch(
errorSubClass = "NON_FOLDABLE_INPUT",
messageParameters = Map(
"inputName" -> name,
"inputName" -> toSQLId(name),
"inputType" -> requiredType,
"inputExpr" -> toSQLExpr(expr)))
} else expr.dataType match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "seed",
"inputName" : "`seed`",
"inputType" : "integer or floating-point",
"sqlExpr" : "\"uniform(10, 20, col)\""
},
Expand All @@ -211,7 +211,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "min",
"inputName" : "`min`",
"inputType" : "integer or floating-point",
"sqlExpr" : "\"uniform(col, 10, 0)\""
},
Expand Down Expand Up @@ -436,7 +436,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "length",
"inputName" : "`length`",
"inputType" : "INT or SMALLINT",
"sqlExpr" : "\"randstr(col, 0)\""
},
Expand All @@ -459,7 +459,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "seed",
"inputName" : "`seed`",
"inputType" : "INT or SMALLINT",
"sqlExpr" : "\"randstr(10, col)\""
},
Expand Down
8 changes: 4 additions & 4 deletions sql/core/src/test/resources/sql-tests/results/random.sql.out
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "seed",
"inputName" : "`seed`",
"inputType" : "integer or floating-point",
"sqlExpr" : "\"uniform(10, 20, col)\""
},
Expand All @@ -265,7 +265,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "min",
"inputName" : "`min`",
"inputType" : "integer or floating-point",
"sqlExpr" : "\"uniform(col, 10, 0)\""
},
Expand Down Expand Up @@ -520,7 +520,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "length",
"inputName" : "`length`",
"inputType" : "INT or SMALLINT",
"sqlExpr" : "\"randstr(col, 0)\""
},
Expand All @@ -545,7 +545,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
"sqlState" : "42K09",
"messageParameters" : {
"inputExpr" : "\"col\"",
"inputName" : "seed",
"inputName" : "`seed`",
"inputType" : "INT or SMALLINT",
"sqlExpr" : "\"randstr(10, col)\""
},
Expand Down

0 comments on commit 4720854

Please sign in to comment.