Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,11 @@ public static BufferAllocator getBufferAllocator() {
return new DatabricksBufferAllocator();
}
}

/**
* @return true iff the patched Databricks allocator is being used.
*/
public static boolean isUsingPatchedAllocator() {
return !canUseRootAllocator;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class SqlExecutionEvent {
@JsonProperty("operation_detail")
OperationDetail operationDetail;

@JsonProperty("java_uses_patched_arrow")
Boolean javaUsesPatchedArrow;

public SqlExecutionEvent setDriverStatementType(StatementType driverStatementType) {
this.driverStatementType = driverStatementType;
return this;
Expand Down Expand Up @@ -73,6 +76,11 @@ public SqlExecutionEvent setOperationDetail(OperationDetail operationDetail) {
return this;
}

public SqlExecutionEvent setJavaUsesPatchedArrow(Boolean javaUsesPatchedArrow) {
this.javaUsesPatchedArrow = javaUsesPatchedArrow;
return this;
}

@Override
public String toString() {
return new ToStringer(SqlExecutionEvent.class)
Expand All @@ -84,6 +92,7 @@ public String toString() {
.add("chunk_details", chunkDetails)
.add("result_latency", resultLatency)
.add("operation_details", operationDetail)
.add("java_uses_patched_arrow", javaUsesPatchedArrow)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static com.databricks.jdbc.common.util.WildcardUtil.isNullOrEmpty;

import com.databricks.jdbc.api.impl.DatabricksConnection;
import com.databricks.jdbc.api.impl.arrow.ArrowBufferAllocator;
import com.databricks.jdbc.api.internal.IDatabricksConnectionContext;
import com.databricks.jdbc.api.internal.IDatabricksStatementInternal;
import com.databricks.jdbc.common.DatabricksClientConfiguratorManager;
Expand Down Expand Up @@ -117,6 +118,7 @@ private static void exportTelemetryEvent(
.setResultLatency(telemetryDetails.getResultLatency())
.setOperationDetail(telemetryDetails.getOperationDetail())
.setExecutionResultFormat(telemetryDetails.getExecutionResultFormat())
.setJavaUsesPatchedArrow(ArrowBufferAllocator.isUsingPatchedAllocator())
.setChunkId(chunkIndex); // This is only set for chunk download failure logs
telemetryEvent.setSqlOperation(sqlExecutionEvent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -39,6 +41,8 @@ public void testCreateRootAllocator() throws IOException {
assertInstanceOf(RootAllocator.class, allocator, "Should create RootAllocator");
readAndWriteArrowData(allocator);
}

assertFalse(ArrowBufferAllocator.isUsingPatchedAllocator(), "Should use RootAllocator");
}

/**
Expand All @@ -54,6 +58,9 @@ public void testCreateDatabricksBufferAllocator() throws IOException {
DatabricksBufferAllocator.class, allocator, "Should create DatabricksBufferAllocator");
readAndWriteArrowData(allocator);
}

assertTrue(
ArrowBufferAllocator.isUsingPatchedAllocator(), "Should use DatabricksBufferAllocator");
}

/** Write and read a sample arrow data to validate that the BufferAllocator works. */
Expand Down
Loading