[SPARK-34402][SQL] Group exception about data format schema
### What changes were proposed in this pull request?
Group exception about data format schema of different format, orc/parquet
### Why are the changes needed?
group exception
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Not need
Closes #33296 from AngersZhuuuu/SPARK-34402.
Authored-by: Angerszhuuuu <angers.zhu@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit a63802f2c6
)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
This commit is contained in:
parent
f42cc10512
commit
07c7a6f739
|
@ -586,11 +586,9 @@ private[sql] object ParquetSchemaConverter {
|
|||
|
||||
def checkFieldName(name: String): Unit = {
|
||||
// ,;{}()\n\t= and space are special characters in Parquet schema
|
||||
checkConversionRequirement(
|
||||
!name.matches(".*[ ,;{}()\n\t=].*"),
|
||||
s"""Attribute name "$name" contains invalid character(s) among " ,;{}()\\n\\t=".
|
||||
|Please use alias to rename it.
|
||||
""".stripMargin.split("\n").mkString(" ").trim)
|
||||
if (name.matches(".*[ ,;{}()\n\t=].*")) {
|
||||
throw QueryCompilationErrors.columnNameContainsInvalidCharactersError(name)
|
||||
}
|
||||
}
|
||||
|
||||
def checkFieldNames(schema: StructType): Unit = {
|
||||
|
|
|
@ -3002,8 +3002,8 @@ class HiveDDLSuite
|
|||
spark.sql(s"INSERT OVERWRITE LOCAL DIRECTORY '${path.getCanonicalPath}' " +
|
||||
s"STORED AS PARQUET SELECT ID, if(1=1, 1, 0), abs(id), '^-' FROM v")
|
||||
}.getMessage
|
||||
assert(e.contains("Attribute name \"(IF((1 = 1), 1, 0))\" contains" +
|
||||
" invalid character(s) among \" ,;{}()\\n\\t=\". Please use alias to rename it."))
|
||||
assert(e.contains("Column name \"(IF((1 = 1), 1, 0))\" contains invalid character(s). " +
|
||||
"Please use alias to rename it."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3022,8 +3022,8 @@ class HiveDDLSuite
|
|||
|FROM v
|
||||
""".stripMargin)
|
||||
}.getMessage
|
||||
assert(e.contains("Attribute name \"IF(ID=1,ID,0)\" contains" +
|
||||
" invalid character(s) among \" ,;{}()\\n\\t=\". Please use alias to rename it."))
|
||||
assert(e.contains("Column name \"IF(ID=1,ID,0)\" contains" +
|
||||
" invalid character(s). Please use alias to rename it."))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue