Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYUUBI #6305][FOLLOWUP] Improve package Spark SQL engine both Scala 2.12 and 2.13 #6330

Closed
wants to merge 9 commits into from

Conversation

PorterZhang2021
Copy link
Contributor

@PorterZhang2021 PorterZhang2021 commented Apr 21, 2024

🔍 Description

Issue References 🔗

This pull request fixes #6305

Describe Your Solution 🔧

Solution 1 use <profile> - Inappropriate

I found a way to use , roughly as follows:

<profile>
    <id>scala-2.12</id>
    <properties>
        <scala.binary.version>2.12</scala.binary.version>
    </properties>
</profile>

After specifying, I attempted to use

  1. build/mvn install -DskipTests -Dmaven.javadoc.skip=true -Dmaven.scaladoc.skip=true - Dmaven.source.skip -Pscala-2.12 -Pscala-2.13 -pl: kyuubi-spark-sql-engine -am
  2. build/mvn install -DskipTests -Dmaven.javadoc.skip=true -Dmaven.scaladoc.skip=true - Dmaven.source.skip -Pscala-2.13 -Pscala-2.12 -pl: kyuubi-spark-sql-engine -am

Problem

But in the end, it was found that if both '-Pscala-2.12' and '-Pscala-2.13' are used at the same time, '-Pscala2.13' will be selected by default, which may not be a good solution to this problem.

Solution2

Later, I thought about whether it was possible to filter the parameter '$@' internally. It is effective.

Types of changes 🔖

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Test Plan 🧪

  1. scala2.12
    scala_2 12版本spark-sql-engine
    scala_2 12_select 测试
  2. scala2.13
    image
    scala_2 13版本测试

Checklist 📝

Be nice. Be informative.

