andygrove commented on code in PR #3056:
URL: https://github.com/apache/datafusion-comet/pull/3056#discussion_r2674389168


##########
spark/src/main/scala/org/apache/comet/GenerateDocs.scala:
##########
@@ -148,11 +148,37 @@ object GenerateDocs {
           }
         }
         w.write("<!-- prettier-ignore-end -->\n".getBytes)
+      } else if (line.trim == "<!--BEGIN:CAST_EVAL_MODE_TABLE-->") {
+        w.write("<!-- prettier-ignore-start -->\n".getBytes)
+        w.write("| From Type | To Type | LEGACY | ANSI | TRY |\n".getBytes)
+        w.write("|-|-|-|-|-|\n".getBytes)
+        for (fromType <- CometCast.supportedTypes) {
+          for (toType <- CometCast.supportedTypes) {
+            if (Cast.canCast(fromType, toType) && fromType != toType) {
+              val fromTypeName = fromType.typeName.replace("(10,2)", "")
+              val toTypeName = toType.typeName.replace("(10,2)", "")
+              val legacy = supportLevelStr(
+                CometCast.isSupported(fromType, toType, None, 
CometEvalMode.LEGACY))
+              val ansi = supportLevelStr(
+                CometCast.isSupported(fromType, toType, None, 
CometEvalMode.ANSI))
+              val tryMode = supportLevelStr(
+                CometCast.isSupported(fromType, toType, None, 
CometEvalMode.TRY))
+              w.write(s"| $fromTypeName | $toTypeName | $legacy | $ansi | 
$tryMode |\n".getBytes)
+            }
+          }
+        }
+        w.write("<!-- prettier-ignore-end -->\n".getBytes)
       }
     }
     w.close()
   }
 
+  private def supportLevelStr(level: SupportLevel): String = level match {
+    case Compatible(_) => "Compatible"
+    case Incompatible(_) => "Incompatible"
+    case Unsupported(_) => "Unsupported"

Review Comment:
   it may be necessary to show separate tables for each eval mode rather than 
combine them all in one table once we show the descriptions as well



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