You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/04/12 04:32:09 UTC

[GitHub] [spark] kiszk commented on a change in pull request #28184: [SPARK-31416][SQL] Check more strictly that a field name can be used as a valid Java identifier for codegen

kiszk commented on a change in pull request #28184: [SPARK-31416][SQL] Check more strictly that a field name can be used as a valid Java identifier for codegen
URL: https://github.com/apache/spark/pull/28184#discussion_r407144383
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
 ##########
 @@ -539,9 +541,10 @@ object ScalaReflection extends ScalaReflection {
 
         val params = getConstructorParameters(t)
         val fields = params.map { case (fieldName, fieldType) =>
-          if (javaKeywords.contains(fieldName)) {
-            throw new UnsupportedOperationException(s"`$fieldName` is a reserved keyword and " +
-              "cannot be used as field name\n" + walkedTypePath)
+          if (SourceVersion.isKeyword(fieldName) ||
 
 Review comment:
   While the reserved keywords depend on Janino though, `SourceVersion.isKeyword(fieldName)` would have the super set of keywords that Janino cannot accept. I think that this change is reasonable. We can avoid maintain `javaKeywords`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org