@pan3793 pan3793 requested a review from yikf April 22, 2024 05:54
@pan3793 pan3793 changed the title [Kyuubi 6305][FOLLOWUP] Improve package Spark SQL engine both Scala 2.12 and 2.13 [KYUUBI #6305][FOLLOWUP] Improve package Spark SQL engine both Scala 2.12 and 2.13 Apr 22, 2024
build/dist Outdated
else
EXTRA_SPARK_ENGINE_BUILD_COMMAND=("$MVN" install $MVN_DIST_OPT $@ -Pscala-2.12 -pl :kyuubi-spark-sql-engine_2.12 -am)
EXTRA_SPARK_ENGINE_BUILD_COMMAND=("$MVN" install $MVN_DIST_OPT -pl ${FILTERED_ARGS[@]} :kyuubi-spark-sql-engine_2.12 -am)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EXTRA_SPARK_ENGINE_BUILD_COMMAND=("$MVN" install $MVN_DIST_OPT -pl ${FILTERED_ARGS[@]} :kyuubi-spark-sql-engine_2.12 -am)
EXTRA_SPARK_ENGINE_BUILD_COMMAND=("$MVN" install $MVN_DIST_OPT ${FILTERED_ARGS[@]} -pl :kyuubi-spark-sql-engine_2.12 -am)

build/dist Outdated
FILTERED_ARGS=()
# shellcheck disable=SC2045
for arg in "$@"; do
if [[ $arg != -Pscala* ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the approach of dealing with parameters If there's no better way, even if it is hack to compare.

Not only are we dealing with arguments like -Pscala*, but we also need -P p1,scala-2.13, -P p1,scala-2.13,p2... -Dscala.version=2.13 and so on.

In addition, we can add some comments to describe it, and if the scala version changes in the future, it can guide the developer to clarify the meaning of this piece and determine whether it needs to change.

build/dist Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.49%. Comparing base (28d8c8e) to head (5524b13).
Report is 16 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6330      +/-   ##
============================================
+ Coverage     58.41%   58.49%   +0.07%     
  Complexity       24       24              
============================================
  Files           653      653              
  Lines         39880    39968      +88     
  Branches       5481     5488       +7     
============================================
+ Hits          23296    23378      +82     
- Misses        14083    14091       +8     
+ Partials       2501     2499       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PorterZhang2021
Copy link
Contributor Author

Hello , I have revised the filtering according to @yikf 's suggestion, but it is not easy to solve the problem of - p scala-2.13 p1. Therefore, I have written a simple prompt for users to use the - pscala-2.13,p1 method, cc @yikf @pan3793

@pan3793
Copy link
Member

pan3793 commented Apr 28, 2024

@PorterZhang2021 thanks for keeping work on this issue. actually, we can replace all mvn args scala-2.12 with scala-2.13 and vice versa

@pan3793
Copy link
Member

pan3793 commented Apr 28, 2024

BTW, the code you pasted is weird, like something produced by OCR?

@PorterZhang2021
Copy link
Contributor Author

@PorterZhang2021 thanks for keeping work on this issue. actually, we can replace all mvn args scala-2.12 with scala-2.13 and vice versa

ok, I will try it again, I'm not quite sure what ocr means. Perhaps there is a part of the content that I searched for Google and inquired about GPT, and then made similar implementations myself, which looks a bit strange. I will make some modifications later.

@pan3793
Copy link
Member

pan3793 commented Apr 29, 2024

OCR means "Optical Character Recognition", what I mean strange part is
image

@PorterZhang2021
Copy link
Contributor Author

cc @pan3793

Copy link
Member

@pan3793 pan3793 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally.

@pan3793 pan3793 added this to the v1.10.0 milestone May 15, 2024
@pan3793 pan3793 closed this in bc394a9 May 15, 2024
@pan3793
Copy link
Member

pan3793 commented May 15, 2024

Thanks, merged to master

pan3793 added a commit that referenced this pull request May 20, 2024
…2.12 and 2.13

# 🔍 Description
## Issue References 🔗

This pull request fixes #6305

## Describe Your Solution 🔧

### Solution 1 use `<profile>` - Inappropriate
I found a way to use <profiles>, roughly as follows:
```xml
<profile>
    <id>scala-2.12</id>
    <properties>
        <scala.binary.version>2.12</scala.binary.version>
    </properties>
</profile>
```
After specifying, I attempted to use
1. `build/mvn install -DskipTests -Dmaven.javadoc.skip=true -Dmaven.scaladoc.skip=true - Dmaven.source.skip -Pscala-2.12 -Pscala-2.13 -pl: kyuubi-spark-sql-engine -am`
2. `build/mvn install -DskipTests -Dmaven.javadoc.skip=true -Dmaven.scaladoc.skip=true - Dmaven.source.skip -Pscala-2.13 -Pscala-2.12 -pl: kyuubi-spark-sql-engine -am`

#### Problem
But in the end, it was found that if both '-Pscala-2.12' and '-Pscala-2.13' are used at the same time, '-Pscala2.13' will be selected by default, which may not be a good solution to this problem.

### Solution2
Later, I thought about whether it was possible to filter the parameter '$' internally. It is effective.

## Types of changes 🔖

- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪
1. scala2.12
![scala_2 12版本spark-sql-engine](https://github.com/apache/kyuubi/assets/96274454/a9f82433-8f73-4bb0-b0f7-7d2725435a0e)
![scala_2 12_select 测试](https://github.com/apache/kyuubi/assets/96274454/fe1cb601-8d19-4dc0-a248-c045176b87a6)
2. scala2.13
![image](https://github.com/apache/kyuubi/assets/96274454/d79ae1cc-64fe-4079-b706-37a21b00b627)
![scala_2 13版本测试](https://github.com/apache/kyuubi/assets/96274454/a4084499-12ea-4150-982a-67aacd16c184)
---

# Checklist 📝

- [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes #6330 from PorterZhang2021/followup-6297.

Closes #6305

5524b13 [Cheng Pan] nit
cccb94d [PorterZhang2021] [# 6297] imporve Package Spark SQL engine both Scala 2.12 and 2.13 Follow Up
fb03d60 [Porter Zhang] Merge branch 'apache:master' into followup-6297
393435e [PorterZhang2021] [# 6297] imporve Package Spark SQL engine both Scala 2.12 and 2.13 Follow Up
0b49f60 [Porter Zhang] Merge branch 'apache:master' into followup-6297
f7c7a65 [PorterZhang2021] [# 6297] Package Spark SQL engine both Scala 2.12 and 2.13 Follow Up
3d2926a [Porter Zhang] Merge branch 'apache:master' into followup-6297
eb64061 [PorterZhang2021] [followup-issue6297] improve issue6297
956ac49 [PorterZhang2021] [# 6297] Package Spark SQL engine both Scala 2.12 and 2.13 Follow Up

Lead-authored-by: PorterZhang2021 <PorterZhang2021@outlook.com>
Co-authored-by: Porter Zhang <96274454+PorterZhang2021@users.noreply.github.com>
Co-authored-by: Cheng Pan <chengpan@apache.org>
Co-authored-by: PorterZhang2021 <porterzhang2021@outlook.com>
Co-authored-by: Porter Zhang <porterzhang2021@outlook.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
@pan3793 pan3793 modified the milestones: v1.10.0, v1.9.1 May 20, 2024
@pan3793
Copy link
Member

pan3793 commented May 20, 2024

Cherry-picked to 1.9.1 to support Spark 4.0.0-preview1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants