Skip to content

Add documents #677

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

Merged
merged 6 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
80 changes: 80 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Contacting individual members, contributors, or leaders privately, outside designated community mechanisms, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [email protected]. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at <https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
9 changes: 9 additions & 0 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Support and Help

Need help getting started or using a project? Here's how.

## How to get help
If you want to know [ibis-server](../ibis-server), you can start by referring to the [README](../ibis-server/README.md) for an understanding of the basic structure, [CONTRIBUTING](../ibis-server/docs/CONTRIBUTING.md) to learn how to contribute, and [development](../ibis-server/docs/development.md) to understand how to develop.

## Customer Support
We have a Discord channel. Feel free to join the discussion: [Wren Discord](https://discord.gg/5DvshJqG8Z)
76 changes: 15 additions & 61 deletions ibis-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ Ibis server is a server base on Python that provides the API for rewriting the q
We still need to run the Java engine for rewriting the queries. In the future, we will redesign the modeling core of java engine to [Rust](https://github.com/rust-lang/rust) and integrate the modeling core into the Ibis server. \
We continuously integrate the Rust core with the Ibis server now.

## Application structure
The application consists of three main parts:
1. [ibis-server](./): a Python web server powered by FastAPI and Ibis
2. [wren-modeling-rs](../wren-modeling-rs): a modeling core written in Rust powered by [Apache/DataFusion](https://github.com/apache/datafusion)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. [wren-modeling-rs](../wren-modeling-rs): a modeling core written in Rust powered by [Apache/DataFusion](https://github.com/apache/datafusion)
2. [wren-modeling-rs](../wren-modeling-rs): a modeling core written in Rust powered by [Apache DataFusion](https://github.com/apache/datafusion)

3. [wren-modeling-py](../wren-modeling-py): a Python adapter for the modeling core

## Quick Start

### Running on Docker
You can follow the steps below to run the Java engine and ibis.
- Create `compose.yaml` file and add the following content, edit environment variables if needed (see [Environment Variables](#Environment-Variables))
Create `compose.yaml` file and add the following content, edit environment variables if needed (see [Environment Variables](docs/development#environment-variables))
```yaml
services:
ibis:
Expand All @@ -23,21 +30,22 @@ services:
volumes:
- ./etc:/usr/src/app/etc
```
- Create `etc` directory and create `config.properties` inside the etc directory
Create `etc` directory and create `config.properties` inside the etc directory
```bash
mkdir etc
cd etc
vim config.properties
```
- Add the following content to the `config.properties` file
Add the following content to the `config.properties` file
```bash
node.environment=production
wren.directory=/usr/src/app/etc/mdl
```
- Run the docker compose
Run the docker compose
```bash
docker compose up
```

### Running on Local
Requirements:
- Python 3.11
Expand All @@ -57,7 +65,7 @@ Navigate to the `ibis-server` directory
```bash
cd ibis-server
```
Create `.env` file and fill in the environment variables (see [Environment Variables](#Environment-Variables))
Create `.env` file and fill in the environment variables (see [Environment Variables](docs/development#environment-variables))
```bash
vim .env
```
Expand All @@ -70,59 +78,5 @@ Run the server
just run
```

## Developer Guide

### Environment Setup
- Python 3.11
- Install [Rust](https://www.rust-lang.org/tools/install) and [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html)
- Install [poetry](https://github.com/python-poetry/poetry) with version 1.7.1: `curl -sSL https://install.python-poetry.org | python3 - --version 1.7.1`
- Install [casey/just](https://github.com/casey/just)
- Install [pre-commit](https://pre-commit.com) hooks: `just pre-commit-install`
- Install [taplo](https://github.com/tamasfe/taplo) for TOML linting

### Modeling Core
The modeling core is written in Rust and provides the Python adaptor. \
You must create python venv and install dependencies in [wren-modeling-py](../wren-modeling-py) first.

### Test and build
- Execute `just install` to install the dependencies
- Execute `just test` to run the tests
- Create `.env` file and fill in the environment variables

### Environment Variables
- `WREN_ENGINE_ENDPOINT`: The endpoint of the Wren Java engine
- `LOG_LEVEL`: The log level of the server. Default is `INFO`

### Start the server
- Execute `just run` to start the server
- Execute `just dev` to start the server in development mode. It will auto-reload after the code is edited.
- Default port is `8000`, you can change it by `just port=8001 run` or `just port=8001 dev`

### Docker
- Build the image: `just docker-build`
- Run the container: `just docker-run`

## FAQ
### Why can’t I run test about MS SQL Server?
Maybe you don't have the driver for MS SQL Server. If your OS is Linux or MacOS, We recommend you install the `unixodbc` and `freetds` package. \
After installing, you can execute `odbcinst -j` to check the path of the `odbcinst.ini` file.
```bash
odbcinst -j

unixODBC 2.3.12
DRIVERS............: /opt/homebrew/etc/odbcinst.ini
SYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.ini
FILE DATA SOURCES..: /opt/homebrew/etc/ODBCDataSources
USER DATA SOURCES..: /Users/your_username/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
```
Find the path of `libtdsodbc.so` in `freetds` and open the `odbcinst.ini` file to add the following content
```bash
[FreeTDS]
Description = FreeTDS driver
Driver = /opt/homebrew/Cellar/freetds/1.4.17/lib/libtdsodbc.so
Setup = /opt/homebrew/Cellar/freetds/1.4.17/lib/libtdsodbc.so
FileUsage = 1
```
## Contributing
Please see [CONTRIBUTING.md](docs/CONTRIBUTING.md) for more information.
50 changes: 50 additions & 0 deletions ibis-server/docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Welcome to Wren Engine contributing guide <!-- omit in toc -->

Thank you for investing your time in contributing to our project!

Read our [Code of Conduct](../../.github/CODE_OF_CONDUCT.md) to keep our community approachable and respectable.

In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.

Use the table of contents icon on the top left corner of this document to get to a specific section of this guide quickly.

## New contributor guide

To get an overview of the project, read the [README](../README.md) and [DEVELOPMENT](development). Here are some resources to help you get started with open source contributions:

- [Basic application structure](../README.md#application-structure)
- [Set up development environment](development#getting-started)

## Getting started

### Issues

#### Create a new issue

If you spot a problem, search if an issue already exists. If a related issue doesn't exist, you can open a new [issue](https://github.com/Canner/wren-engine/issues/new).

#### Solve an issue

Scan through our [existing issues](https://github.com/Canner/wren-engine/issues) to find one that interests you. You can narrow down the search using `labels` as filters. As a general rule, we don’t assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.

### Pull Request

When you're finished with the changes, create a pull request, also known as a PR.
- Fill the description so that we can review your PR.
- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one.
- Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge.
Once you submit your PR, a Canner team member will review your proposal. We may ask questions or request additional information.
- We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
- As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations).
- If you run into any merge issues, checkout this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues.

### Your PR is merged!

Congratulations :tada::tada: The Canner team thanks you :sparkles:.

Once your PR is merged, your contributions will be worked on the next release.

Now that you are part of the Canner community.

## How to add new data source
Please see [How to Add a New Data Source](how-to-add-data-source.md) for more information.
68 changes: 68 additions & 0 deletions ibis-server/docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Development
This document describes the process for running this application on your local computer.


## Getting started
This application is powered by Python and Rust! :sparkles: :snake: :gear: :sparkles:

It runs on macOS, Windows, and Linux environments.

You'll need `Python 3.11` to run the application. To install Python, [download the installer from python.org](https://www.python.org/downloads/).

You'll also need `Rust` and `Cargo`. To install them, follow the instructions on the [Rust installation page](https://www.rust-lang.org/tools/install).

Next, install the following tools:
- [poetry](https://github.com/python-poetry/poetry)
- [casey/just](https://github.com/casey/just)
- [pre-commit](https://pre-commit.com)
- [taplo](https://github.com/tamasfe/taplo)

After installing these tools, run:
```shell
just pre-commit-install
```
This installs the pre-commit hooks.

> [!WARNING]
> Before working on the application, you need to set up a Python virtual environment and install dependencies in the [wren-modeling-py](../../wren-modeling-py) directory.


## Start the server
To get the application running:
1. Execute `just install` to install the dependencies
2. Create a `.env` file and fill in the required environment variables (see [Environment Variables](#Environment-Variables))

To start the server:
- Execute `just run` to start the server
- Execute `just dev` to start the server in development mode (auto-reloads on code changes)
- The default port is `8000`. You can change it by running `just port=8001 run` or `just port=8001 dev`

To run the tests:
- Execute `just test`

### Environment Variables
- `WREN_ENGINE_ENDPOINT`: The endpoint of the Wren Java engine
- `LOG_LEVEL`: The log level of the server (default is INFO)

### Docker
- Build the image: `just docker-build`
- Run the container: `just docker-run`


## How to add new data source
Please see [How to Add a New Data Source](how-to-add-data-source.md) for more information.


## Troubleshooting
### MS SQL Server Tests
If you're having trouble running tests related to MS SQL Server, you may need to install the appropriate driver. For Linux or macOS, we recommend installing the `unixodbc` and `freetds` packages.
After installation, run `odbcinst -j` to check the path of the `odbcinst.ini` file. Then, find the path of `libtdsodbc.so` in freetds and add the following content to the odbcinst.ini file:
```ini
[FreeTDS]
Description = FreeTDS driver
Driver = /opt/homebrew/Cellar/freetds/1.4.17/lib/libtdsodbc.so
Setup = /opt/homebrew/Cellar/freetds/1.4.17/lib/libtdsodbc.so
FileUsage = 1
```
Adjust the paths as necessary for your system.

Loading
Loading