GitHub user ueshin opened a pull request:
https://github.com/apache/spark/pull/19491
[SPARK-22273][SQL] Fix key/value schema field names in HashMapGenerators.
## What changes were proposed in this pull request?
When fixing schema field names using escape characters with
`addReferenceMinorObj()` at
[SPARK-18952](https://issues.apache.org/jira/browse/SPARK-18952) (#16361),
double-quotes around the names were remained and the names become something
like `"((java.lang.String) references[1])"`.
```java
/* 055 */ private int maxSteps = 2;
/* 056 */ private int numRows = 0;
/* 057 */ private org.apache.spark.sql.types.StructType keySchema = new
org.apache.spark.sql.types.StructType().add("((java.lang.String)
references[1])", org.apache.spark.sql.types.DataTypes.StringType);
/* 058 */ private org.apache.spark.sql.types.StructType valueSchema =
new org.apache.spark.sql.types.StructType().add("((java.lang.String)
references[2])", org.apache.spark.sql.types.DataTypes.LongType);
/* 059 */ private Object emptyVBase;
```
We should remove the double-quotes to refer the values in `references`
properly:
```java
/* 055 */ private int maxSteps = 2;
/* 056 */ private int numRows = 0;
/* 057 */ private org.apache.spark.sql.types.StructType keySchema = new
org.apache.spark.sql.types.StructType().add(((java.lang.String) references[1]),
org.apache.spark.sql.types.DataTypes.StringType);
/* 058 */ private org.apache.spark.sql.types.StructType valueSchema =
new org.apache.spark.sql.types.StructType().add(((java.lang.String)
references[2]), org.apache.spark.sql.types.DataTypes.LongType);
/* 059 */ private Object emptyVBase;
```
## How was this patch tested?
Existing tests.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ueshin/apache-spark issues/SPARK-22273
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/19491.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 #19491
----
commit c23e3d060a473c1d2558c60689a6f552ccbbe6f2
Author: Takuya UESHIN <[email protected]>
Date: 2017-09-28T13:33:35Z
Remove double-quotes around field name.
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]