jackylk commented on a change in pull request #3538: [CARBONDATA-3637] Optimize
insert into flow
URL: https://github.com/apache/carbondata/pull/3538#discussion_r376196806
##########
File path:
integration/spark2/src/main/scala/org/apache/spark/sql/execution/datasources/SparkCarbonTableFormat.scala
##########
@@ -509,30 +514,17 @@ private class CarbonOutputWriter(path: String,
// TODO Implement writesupport interface to support writing Row directly to
recordwriter
def writeCarbon(row: InternalRow): Unit = {
- val data = new Array[AnyRef](fieldTypes.length + partitionData.length)
- var i = 0
- val fieldTypesLen = fieldTypes.length
- while (i < fieldTypesLen) {
- if (!row.isNullAt(i)) {
- fieldTypes(i) match {
- case StringType =>
- data(i) = row.getString(i)
- case d: DecimalType =>
- data(i) = row.getDecimal(i, d.precision, d.scale).toJavaBigDecimal
- case other =>
- data(i) = row.get(i, other)
- }
- }
- i += 1
- }
+ val totalLength = fieldTypes.length + partitionData.length
+ val data: Array[AnyRef] =
CommonUtil.getObjectArrayFromInternalRowAndConvertComplexType(row,
+ fieldTypes,
+ totalLength)
if (partitionData.length > 0) {
- System.arraycopy(partitionData, 0, data, fieldTypesLen,
partitionData.length)
+ System.arraycopy(partitionData, 0, data, fieldTypes.length,
partitionData.length)
Review comment:
Is `fieldTypes.length` equal to number of non-partition columns?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services