所以,我正在尝试实现一个数据结构来处理动态订单统计.数据结构具有以下操作:
我使用平衡的AVL树实现了我的数据结构.使用此操作具有以下时间复杂度:
这是我使用O(log(n))时间的get(k)的实现:
public static int get(Node current, int k) {
int l = tree.sizeLeft(current) + 1;
if(k == l) {
return current.value;
} else if(k < l) {
if(current.left == null) {
return current.value;
}
return get(current.left, k);
} else {
if(current.right == null) {
return current.value;
}
return get(current.right, k);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我对节点类的实现:
class Node {
int height, value, bal, size; // bal = balanceFactor, size = amount of …Run Code Online (Sandbox Code Playgroud) 我有一些使用 PyArrow (Apache Arrow) 用 Python 编写的 Parquet 文件:
pyarrow.parquet.write_table(table, "example.parquet")
Run Code Online (Sandbox Code Playgroud)
现在我想使用 Java 程序读取这些文件(最好是获取一个箭头表)。
在 Python 中,我可以简单地使用以下命令从 Parquet 文件中获取一个箭头表:
table = pyarrow.parquet.read_table("example.parquet")
Run Code Online (Sandbox Code Playgroud)
Java 中是否有等效且简单的解决方案?
我真的找不到任何好的/工作示例或任何有用的 Java 文档(仅适用于 Python)。或者一些示例没有提供所有需要的 Maven 依赖项。我也不想使用 Hadoop 文件系统,我只想使用本地文件。
注意:我还发现我不能使用“Apache Avro”,因为我的 Parquet 文件包含带有符号的列名[,]并且$它们在 Apache Avro 中是无效字符。
另外,如果您的解决方案使用 Maven,您能否提供 Maven 依赖项。
我在 Windows 上使用 Eclipse。
更新(2020 年 11 月):我从未找到合适的解决方案,只是在我的用例中坚持使用 Python。