-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: adding isthmus producer
- Loading branch information
Showing
28 changed files
with
541 additions
and
176 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
echo "Enter the absolute path of the substrait-java repo" | ||
read substrait_java_path | ||
cd ${substrait_java_path}/isthmus; ../gradlew shadowJar | ||
cd - | ||
mkdir -p jars | ||
cp ${substrait_java_path}/isthmus/build/libs/*all.jar ./jars/ |
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
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,57 @@ | ||
from pathlib import Path | ||
|
||
import jpype.imports | ||
|
||
import tests.java_definitions as java | ||
|
||
REPO_DIR = Path(__file__).parent.parent | ||
from com.google.protobuf.util import JsonFormat as json_formatter | ||
|
||
schema_file = Path.joinpath(REPO_DIR, "tests/data/tpch_parquet/schema.sql") | ||
|
||
|
||
def produce_isthmus_substrait(sql_string, schema_list): | ||
""" | ||
Produce the substrait plan using Isthmus. | ||
Parameters: | ||
sql_string: | ||
SQL query. | ||
schema_list: | ||
List of schemas. | ||
Returns: | ||
Substrait plan in json format. | ||
""" | ||
sql_to_substrait = java.SqlToSubstraitClass() | ||
java_sql_string = jpype.java.lang.String(sql_string) | ||
plan = sql_to_substrait.execute(java_sql_string, schema_list) | ||
json_plan = json_formatter.printer().print_(plan) | ||
return json_plan | ||
|
||
|
||
def get_schema(file_names): | ||
""" | ||
Create the list of schemas based on the given file names. If there are no files | ||
give, a custom schema for the data is used. | ||
Parameters: | ||
file_names: List of file names. | ||
Returns: | ||
List of all schemas as a java list. | ||
""" | ||
arr = java.ArrayListClass() | ||
if file_names: | ||
text_schema_file = open(schema_file) | ||
schema_string = text_schema_file.read().replace("\n", " ").split(";")[:-1] | ||
for create_table in schema_string: | ||
java_obj = jpype.JObject @ jpype.JString(create_table) | ||
arr.add(java_obj) | ||
else: | ||
java_obj = jpype.JObject @ jpype.JString( | ||
"CREATE TABLE T(a integer, b integer, c boolean, d boolean)" | ||
) | ||
arr.add(java_obj) | ||
|
||
return java.ListClass @ arr |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
from tests.producers import * | ||
|
||
SQL_AGGREGATE = { | ||
"approx_count_distinct": | ||
"approx_count_distinct": ( | ||
""" | ||
SELECT approx_count_distinct(l_comment) | ||
FROM '{}'; | ||
""", | ||
[DuckDBProducer], | ||
), | ||
} |
Oops, something went wrong.