sijie commented on a change in pull request #2515: support nested fields in
Pulsar presto connector
URL: https://github.com/apache/incubator-pulsar/pull/2515#discussion_r215721822
##########
File path:
pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/AvroSchemaHandler.java
##########
@@ -55,9 +55,23 @@ public Object deserialize(byte[] bytes) {
public Object extractField(int index, Object currentRecord) {
try {
GenericRecord record = (GenericRecord) currentRecord;
- return
record.get(this.columnHandles.get(index).getPositionIndex());
+ PulsarColumnHandle pulsarColumnHandle =
this.columnHandles.get(index);
+ Integer[] positionIndices =
pulsarColumnHandle.getPositionIndices();
+ Object curr = record.get(positionIndices[0]);
+ if (curr == null) {
+ return null;
+ }
+ if (positionIndices.length > 0) {
+ for (int i = 1 ; i < positionIndices.length; i++) {
+ curr = ((GenericRecord) curr).get(positionIndices[i]);
+ if (curr == null) {
+ return null;
+ }
+ }
+ }
+ return curr;
} catch (Exception ex) {
- log.error(ex);
+ log.debug(ex,"%s", ex);
Review comment:
interesting... why we were using airlift logger not slf4j logger?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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