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

[SPARK-8227][SQL]Add function unhex #7113

Closed
wants to merge 8 commits into from
Closed

Conversation

zhichao-li
Copy link
Contributor

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@SparkQA
Copy link

SparkQA commented Jun 30, 2015

Test build #36100 has started for PR 7113 at commit c852d46.

@SparkQA
Copy link

SparkQA commented Jun 30, 2015

Test build #36100 has finished for PR 7113 at commit c852d46.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnHex(child: Expression)

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@SparkQA
Copy link

SparkQA commented Jun 30, 2015

Test build #36109 has started for PR 7113 at commit 11945c7.

@SparkQA
Copy link

SparkQA commented Jun 30, 2015

Test build #36109 has finished for PR 7113 at commit 11945c7.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@SparkQA
Copy link

SparkQA commented Jun 30, 2015

Test build #36111 has started for PR 7113 at commit cde73f5.

@SparkQA
Copy link

SparkQA commented Jun 30, 2015

Test build #36111 has finished for PR 7113 at commit cde73f5.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnHex(child: Expression)

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

if (num == null) {
null
} else {
unhex(num.asInstanceOf[UTF8String].toString)
Copy link
Contributor

Choose a reason for hiding this comment

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

Converting UTF8String to String is slow, please use getBytes

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@SparkQA
Copy link

SparkQA commented Jul 1, 2015

Test build #36223 has started for PR 7113 at commit bffd37f.

@SparkQA
Copy link

SparkQA commented Jul 1, 2015

Test build #36223 has finished for PR 7113 at commit bffd37f.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnHex(child: Expression)

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@zhichao-li
Copy link
Contributor Author

reset this please

case class UnHex(child: Expression)
extends UnaryExpression with AutoCastInputTypes with Serializable {

override def expectedChildTypes: Seq[DataType] = Seq(StringType)
Copy link
Contributor

Choose a reason for hiding this comment

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

@davies this could be changed to ByteType, couldn't it? This avoids a cast, if someone calls this with a byte array.

Copy link
Contributor

Choose a reason for hiding this comment

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

hex() return StringType, so unhex() should take StringType, not BinaryType.

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@zhichao-li zhichao-li changed the title [SPARK-8227][SQL][WIP]Add function unhex [SPARK-8227][SQL]Add function unhex Jul 1, 2015
@SparkQA
Copy link

SparkQA commented Jul 1, 2015

Test build #36262 has started for PR 7113 at commit a4ae6dc.

@SparkQA
Copy link

SparkQA commented Jul 1, 2015

Test build #36262 has finished for PR 7113 at commit a4ae6dc.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnHex(child: Expression) extends UnaryExpression with Serializable

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

}

private def toDigit(b: Byte): Byte = {
val digit = hexDigits(b)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a val of UnHex.

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@SparkQA
Copy link

SparkQA commented Jul 2, 2015

Test build #36320 has started for PR 7113 at commit 379356e.

@SparkQA
Copy link

SparkQA commented Jul 2, 2015

Test build #36320 has finished for PR 7113 at commit 379356e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnHex(child: Expression) extends UnaryExpression with Serializable

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@davies
Copy link
Contributor

davies commented Jul 2, 2015

LGTM, merging this into master, thanks!

@asfgit asfgit closed this in b285ac5 Jul 2, 2015
* Performs the inverse operation of HEX.
* Resulting characters are returned as a byte array.
*/
case class UnHex(child: Expression) extends UnaryExpression with Serializable {
Copy link
Contributor

Choose a reason for hiding this comment

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

this should just implement ExpectsInputTypes, and use BinaryType as the only type.

There will be a rule in #7175 to do implicit type casting from null type to expected type(s).

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