Sigma-Ma commented on PR #174:
URL: https://github.com/apache/hbase-connectors/pull/174#issuecomment-7077283178
> I got another issue when e2e testing a table with avro schema. Nested
fields pruning seems to be confusing the construction of the scan results, and
can lead to wrong results or even a ClassCastException if the type of columns
returned by HBaseScan.readSchema (after pruning) doesn't match the order of the
full schema.
>
> Tested a fix to turn off this nested pruning by changing
HBaseScanBuilder.pruneColumns to keep individual columns full catalog schema:
>
> ` override def pruneColumns(requiredSchema: StructType): Unit = {
this.requiredSchema = StructType(requiredSchema.fieldNames.map(schema(_))) }`
Thanks for catching this. I reproduced both cases in a Spark 4 MiniCluster.
The scan reports a pruned struct, but the reader returns the full one, so Spark
reads the wrong field by position. I got the first field’s value when selecting
the second string field, and a ClassCastException when selecting the int field.
I’d handle it in a follow-up PR~
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]