-
Notifications
You must be signed in to change notification settings - Fork 702
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
[CARBONDATA-3210] Merge common method into CarbonSparkUtil #3032
Conversation
org.apache.carbondata.examples.S3Example$#getKeyOnPrefix org.apache.carbondata.spark.thriftserver.CarbonThriftServer#getKeyOnPrefix 这三个类中的方法getKeyOnPrefix 合并到spark2/src/main/scala/org/apache/carbondata/spark/util/CarbonSparkUtil.scala
Can one of the admins verify this patch? |
Please describe the change of this PR |
README.md
Outdated
@@ -84,3 +85,6 @@ To get involved in CarbonData: | |||
## About | |||
Apache CarbonData is an open source project of The Apache Software Foundation (ASF). | |||
|
|||
|
|||
## 2018-12-28开始 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the usage of this description? why it has chinese?
def getKeyOnPrefix(path: String): (String, String, String) = { | ||
val endPoint = "spark.hadoop." + ENDPOINT | ||
if (path.startsWith(CarbonCommonConstants.S3A_PREFIX)) { | ||
("spark.hadoop." + ACCESS_KEY, "spark.hadoop." + SECRET_KEY, endPoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated spark.hadoop." literals make the process of refactoring error-prone, since you must be sure to update all occurrences.",I think you can define a variable uniformly.
@xiaohui0318 Please optimize the title, such as change merge to Merge |
@@ -117,4 +116,29 @@ object CarbonSparkUtil { | |||
case _ => | |||
delimiter | |||
} | |||
def getKeyOnPrefix(path: String): (String, String, String) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add empty line before this line
} | ||
|
||
def getS3EndPoint(args: Array[String]): String = { | ||
if (args.length >= 4 && args(3).contains(".com")) args(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you optimize it? for example: change args to length and endPoint, not args(3). Because endpoint maybe is the 3rd or 4th number of parameter. It will error when the order change in args
} | ||
|
||
def getSparkMaster(args: Array[String]): String = { | ||
if (args.length == 6) args(5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you optimize it? like the previous comments
@@ -62,8 +62,7 @@ object CarbonSparkUtil { | |||
/** | |||
* return's the formatted column comment if column comment is present else empty("") | |||
* | |||
* @param carbonColumn | |||
* @return | |||
* @return comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you delete @param carbonColumn?
Have you validate with S3? |
.appName("S3UsingSDKExample") | ||
.config("spark.driver.host", "localhost") | ||
.config(accessKey, args(0)) | ||
.config(secretKey, args(1)) | ||
.config(endpoint, getS3EndPoint(args)) | ||
.config(endpoint,CarbonSparkUtil.getS3EndPoint(args)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a blank before CarbonSparkUtil
@@ -21,8 +21,8 @@ import java.io.File | |||
import org.apache.hadoop.fs.s3a.Constants.{ACCESS_KEY, ENDPOINT, SECRET_KEY} | |||
import org.apache.spark.sql.{Row, SparkSession} | |||
import org.slf4j.{Logger, LoggerFactory} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't remove this blank line
@@ -20,10 +20,10 @@ import org.apache.hadoop.conf.Configuration | |||
import org.apache.hadoop.fs.s3a.Constants.{ACCESS_KEY, ENDPOINT, SECRET_KEY} | |||
import org.apache.spark.sql.SparkSession | |||
import org.slf4j.{Logger, LoggerFactory} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't remove this line
@@ -24,10 +24,10 @@ import org.apache.spark.SparkConf | |||
import org.apache.spark.sql.SparkSession | |||
import org.apache.spark.sql.hive.thriftserver.HiveThriftServer2 | |||
import org.slf4j.{Logger, LoggerFactory} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't remove
add to whitelist |
Build Failed with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10336/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2082/ |
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2287/ |
|
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2088/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2090/ |
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2295/ |
Build Failed with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10344/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2182/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2398/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10438/ |
* | ||
* @param args require three parameters "Access-key" "Secret-key" | ||
* "table-path on s3" "s3-endpoint" "spark-master" | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xiaohui0318 please check the indent of comments, it needs to remove one blank.
Check other comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked and fix
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2185/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2187/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10441/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2403/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10443/ |
LGTM |
|
||
/** | ||
* Generate data and write data to S3 | ||
* User can generate different numbers of data by specifying the number-of-rows in parameters | ||
*/ | ||
object S3UsingSDKExample { | ||
object S3UsingSdkExample { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test it with Huawei OBS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* CarbonThriftServer support different modes: | ||
* 1. read/write data from/to HDFS or local,it only needs configurate storePath | ||
* 2. read/write data from/to S3, it needs provide access-key, secret-key, s3-endpoint | ||
*/ | ||
object CarbonThriftServer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test it with Huawei OBS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
import org.apache.spark.sql.{Row, SparkSession} | ||
import org.slf4j.{Logger, LoggerFactory} | ||
|
||
import org.apache.carbondata.core.constants.CarbonCommonConstants | ||
import org.apache.carbondata.spark.util.CarbonSparkUtil | ||
|
||
object S3Example { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test it with Huawei OBS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2223/ |
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2442/ |
Build Failed with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10480/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2225/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/2226/ |
Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10483/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2445/ |
LGTM! Thanks for you contribution! |
…ample error 1.merge public methods to spark2/src/main/scala/org/apache/carbondata/spark/util/CarbonSparkUtil.scala org.apache.carbondata.examples.S3UsingSDKExample#getKeyOnPrefix org.apache.carbondata.examples.S3Example$#getKeyOnPrefix org.apache.carbondata.spark.thriftserver.CarbonThriftServer#getKeyOnPrefix 2. fix the error of S3UsingSDKExample This closes #3032
…ample error 1.merge public methods to spark2/src/main/scala/org/apache/carbondata/spark/util/CarbonSparkUtil.scala org.apache.carbondata.examples.S3UsingSDKExample#getKeyOnPrefix org.apache.carbondata.examples.S3Example$#getKeyOnPrefix org.apache.carbondata.spark.thriftserver.CarbonThriftServer#getKeyOnPrefix 2. fix the error of S3UsingSDKExample This closes apache#3032
Be sure to do all of the following checklist to help us incorporate
your contribution quickly and easily:
Any interfaces changed?
Any backward compatibility impacted?
Document update required?
Testing done
Please provide details on
- Whether new unit test cases have been added or why no new tests are required?
- How it is tested? Please attach test report.
- Is it a performance related change? Please attach the performance test report.
- Any additional information to help reviewers in testing this change.
For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.