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-8238][SPARK-8239][SPARK-8242][SPARK-8243][SPARK-8268][SQL]Add ascii/base64/unbase64/encode/decode functions #6843

Closed
wants to merge 6 commits into from

Conversation

chenghao-intel
Copy link
Contributor

Add ascii,base64,unbase64,encode and decode expressions.

@SparkQA
Copy link

SparkQA commented Jun 16, 2015

Test build #34986 has finished for PR 6843 at commit b341b21.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Ascii(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Base64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class UnBase64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Decode(bin: Expression, charset: Expression)
    • case class Encode(value: Expression, charset: Expression)

@chenghao-intel chenghao-intel changed the title [SPARK-8238][SPARK-8239][SPARK-8242][SPARK-8243][SPARK-8268][SQL]add ascii/base64/unbase64/encode/decode functions [SPARK-8238][SPARK-8239][SPARK-8242][SPARK-8243][SPARK-8268][SQL][WIP] Add ascii/base64/unbase64/encode/decode functions Jun 16, 2015
@chenghao-intel
Copy link
Contributor Author

@adrian-wang @zhichao-li can you review the code for me?

@SparkQA
Copy link

SparkQA commented Jun 16, 2015

Test build #34990 has finished for PR 6843 at commit 6a71481.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Ascii(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Base64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class UnBase64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Decode(bin: Expression, charset: Expression)
    • case class Encode(value: Expression, charset: Expression)

}
}

override def toString: String = s"ascii($child)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Upper case these all?

@chenghao-intel chenghao-intel changed the title [SPARK-8238][SPARK-8239][SPARK-8242][SPARK-8243][SPARK-8268][SQL][WIP] Add ascii/base64/unbase64/encode/decode functions [SPARK-8238][SPARK-8239][SPARK-8242][SPARK-8243][SPARK-8268][SQL]Add ascii/base64/unbase64/encode/decode functions Jun 18, 2015
@SparkQA
Copy link

SparkQA commented Jun 18, 2015

Test build #35132 has finished for PR 6843 at commit 05cc18e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Ascii(child: Expression) extends UnaryExpression
    • case class Base64(child: Expression) extends UnaryExpression
    • case class UnBase64(child: Expression) extends UnaryExpression
    • case class Decode(bin: Expression, charset: Expression) extends Expression
    • case class Encode(value: Expression, charset: Expression) extends Expression

@chenghao-intel
Copy link
Contributor Author

@rxin, any more comments on this?

}
}

override def toString: String = s"ASCII($child)"
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think this is necessary since it is a case class?

Copy link
Contributor

Choose a reason for hiding this comment

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

btw i don't think we should be making everything uppercase..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably the registered function name will make more sense, than giving the user a class name. What do you think?

@SparkQA
Copy link

SparkQA commented Jun 23, 2015

Test build #35522 has finished for PR 6843 at commit a5e89b6.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Ascii(child: Expression) extends UnaryExpression
    • case class Base64(child: Expression) extends UnaryExpression
    • case class UnBase64(child: Expression) extends UnaryExpression
    • case class Decode(bin: Expression, charset: Expression) extends Expression
    • case class Encode(value: Expression, charset: Expression) extends Expression

@SparkQA
Copy link

SparkQA commented Jul 2, 2015

Test build #36330 has finished for PR 6843 at commit da6a788.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Ascii(child: Expression) extends UnaryExpression with AutoCastInputTypes
    • case class Base64(child: Expression) extends UnaryExpression with AutoCastInputTypes
    • case class UnBase64(child: Expression) extends UnaryExpression with AutoCastInputTypes
    • case class Decode(bin: Expression, charset: Expression)
    • case class Encode(value: Expression, charset: Expression)

@SparkQA
Copy link

SparkQA commented Jul 2, 2015

Test build #36341 has finished for PR 6843 at commit 947a88a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • trait ExpectsInputTypes
    • trait AutoCastInputTypes
    • abstract class BinaryExpression extends Expression with trees.BinaryNode[Expression]
    • abstract class BinaryOperator extends BinaryExpression
    • abstract class BinaryArithmetic extends BinaryOperator
    • abstract class BinaryComparison extends BinaryOperator with Predicate
    • case class Ascii(child: Expression) extends UnaryExpression with AutoCastInputTypes
    • case class Base64(child: Expression) extends UnaryExpression with AutoCastInputTypes
    • case class UnBase64(child: Expression) extends UnaryExpression with AutoCastInputTypes
    • case class Decode(bin: Expression, charset: Expression)
    • case class Encode(value: Expression, charset: Expression)

@SparkQA
Copy link

SparkQA commented Jul 3, 2015

Test build #36500 has finished for PR 6843 at commit 9d6f9f4.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Factorial(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Ascii(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Base64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class UnBase64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Decode(bin: Expression, charset: Expression) extends Expression with ExpectsInputTypes
    • case class Encode(value: Expression, charset: Expression)

@SparkQA
Copy link

SparkQA commented Jul 3, 2015

Test build #36501 has finished for PR 6843 at commit 78dee7d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Ascii(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Base64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class UnBase64(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class Decode(bin: Expression, charset: Expression) extends Expression with ExpectsInputTypes
    • case class Encode(value: Expression, charset: Expression)

* (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE', 'UTF-16').
* If either argument is null, the result will also be null. (As of Hive 0.12.0.).
*/
case class Decode(bin: Expression, charset: Expression) extends Expression with ExpectsInputTypes {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make this extend BinaryExpression? You can just define def bin = left, and def charset = right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually that's my intention, as I think the parameters is asymmetric semantically. Not sure if you are thinking the code impovement like #7157?

/**
* Decodes the first argument into a String using the provided character set
* (one of 'US-ASCII', 'ISO-8859-1', 'UTF-8', 'UTF-16BE', 'UTF-16LE', 'UTF-16').
* If either argument is null, the result will also be null. (As of Hive 0.12.0.).
Copy link
Contributor

Choose a reason for hiding this comment

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

remove "As of Hive 0.12.0"

@rxin
Copy link
Contributor

rxin commented Jul 4, 2015

I'm going to merge this first. Please submit a cleanup pr.

@asfgit asfgit closed this in f35b0c3 Jul 4, 2015
@chenghao-intel chenghao-intel deleted the str_funcs2 branch July 6, 2015 00:44
asfgit pushed a commit that referenced this pull request Jul 6, 2015
This is a the follow up of #6843.

Author: Cheng Hao <hao.cheng@intel.com>

Closes #7230 from chenghao-intel/str_funcs2_followup and squashes the following commits:

52cc553 [Cheng Hao] update the code as comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants