Skip to content
Open
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
68 changes: 68 additions & 0 deletions guides/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,71 @@ eval "$RUNNER \
Then you should be able to see outputs like this:

![img.png](../images/wordcount_result.png)
## Running SQL Queries in Wayang

Wayang provides support for executing SQL queries using its SQL API.

### Example

```sql
SELECT * FROM my_table;
### Steps to execute SQL queries

1. Configure the Wayang Calcite model using the property:
`wayang.calcite.model`

2. Create a `SqlContext` instance:

```java
SqlContext context = new SqlContext(configuration);
Example configuration:

```java
configuration.setProperty(
"wayang.calcite.model",
"{ \"version\": \"1.0\", \"defaultSchema\": \"MY_SCHEMA\", \"schemas\": [] }"
);

---

## 👉 Step 2 — Improve SQL execution step

Below this:

```md
3. Execute your SQL query:
```java
Collection<Record> result = context.executeSql("SELECT * FROM my_table");

for (Record record : result) {
System.out.println(record);
}
### Example: Running a simple SQL query

Wayang allows executing SQL queries using the `SqlContext` API.

```java
import org.apache.wayang.api.sql.context.SqlContext;
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.basic.data.Record;

import java.util.Collection;

public class Example {
public static void main(String[] args) throws Exception {
Configuration configuration = new Configuration();

configuration.setProperty(
"wayang.calcite.model",
"{ \"version\": \"1.0\", \"defaultSchema\": \"MY_SCHEMA\", \"schemas\": [] }"
);

SqlContext context = new SqlContext(configuration);

Collection<Record> result = context.executeSql("SELECT * FROM my_table");

for (Record record : result) {
System.out.println(record);
}
}
}
24 changes: 23 additions & 1 deletion guides/windows-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
nano windows-setup.mdnano windows-setup.md Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
Expand Down Expand Up @@ -132,3 +132,25 @@ Run terminal as Administrator.

You are now ready to run Apache Wayang on Windows.

### Hadoop prerequisite issue on Windows

While building Wayang on Windows, Maven may fail due to a missing Hadoop dependency.

Error example:
Execution prerequisite-check failed: could not access constructor...

This happens because Wayang expects the file:

C:\hadoop\bin\winutils.exe

Fix:

1. Create folder C:\hadoop
2. Inside create folder bin
3. Inside bin create an empty file called winutils.exe

After this run:

mvn clean install -DskipTests

The build should work correctly.