GitHub user hvanhovell opened a pull request:
https://github.com/apache/spark/pull/14832
[SPARK-17263][SQL] Add hexadecimal literal parsing
## What changes were proposed in this pull request?
This PR adds the ability to parse SQL (hexadecimal) binary literals (AKA
bit strings). It follows the following syntax `X'[Hexadecimal Characters]+'`,
for example: `X'01AB'` would create a binary the following binary array
`0x01AB`.
If an uneven number of hexadecimal characters is passed, then the upper 4
bits of the initial byte are kept empty, and the lower 4 bits are filled using
the first character. For example `X'1C7'` would create the following binary
array `0x01C7`.
Binary data (Array[Byte]) does not have a proper `hashCode` and `equals`
function. This meant that comparing `Literal`s containing binary data was a
pain. I have updated Literal.hashCode and Literal.equals to deal properly with
binary data.
## How was this patch tested?
Added tests to the `ExpressionParserSuite`, `SQLQueryTestSuite` and
`ExpressionSQLBuilderSuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/hvanhovell/spark SPARK-17263
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14832.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #14832
----
commit 18537858a43e4648d6dd073daa90e2f83528655e
Author: Herman van Hovell <[email protected]>
Date: 2016-08-26T14:30:14Z
Add hexadecimal literal parsing
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]