@@ -35,8 +35,8 @@ import org.apache.comet.shims.CometExprTraitShim
3535 * fuses Arrow input reads, Spark expression evaluation, and Arrow output writes into one
3636 * Janino-compiled method per `(expression, schema)` pair.
3737 *
38- * The kernel is generic over Catalyst expressions and does not assume the bound tree came from a
39- * `ScalaUDF`. Today's only consumer is [[org.apache.comet.udf.codegen.CometScalaUDFCodegen ]].
38+ * The kernel compiles any bound Catalyst expression; the tree need not be rooted at a `ScalaUDF`.
39+ * Today's only consumer is [[org.apache.comet.udf.codegen.CometScalaUDFCodegen ]].
4040 *
4141 * Constraints: one output vector per kernel; per-row scalar evaluation only (aggregate, window,
4242 * generator are rejected by [[canHandle ]]).
@@ -52,11 +52,10 @@ import org.apache.comet.shims.CometExprTraitShim
5252object CometBatchKernelCodegen extends Logging with CometExprTraitShim {
5353
5454 /**
55- * Resolve an Arrow vector class by simple name through the same classloader the codegen uses
56- * internally. The `common` module shades `org.apache.arrow` to `org.apache.comet.shaded.arrow`,
57- * so `classOf[VarCharVector]` at a call site in an unshaded module refers to a different
58- * [[Class ]] object than the one the codegen pattern-matches against. Tests resolve through
59- * this.
55+ * Resolve an Arrow vector class by simple name through the codegen object's own classloader.
56+ * Tests use this to refer to vector classes via the same classloader the codegen pattern-
57+ * matches against, in case the test classpath ever diverges from the codegen's (e.g. through
58+ * future shading rearrangement).
6059 */
6160 def vectorClassBySimpleName (name : String ): Class [_ <: ValueVector ] = name match {
6261 case " BitVector" => classOf [BitVector ]
@@ -234,8 +233,10 @@ object CometBatchKernelCodegen extends Logging with CometExprTraitShim {
234233 ctx.INPUT_ROW = " row"
235234
236235 val baseClass = classOf [CometBatchKernel ].getName
237- // Resolve shaded Arrow class names so generated source matches the abstract method signature
238- // after Maven relocation.
236+ // Resolve Arrow class names at runtime so the generated source matches the method signature
237+ // the running classloader sees. The packaged Comet jar relocates `org.apache.arrow` to
238+ // `org.apache.comet.shaded.arrow` (see `spark/pom.xml`); `.getName` picks the right name
239+ // regardless of whether we run against the shaded jar or the unshaded build output.
239240 val valueVectorClass = classOf [ValueVector ].getName
240241 val fieldVectorClass = classOf [FieldVector ].getName
241242
0 commit comments