kevinjmh opened a new pull request #3398: [CARBONDATA-3501] Fix update table with varchar column
URL:
https://github.com/apache/carbondata/pull/3398
**Problem**
Update on table with varchar column will throw exception:
```
java.lang.Exception: Dataload failed, String length cannot exceed 32000 characters
at org.apache.carbondata.streaming.parser.FieldConverter$.objectToString(FieldConverter.scala:52)
at org.apache.carbondata.spark.util.CarbonScalaUtil$.getString(CarbonScalaUtil.scala:70)
at org.apache.carbondata.spark.rdd.NewRddIterator$$anonfun$next$1.apply$mcVI$sp(NewCarbonDataLoadRDD.scala:357)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
at org.apache.carbondata.spark.rdd.NewRddIterator.next(NewCarbonDataLoadRDD.scala:356)
at org.apache.carbondata.spark.rdd.NewRddIterator.next(NewCarbonDataLoadRDD.scala:333)
at org.apache.carbondata.processing.loading.steps.InputProcessorStepImpl$InputProcessorIterator.getBatch(InputProcessorStepImpl.java:232)
```
**Analyse**
In the loading part of update operation, it gets the `isVarcharTypeMapping` for each column in the order when table created. And this gives a hint for checking string length. It does not allow to exceeds 32000 char for a column which is not varchar type.
However when changing the plan for updating in `CarbonIUDRule`, it first deletes the old expression and *appends* the new one, which makes the order differ to table created. Such that the string length checking fail.
**Solution**
Keep the order as table created when modify update plan
Be sure to do all of the following checklist to help us incorporate
your contribution quickly and easily:
- [ ] Any interfaces changed?
- [ ] Any backward compatibility impacted?
- [ ] Document update required?
- [ ] Testing done
Please provide details on
- Whether new unit test cases have been added or why no new tests are required?
- How it is tested? Please attach test report.
- Is it a performance related change? Please attach the performance test report.
- Any additional information to help reviewers in testing this change.
- [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[hidden email]
With regards,
Apache Git Services