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


##########
dev/make-distribution.sh:
##########
@@ -320,12 +320,12 @@ if [ "$MAKE_TGZ" == "true" ]; then
     rm -rf "$TARDIR"
     cp -r "$DISTDIR" "$TARDIR"
     # 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"
+    awk 'NR==1{print; print "export 
SPARK_CONNECT_MODE=${SPARK_CONNECT_MODE:-1}"; next} {print}' 
"$TARDIR/bin/pyspark" > tmp && cat tmp > "$TARDIR/bin/pyspark"

Review Comment:
   I asked chatgpt and we can use awk to replace one line
   ```
   awk '{gsub(/set SPARK_CONNECT_MODE=0/, "set SPARK_CONNECT_MODE=1")}1' 
filename.txt > temp.txt && mv temp.txt filename.txt
   ```



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