Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/11301#discussion_r55941719
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala
---
@@ -418,6 +419,13 @@ abstract class TreeNode[BaseType <:
TreeNode[BaseType]] extends Product {
override def toString: String = treeString
+ def toOriginString: String =
+ if (this.origin.callSite.isDefined &&
!this.isInstanceOf[BoundReference]) {
--- End diff --
While I ran the following SQL, the generated code seems to have comments
properly as follows. Although I will try other SQLs on Monday, I would
appreciate it if you have already had the case that generates comments
improperly.
````
val df = (0 to 4).map(i => (i.toString, i.toInt, i.toFloat)).toDF("s",
"i", "f")
df.registerTempTable("tempTable")
sqlContext.sql("select i, f from tempTable WHERE i <= 3 and f >
1.0").show()
````
Part of the generated code
````java
/* 039 */ while (!shouldStop() && inputadapter_input.hasNext()) {
/* 040 */ InternalRow inputadapter_row = (InternalRow)
inputadapter_input.next();
/* 041 */ /*** CONSUME: Filter ((_2#1 <= 3) && (cast(_3#2 as double)
> 1.0)) */
/* 042 */ /* input[1, int] */
/* 043 */ int filter_value1 = inputadapter_row.getInt(1);
/* 044 */ /* input[2, float] */
/* 045 */ float filter_value2 = inputadapter_row.getFloat(2);
/* 046 */
/* 047 */ /* (input[1, int] <= 3) @ sql at Dataframe1.scala:13 */
/* 048 */ boolean filter_value3 = false;
/* 049 */ filter_value3 = filter_value1 <= 3;
/* 050 */ if (!filter_value3) continue;
/* 051 */
/* 052 */ /* (cast(input[2, float] as double) > 1.0) @ sql at
Dataframe1.scala:13 */
/* 053 */ /* cast(input[2, float] as double) @ sql at
Dataframe1.scala:13 */
/* 054 */ boolean filter_isNull7 = false;
/* 055 */ double filter_value7 = -1.0;
/* 056 */ if (!false) {
/* 057 */ filter_value7 = (double) filter_value2;
/* 058 */ }
/* 059 */
/* 060 */ boolean filter_value6 = false;
/* 061 */ filter_value6 =
org.apache.spark.util.Utils.nanSafeCompareDoubles(filter_value7, 1.0D) > 0;
/* 062 */ if (!filter_value6) continue;
````
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]