Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add path to package error message #443

Merged
merged 2 commits into from
Dec 12, 2023
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 @@ -126,7 +126,8 @@ public Void visit(SqrlImportDefinition node, Void context) {
Optional<SqrlModule> moduleOpt = moduleLoader.getModule(path.popLast());

if (moduleOpt.isEmpty()) {
addError(ErrorCode.GENERIC, node, "Could not find module [%s]", path);
addError(ErrorCode.GENERIC, node, "Could not find module [%s] at path: [%s]", path,
String.join("/",path.toStringList()));
return null; //end processing
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ public void customerDistinctTest() {
}

@Test
public void missingModuleTestTest() {
ScriptBuilder builder = ScriptBuilder.of("IMPORT point.at.location");
validateScriptInvalid(builder.getScript());
}

public void invalidCustomerDistinctNoOrderTest() {
ScriptBuilder builder = example.getImports();
builder.add("Customer := DISTINCT Customer ON customerid");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public void tableImportTest() {
@Test
public void timestampColumnDefinition() {
String script = ScriptBuilder.of("IMPORT time.*",
"IMPORT ecommerce-data.Customer TIMESTAMP epochToTimestamp(lastUpdated) AS timestamp");
"IMPORT ecommerce-data.Customer TIMESTAMP epochToTimestamp(lastUpdated) AS timestamp")
.toString();
plan(script);
validateQueryTable("customer", TableType.STREAM, ExecutionEngine.Type.STREAM, 7, 1,
TimestampTest.fixed(6));
Expand All @@ -120,7 +121,8 @@ public void timestampColumnDefinition() {
public void timestampColumnDefinitionWithPropagation() {
String script = ScriptBuilder.of("IMPORT time.*",
"IMPORT ecommerce-data.Customer TIMESTAMP epochToTimestamp(lastUpdated) AS timestamp",
"CustomerCopy := SELECT timestamp, endOfMonth(endOfMonth(timestamp)) as month FROM Customer");
"CustomerCopy := SELECT timestamp, endOfMonth(endOfMonth(timestamp)) as month FROM Customer")
.toString();
plan(script);
validateQueryTable("customer", TableType.STREAM, ExecutionEngine.Type.STREAM, 7, 1,
TimestampTest.fixed(6));
Expand Down Expand Up @@ -148,7 +150,8 @@ public void addingSimpleColumns() {
String script = ScriptBuilder.of("IMPORT ecommerce-data.Orders",
"Orders.col1 := (id + customerid)/2",
"Orders.entries.discount2 := coalesce(discount,0.0)",
"OrderEntry := SELECT o.col1, o.time, e.productid, e.discount2, o._ingest_time FROM Orders o JOIN o.entries e");
"OrderEntry := SELECT o.col1, o.time, e.productid, e.discount2, o._ingest_time FROM Orders o JOIN o.entries e")
.toString();
plan(script);
validateQueryTable("orders", TableType.STREAM, ExecutionEngine.Type.STREAM, 7, 1,
TimestampTest.candidates(1,4));
Expand All @@ -169,7 +172,8 @@ public void selfJoinSubqueryTest() {
@Test
public void tableDefinitionTest() {
String sqrl = ScriptBuilder.of("IMPORT ecommerce-data.Orders",
"EntryCount := SELECT e.quantity * e.unit_price - e.discount as price FROM Orders.entries e;");
"EntryCount := SELECT e.quantity * e.unit_price - e.discount as price FROM Orders.entries e;")
.toString();
plan(sqrl);
validateQueryTable("entrycount", TableType.STREAM, ExecutionEngine.Type.STREAM, 4, 2,
TimestampTest.fixed(3)); //4 cols = 1 select col + 2 pk cols + 1 timestamp cols
Expand All @@ -187,7 +191,8 @@ public void nestedAggregationAndSelfJoinTest() {
"Customer := DISTINCT Customer ON customerid ORDER BY _ingest_time DESC",
"Orders.total := SELECT SUM(e.quantity * e.unit_price - e.discount) as price, COUNT(e.quantity) as num, SUM(e.discount) as discount FROM @.entries e",
"OrdersInline := SELECT o.id, o.customerid, o.time, t.price, t.num FROM Orders o JOIN o.total t",
"Customer.orders_by_day := SELECT endOfDay(o.time) as day, SUM(o.price) as total_price, SUM(o.num) as total_num FROM @ JOIN OrdersInline o ON o.customerid = @.customerid GROUP BY day");
"Customer.orders_by_day := SELECT endOfDay(o.time) as day, SUM(o.price) as total_price, SUM(o.num) as total_num FROM @ JOIN OrdersInline o ON o.customerid = @.customerid GROUP BY day")
.toString();
plan(sqrl);
validateQueryTable("total", TableType.STREAM, ExecutionEngine.Type.STREAM, 5, 1,
TimestampTest.fixed(4));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ public String toString() {
return s.toString();
}

public static String of(String... statements) {
public static ScriptBuilder of(String... statements) {
ScriptBuilder s = new ScriptBuilder();
for (String statement : statements) {
s.add(statement);
}
return s.toString();
return s;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
>>>errors
[FATAL] Could not find module [point.at.location] at path: [point/at/location]
in script:<script> [1:1]:
IMPORT point.at.location;
^