vdiravka commented on a change in pull request #2192:
URL: https://github.com/apache/drill/pull/2192#discussion_r610068587
##########
File path:
contrib/format-pcapng/src/main/java/org/apache/drill/exec/store/pcap/PcapBatchReader.java
##########
@@ -48,126 +49,61 @@
private static final Logger logger =
LoggerFactory.getLogger(PcapBatchReader.class);
private FileSplit split;
-
private PacketDecoder decoder;
-
private InputStream fsStream;
-
private RowSetLoader rowWriter;
-
private int validBytes;
-
private byte[] buffer;
-
private int offset;
-
private ScalarWriter typeWriter;
-
private ScalarWriter timestampWriter;
-
private ScalarWriter timestampMicroWriter;
-
private ScalarWriter networkWriter;
-
private ScalarWriter srcMacAddressWriter;
-
private ScalarWriter dstMacAddressWriter;
-
private ScalarWriter dstIPWriter;
-
private ScalarWriter srcIPWriter;
-
private ScalarWriter srcPortWriter;
-
private ScalarWriter dstPortWriter;
-
private ScalarWriter packetLengthWriter;
-
private ScalarWriter tcpSessionWriter;
-
private ScalarWriter tcpSequenceWriter;
-
private ScalarWriter tcpAckNumberWriter;
-
private ScalarWriter tcpFlagsWriter;
-
private ScalarWriter tcpParsedFlagsWriter;
-
private ScalarWriter tcpNsWriter;
-
private ScalarWriter tcpCwrWriter;
-
private ScalarWriter tcpEceWriter;
-
private ScalarWriter tcpFlagsEceEcnCapableWriter;
-
private ScalarWriter tcpFlagsCongestionWriter;
-
private ScalarWriter tcpUrgWriter;
-
private ScalarWriter tcpAckWriter;
-
private ScalarWriter tcpPshWriter;
-
private ScalarWriter tcpRstWriter;
-
private ScalarWriter tcpSynWriter;
-
private ScalarWriter tcpFinWriter;
-
private ScalarWriter dataWriter;
-
private ScalarWriter isCorruptWriter;
-
- private final PcapReaderConfig readerConfig;
-
-
+ private final PcapFormatConfig readerConfig;
// Writers for TCP Sessions
private ScalarWriter sessionStartTimeWriter;
-
private ScalarWriter sessionEndTimeWriter;
-
private ScalarWriter sessionDurationWriter;
-
private ScalarWriter connectionTimeWriter;
-
private ScalarWriter packetCountWriter;
-
private ScalarWriter originPacketCounterWriter;
-
private ScalarWriter remotePacketCounterWriter;
-
private ScalarWriter originDataVolumeWriter;
-
private ScalarWriter remoteDataVolumeWriter;
-
private ScalarWriter hostDataWriter;
-
private ScalarWriter remoteDataWriter;
-
private final int maxRecords;
-
private Map<Long, TcpSession> sessionQueue;
- public static class PcapReaderConfig {
-
- protected final PcapFormatPlugin plugin;
-
- public boolean sessionizeTCPStreams;
-
- private final PcapFormatConfig config;
-
- public PcapReaderConfig(PcapFormatPlugin plugin) {
- this.plugin = plugin;
- this.config = plugin.getConfig();
- this.sessionizeTCPStreams = config.getSessionizeTCPStreams();
- }
- }
-
- public PcapBatchReader(PcapReaderConfig readerConfig, int maxRecords) {
+ public PcapBatchReader(PcapFormatConfig readerConfig, int maxRecords) {
this.readerConfig = readerConfig;
- if (readerConfig.sessionizeTCPStreams) {
+ if (readerConfig.getSessionizeTCPStreams()) {
Review comment:
I have added:
```
SELECT type, packet_length, `timestamp` FROM table(dfs.`pcapng/sniff.pcapng`
(type => 'pcapng', stat => false, sessionizeTCPStreams => true )) where type =
'ARP
```
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/scan/columns/ColumnsScanFramework.java
##########
@@ -103,7 +103,7 @@ protected void configure() {
}
@Override
- protected SchemaNegotiatorImpl newNegotiator() {
+ public SchemaNegotiatorImpl newNegotiator() {
Review comment:
Took this into account with new method:
```
/**
* @return FileScanFramework or empty object in case it is not binded
yet with {@link #bind(ManagedScanFramework)}
*/
protected Optional<FileScanFramework> fileFramework() {
return Optional.ofNullable(fileFramework);
}
```
and
```
It is not possible to detect file format, because the File Framework is not
initialized. " +
"Trying to use default PCAP format plugin to read the file
```
It will help for future new version of `FileReaderFactory`
--
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]