-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-4309][SPARK-4407][SQL] Date type support for Thrift server, and fixes for complex types #3178
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
Conversation
Test build #23122 has started for PR 3178 at commit
|
Test build #23122 has finished for PR 3178 at commit
|
Test PASSed. |
to += from.get(ordinal).asInstanceOf[String] | ||
to += from.getAs[Timestamp](ordinal) | ||
case StringType | BinaryType | _: ArrayType | _: StructType | _: MapType => | ||
to += from.getAs[String](ordinal) |
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.
Does this work? Won't this throw a class cast exception for non-string types?
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.
My fault, neither the original nor the modified code work, should notice this before merging #2685. Will provide a fix for this in this PR soon.
Test build #23376 has started for PR 3178 at commit
|
Test build #23376 has finished for PR 3178 at commit
|
Test PASSed. |
.queryExecution | ||
.asInstanceOf[HiveContext#QueryExecution] | ||
.toHiveString(from.get(ordinal) -> dataTypes(ordinal)) | ||
to += hiveString |
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.
Constructing a query execution for each column/row seems kind of expensive. Can we instead just pull toHiveString
out into a static function?
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.
Also why are we only doing this for Hive 13 and not Hive 12?
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.
We've already done this for Hive 12, however toHiveString
wasn't called back in #2685. Making toHiveString
static sounds good.
7836f88
to
6f71d0b
Compare
Test build #23409 has started for PR 3178 at commit
|
Test build #23409 has finished for PR 3178 at commit
|
Test PASSed. |
@marmbrus This should be good to go now. |
Thanks! Merged to master and 1.2 |
Looks like this broke one of the Maven builds: https://amplab.cs.berkeley.edu/jenkins/job/Spark-Master-SBT/AMPLAB_JENKINS_BUILD_PROFILE=hadoop1.0,label=centos/1061/ |
Err, SBT builds, with the hadoop1.0 profile. |
@@ -147,7 +138,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) { | |||
// countFileSize to count the table size. | |||
def calculateTableSize(fs: FileSystem, path: Path): Long = { | |||
val fileStatus = fs.getFileStatus(path) | |||
val size = if (fileStatus.isDir) { | |||
val size = if (fileStatus.isDirectory) { |
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.
Actually we can't do this:
[ERROR] /home/jenkins/workspace/Spark-Master-Maven-pre-YARN/hadoop.version/1.0.4/label/centos/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala:141: value isDirectory is not a member of org.apache.hadoop.fs.FileStatus
[ERROR] val size = if (fileStatus.isDirectory) {
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.
Ah, sorry for this, will open another PR and revert this change.
…d fixes for complex types SPARK-4407 was detected while working on SPARK-4309. Merged these two into a single PR since 1.2.0 RC is approaching. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/apache/spark/3178) <!-- Reviewable:end --> Author: Cheng Lian <lian@databricks.com> Closes #3178 from liancheng/date-for-thriftserver and squashes the following commits: 6f71d0b [Cheng Lian] Makes toHiveString static 26fa955 [Cheng Lian] Fixes complex type support in Hive 0.13.1 shim a92882a [Cheng Lian] Updates HiveShim for 0.13.1 73f442b [Cheng Lian] Adds Date support for HiveThriftServer2 (Hive 0.12.0) (cherry picked from commit cb6bd83) Signed-off-by: Michael Armbrust <michael@databricks.com>
Replaced this one with #3298. |
…d fixes for complex types This PR is exactly the same as #3178 except it reverts the `FileStatus.isDir` to `FileStatus.isDirectory` change, since it doesn't compile with Hadoop 1. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/apache/spark/3298) <!-- Reviewable:end --> Author: Cheng Lian <lian@databricks.com> Closes #3298 from liancheng/date-for-thriftserver and squashes the following commits: 866037e [Cheng Lian] Revers isDirectory to isDir (it breaks Hadoop 1 profile) 6f71d0b [Cheng Lian] Makes toHiveString static 26fa955 [Cheng Lian] Fixes complex type support in Hive 0.13.1 shim a92882a [Cheng Lian] Updates HiveShim for 0.13.1 73f442b [Cheng Lian] Adds Date support for HiveThriftServer2 (Hive 0.12.0)
…d fixes for complex types This PR is exactly the same as #3178 except it reverts the `FileStatus.isDir` to `FileStatus.isDirectory` change, since it doesn't compile with Hadoop 1. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/apache/spark/3298) <!-- Reviewable:end --> Author: Cheng Lian <lian@databricks.com> Closes #3298 from liancheng/date-for-thriftserver and squashes the following commits: 866037e [Cheng Lian] Revers isDirectory to isDir (it breaks Hadoop 1 profile) 6f71d0b [Cheng Lian] Makes toHiveString static 26fa955 [Cheng Lian] Fixes complex type support in Hive 0.13.1 shim a92882a [Cheng Lian] Updates HiveShim for 0.13.1 73f442b [Cheng Lian] Adds Date support for HiveThriftServer2 (Hive 0.12.0) (cherry picked from commit 6b7f2f7) Signed-off-by: Michael Armbrust <michael@databricks.com>
SPARK-4407 was detected while working on SPARK-4309. Merged these two into a single PR since 1.2.0 RC is approaching.