I assumed (incorrectly as it turned out) that I was not reading the offsets correctly or something.
> On Jan 5, 2018, at 10:59, Ted Dunning <[email protected]> wrote: > > Yeah... I got the same result. > > I will push my latest shortly (without the boolean stuff) > > On Fri, Jan 5, 2018 at 7:52 AM, Charles Givre <[email protected]> wrote: > >> Ted, >> I’m wondering if we’ve uncovered an unsupported, undocumented feature in >> Drill with respect to the BitWriter. I made the following changes: >> >> >> To PcapRecordReader.java, I added: >> >> >> case "ack_flag": >> if (packet.isTcpPacket()) { >> int flag = (packet.getAckFlag()) ? 1 : 0; >> setBooleanColumnValue(flag, pci, count); >> } >> break; >> ... >> >> private void setBooleanColumnValue(final int data, final >> ProjectedColumnInfo pci, final int count) { >> ((NullableBitVector.Mutator) pci.vv.getMutator()) >> .setSafe(count, data); >> } >> >> Then I added this to PcapFormatUtils >> >> public static int getBit(final byte[] buf, final int posByte, final int >> posBit ) { >> byte valByte = buf[posByte]; >> return valByte >> (8 - (posBit + 1)) & 0x0001; >> } >> >> I added a column in the Schema.java and a function in Packet.java to get >> the bit. I was getting NPEs and I’m wondering now if the cause wasn’t my >> code but rather a problem with the bitwriter. I’m going to play with this >> and see if I can get Drill to write a True/False value at all, and report >> back. If the BitWriter is throwing NPE, I’ll create a JIRA for it. >> >> Thanks for your work on the PCAP format reader. >> —C >> >> >> >>> On Jan 3, 2018, at 17:33, Ted Dunning <[email protected]> wrote: >>> >>> Don't think that will work. >>> >>> I tried what seemed obvious and got a NPE. Joys of Drill. >>> >>> >>> >>> On Wed, Jan 3, 2018 at 1:31 PM, Charles Givre <[email protected]> wrote: >>> >>>> This isn’t the most elegant example, but should do the trick. >>>> >>>> https://github.com/cgivre/drill-network-functions/blob/ >>>> master/src/main/java/org/apache/drill/contrib/function/IsPrivateIP.java >> < >>>> https://github.com/cgivre/drill-network-functions/blob/ >>>> master/src/main/java/org/apache/drill/contrib/function/ >> IsPrivateIP.java> >>>> >>>> >>>> >>>> >>>>> On Jan 3, 2018, at 16:09, Ted Dunning <[email protected]> wrote: >>>>> >>>>> On Wed, Jan 3, 2018 at 12:17 PM, Charles Givre <[email protected]> >> wrote: >>>>> >>>>>> HI Ted, >>>>>> This is really looking amazing. Thank you so much for working on >>>> this. I >>>>>> wanted to ask whether you’ve tried the BitWriter to write a Boolean >>>> value? >>>>>> I’ve done that in UDFs. >>>>> >>>>> >>>>> Point me to an example. I think booleans would be vastly better. >>>> >>>> >> >>
