cloud-fan commented on code in PR #49891:
URL: https://github.com/apache/spark/pull/49891#discussion_r1951892767


##########
dev/make-distribution.sh:
##########
@@ -317,9 +317,14 @@ if [ "$MAKE_TGZ" == "true" ]; then
     TARDIR="$SPARK_HOME/$TARDIR_NAME"
     rm -rf "$TARDIR"
     cp -r "$DISTDIR" "$TARDIR"
-    sed -i -e '$s/.*/export SPARK_CONNECT_MODE=1\n&/' "$TARDIR/bin/pyspark"
-    sed -i -e '$s/.*/export SPARK_CONNECT_MODE=1\n&/' "$TARDIR/bin/spark-shell"
-    sed -i -e '$s/.*/export SPARK_CONNECT_MODE=1\n&/' 
"$TARDIR/bin/spark-submit"
+    # Set the Spark Connect system variable in these scripts to enable it by 
default.
+    awk 'NR==1{print; print "export SPARK_CONNECT_MODE=1"; next} {print}' 
"$TARDIR/bin/pyspark" > tmp && cat tmp > "$TARDIR/bin/pyspark"
+    awk 'NR==1{print; print "export SPARK_CONNECT_MODE=1"; next} {print}' 
"$TARDIR/bin/spark-shell" > tmp && cat tmp > "$TARDIR/bin/spark-shell"
+    awk 'NR==1{print; print "export SPARK_CONNECT_MODE=1"; next} {print}' 
"$TARDIR/bin/spark-submit" > tmp && cat tmp > "$TARDIR/bin/spark-submit"
+    awk 'NR==1{print; print "set SPARK_CONNECT_MODE=1"; next} {print}' 
"$TARDIR/bin/pyspark2.cmd" > tmp && cat tmp > "$TARDIR/bin/pyspark2.cmd"
+    awk 'NR==1{print; print "set SPARK_CONNECT_MODE=1"; next} {print}' 
"$TARDIR/bin/spark-shell2.cmd" > tmp && cat tmp > "$TARDIR/bin/spark-shell2.cmd"
+    awk 'NR==1{print; print "set SPARK_CONNECT_MODE=1"; next} {print}' 
"$TARDIR/bin/spark-submit2.cmd" > tmp && cat tmp > 
"$TARDIR/bin/spark-submit2.cmd"

Review Comment:
   Unfortunately, I don't have the Windows environment to test it, but it 
should work.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to