ostinru commented on code in PR #97:
URL: https://github.com/apache/cloudberry-pxf/pull/97#discussion_r3056179427
##########
server/pxf-jdbc/src/main/java/org/apache/cloudberry/pxf/plugins/jdbc/JdbcResolver.java:
##########
@@ -506,4 +507,19 @@ private <T extends TemporalAccessor> T
parseTemporalAccessor(String rawVal, Date
}
return value;
}
+
+ /**
+ * Converts a BYTEA field value to byte[]. The value can arrive
+ * as byte[] (OutputFormat.GPDBWritable from external-table)
+ * as ByteBuffer (OutputFormat.TEXT from FDW)
+ */
+ private static byte[] toByteArray(Object val) {
+ if (val instanceof byte[]) {
+ return (byte[]) val;
+ }
+ ByteBuffer bb = (ByteBuffer) val;
Review Comment:
There was a bug - it always expected `byte[]`.
Original PXF authors got following error for FDW:
```
ERROR: PXF server error : class java.io.DataInputStream cannot be cast to
class [B (java.io.DataInputStream and [B are in module java.base of loader
'bootstrap')
```
I have seen:
```
ERROR: PXF server error : class java.nio.HeapByteBuffer cannot be cast to
class [B (java.nio.HeapByteBuffer and [B are in module java.base of loader
'bootstrap')
```
So, here I am extending old (external-table) behaviour with one more data
type. So, if it will be some other type - we will see new ClassCastException
here.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]