spark core 2.0 LongArray
来源:互联网 发布:ubuntu 优麒麟 编辑:程序博客网 时间:2024/06/07 06:50
LongArray is an array of long values. Compared with native JVM arrays, this:
1. supports using both in-heap and off-heap memory.
2. has no bound checking, and thus can crash the JVM process when assert is turned off.
The main fields and constructor of LongArray
// This is a long so that we perform long multiplications when computing offsets. private static final long WIDTH = 8; private final MemoryBlock memory; private final Object baseObj; private final long baseOffset; private final long length; public LongArray(MemoryBlock memory) { assert memory.size() < (long) Integer.MAX_VALUE * 8: "Array size > 4 billion elements"; this.memory = memory; this.baseObj = memory.getBaseObject(); this.baseOffset = memory.getBaseOffset(); this.length = memory.size() / WIDTH; }
The set and get method, note that the position the combination of baseOffset and index * WIDTH.
/** * Sets the value at position {@code index}. */ public void set(int index, long value) { assert index >= 0 : "index (" + index + ") should >= 0"; assert index < length : "index (" + index + ") should < length (" + length + ")"; Platform.putLong(baseObj, baseOffset + index * WIDTH, value); } /** * Returns the value at position {@code index}. */ public long get(int index) { assert index >= 0 : "index (" + index + ") should >= 0"; assert index < length : "index (" + index + ") should < length (" + length + ")"; return Platform.getLong(baseObj, baseOffset + index * WIDTH); }
1 0
- spark core 2.0 LongArray
- spark core 2.0 SortShuffleManager
- spark core 2.0 OutputCommitCoordinator
- spark core 2.0 LiveListenerBus
- spark core 2.0 JobProgressListener
- spark core 2.0 YarnClusterManager
- spark core 2.0 YarnClusterSchedulerBackend
- spark core 2.0 Executor
- spark core 2.0 MetricsConfig
- spark core 2.0 ContextCleaner
- spark core 2.0 TransportClientFactory
- spark core 2.0 DiskBlockManager
- spark core 2.0 DiskStore
- spark core 2.0 StorageMemoryPool
- spark core 2.0 ChunkedByteBufferOutputStream
- spark core 2.0 RedirectableOutputStream
- spark core 2.0 UnifiedMemoryManager
- spark core 2.0 ExecutionMemoryPool
- Linux Shell的 & 、&& 、 ||
- YOLO install
- RN1_React Native准备热身(react native 学习)
- windows系统下git的安装
- OKHTTP
- spark core 2.0 LongArray
- BZOJ1027: [JSOI2007]合金
- man使用手册
- Swagger配置手记
- Android源码编译教程之环境搭建
- Leetcode 441. Arranging Coins
- POJ 1390 Blocks (DP)
- Dell 7559 安装Ubuntu以及Nvidia 960M驱动相关问题及解决
- Linux C++ 初次尝试 单链表