Skip to content

Commit 03d0604

Browse files
committed
Adding logging for java in parquet-data-format module and cleaning up stale files
Signed-off-by: Raghuvansh Raj <[email protected]>
1 parent a7c4ff3 commit 03d0604

File tree

10 files changed

+46
-551
lines changed

10 files changed

+46
-551
lines changed

modules/parquet-data-format/src/main/java/com/parquet/parquetdataformat/memory/MemoryPressureMonitor.java

Lines changed: 0 additions & 274 deletions
This file was deleted.

modules/parquet-data-format/src/main/java/com/parquet/parquetdataformat/vsr/ManagedVSR.java

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import org.apache.arrow.c.ArrowArray;
1111
import org.apache.arrow.c.ArrowSchema;
1212
import org.apache.arrow.c.Data;
13+
import org.apache.logging.log4j.LogManager;
14+
import org.apache.logging.log4j.Logger;
1315

1416
import java.util.concurrent.atomic.AtomicReference;
1517
import java.util.concurrent.locks.ReadWriteLock;
@@ -23,6 +25,8 @@
2325
*/
2426
public class ManagedVSR implements AutoCloseable {
2527

28+
private static final Logger logger = LogManager.getLogger(ManagedVSR.class);
29+
2630
private final String id;
2731
private final VectorSchemaRoot vsr;
2832
private final BufferAllocator allocator;
@@ -109,9 +113,7 @@ public FieldVector getVector(String fieldName) {
109113
public void setState(VSRState newState) {
110114
VSRState oldState = state.getAndSet(newState);
111115

112-
System.out.println(String.format(
113-
"[VSR] State transition: %s -> %s for VSR %s",
114-
oldState, newState, id));
116+
logger.debug("State transition: {} -> {} for VSR {}", oldState, newState, id);
115117
}
116118

117119
/**
@@ -226,34 +228,4 @@ public String toString() {
226228
return String.format("ManagedVSR{id='%s', state=%s, rows=%d, immutable=%s}",
227229
id, state.get(), getRowCount(), isImmutable());
228230
}
229-
230-
public static void main(String[] args) {
231-
RootAllocator allocator = new RootAllocator();
232-
BigIntVector vector = new BigIntVector("vector", allocator);
233-
vector.allocateNew(10);
234-
vector.set(0, 100); // Set position 0
235-
// vector.setNull(1);
236-
vector.set(2, 300); // Set position 2
237-
// Position 1 is not set!
238-
vector.setValueCount(3); // Claims vector has 3 elements
239-
240-
// Position 1 now contains undefined data
241-
// long value = vector.get(1); // Could be any value!
242-
System.out.println(readBit(vector.getValidityBuffer(), 0));
243-
System.out.println(readBit(vector.getValidityBuffer(), 1));
244-
System.out.println(readBit(vector.getValidityBuffer(), 2));
245-
System.out.println(readBit(vector.getValidityBuffer(), 3));
246-
}
247-
248-
public static byte readBit(ArrowBuf validityBuffer, long index) {
249-
// it can be observed that some logic is duplicate of the logic in setValidityBit.
250-
// this is because JIT cannot always remove the if branch in setValidityBit,
251-
// so we give a dedicated implementation for setting bits.
252-
final long byteIndex = byteIndex(index);
253-
254-
// the byte is promoted to an int, because according to Java specification,
255-
// bytes will be promoted to ints automatically, upon expression evaluation.
256-
// by promoting it manually, we avoid the unnecessary conversions.
257-
return validityBuffer.getByte(byteIndex);
258-
}
259231
}

0 commit comments

Comments
 (0)