mihailom-db commented on code in PR #51335:
URL: https://github.com/apache/spark/pull/51335#discussion_r2191630963


##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/parser/DataTypeAstBuilder.scala:
##########
@@ -165,6 +183,9 @@ class DataTypeAstBuilder extends 
SqlBaseParserBaseVisitor[AnyRef] {
    * Create a complex DataType. Arrays, Maps and Structures are supported.
    */
   override def visitComplexDataType(ctx: ComplexDataTypeContext): DataType = 
withOrigin(ctx) {
+    if (ctx.LT() == null && ctx.NEQ() == null) {
+      throw QueryParsingErrors.nestedTypeMissingElementTypeError(ctx.getText, 
ctx)

Review Comment:
   No, this is refactoring that I did. Previously if someone only writes 
STRUCT/ARRAY/MAP without parameters it would go to path of the primitive type. 
This is not a good practice, so I made a change that complex types are isolated 
in the separate context. The only change here is that we would only change the 
error message for when someone writes `STRUCT(2)` where it would return 
unsupported primitive type instead of the complex type missing element. We 
could argue that this is a change, but if you ask me, we need to distinguish 
between primitive and complex types first, as this is a general practice in 
type theory. We have primitive types which can be used as leaf arguments in 
complex types, we do not want to go into some recursive link between the two.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to