-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: mag1c1an1 <[email protected]> bump up prost Signed-off-by: mag1c1an1 <[email protected]> copy from doris Signed-off-by: mag1c1an1 <[email protected]> add c bindings Signed-off-by: mag1c1an1 <[email protected]> add tests Signed-off-by: mag1c1an1 <[email protected]> write interface in java Signed-off-by: mag1c1an1 <[email protected]> interface 0.1.0 Signed-off-by: mag1c1an1 <[email protected]> cargo clippy && cargo fmt Signed-off-by: mag1c1an1 <[email protected]>
- Loading branch information
Showing
31 changed files
with
1,121 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
lakesoul-common/src/main/java/com/dmetasoul/lakesoul/meta/jnr/SplitDesc.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.dmetasoul.lakesoul.meta.jnr; | ||
|
||
import com.alibaba.fastjson.annotation.JSONField; | ||
import org.apache.commons.lang3.builder.ToStringBuilder; | ||
import org.apache.commons.lang3.builder.ToStringStyle; | ||
|
||
import java.util.List; | ||
|
||
public class SplitDesc { | ||
@JSONField(name = "file_paths") | ||
private List<String> filePaths; | ||
@JSONField(name = "primary_keys") | ||
private List<String> primaryKeys; | ||
@JSONField(name = "partition_desc_array") | ||
private List<String> partitionDescArray; | ||
@JSONField(name = "table_schema") | ||
private String tableSchema; | ||
|
||
public List<String> getFilePaths() { | ||
return filePaths; | ||
} | ||
|
||
public void setFilePaths(List<String> filePaths) { | ||
this.filePaths = filePaths; | ||
} | ||
|
||
public List<String> getPrimaryKeys() { | ||
return primaryKeys; | ||
} | ||
|
||
public void setPrimaryKeys(List<String> primaryKeys) { | ||
this.primaryKeys = primaryKeys; | ||
} | ||
|
||
public List<String> getPartitionDescArray() { | ||
return partitionDescArray; | ||
} | ||
|
||
public void setPartitionDescArray(List<String> partitionDescArray) { | ||
this.partitionDescArray = partitionDescArray; | ||
} | ||
|
||
public String getTableSchema() { | ||
return tableSchema; | ||
} | ||
|
||
public void setTableSchema(String tableSchema) { | ||
this.tableSchema = tableSchema; | ||
} | ||
@Override | ||
public String toString() { | ||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) | ||
.append("file_paths", filePaths) | ||
.append("primary_keys", primaryKeys) | ||
.append("partition_desc_array", partitionDescArray) | ||
.append("table_schema", tableSchema) | ||
.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
lakesoul-spark/src/test/scala/org/apache/spark/sql/lakesoul/JNRTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.apache.spark.sql.lakesoul | ||
|
||
import com.dmetasoul.lakesoul.meta.jnr.NativeMetadataJavaClient | ||
import org.apache.spark.sql._ | ||
|
||
// TODO scala_test | ||
object JNRTest { | ||
def main(args: Array[String]): Unit = { | ||
val spark = SparkSession.builder.master("local") | ||
.config("spark.sql.extensions", "com.dmetasoul.lakesoul.sql.LakeSoulSparkSessionExtension") | ||
// 使用 SQL 功能还需要增加以下两个配置项 | ||
.config("spark.sql.catalog.lakesoul", "org.apache.spark.sql.lakesoul.catalog.LakeSoulCatalog") | ||
.config("spark.sql.defaultCatalog", "lakesoul") | ||
.getOrCreate() | ||
import spark.implicits._ | ||
val df = Seq( | ||
("2021-01-01", 1, "rice1"), | ||
("2021-01-02", 2, "rice2"), | ||
("2021-01-03", 3, "rice3"), | ||
("2021-01-04", 4, "rice4"), | ||
("2021-01-05", 5, "rice5"), | ||
("2021-01-06", 6, "bread"), | ||
("2021-01-01", 7, "rice7") | ||
).toDF("date", "id", "name") | ||
val tablePath = "file:///tmp/lakesoul/lakesoul-test-bucket/data" | ||
//create table | ||
//spark batch | ||
df.write | ||
.mode("append") | ||
.format("lakesoul") | ||
.option("rangePartitions", "date") | ||
.option("hashPartitions", "id") | ||
.option("hashBucketNum", "2") | ||
.save(tablePath) | ||
val descs = NativeMetadataJavaClient.getInstance().createSplitDescArray("", "default"); | ||
println(descs) | ||
} | ||
} |
Oops, something went wrong.