From 50cfcedde01dabae38000c09068e1e229d49190c Mon Sep 17 00:00:00 2001 From: sunyinqi0508 Date: Fri, 21 Oct 2022 22:21:18 +0800 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de90bab..e512a98 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ AQuery++ Database is a cross-platform, In-Memory Column-Store Database that incorporates compiled query execution. (**Note**: If you encounter any problems, feel free to contact me via ys3540@nyu.edu) -`## Docker (Recommended): +## Docker (Recommended): - See installation instructions from [docker.com](https://www.docker.com). Run **docker desktop** to start docker engine. - In AQuery root directory, type `make docker` to build the docker image from scratch. - For Arm-based Mac users, you would have to build and run the **x86_64** docker image because MonetDB doesn't offer official binaries for arm64 Linux. (Run `docker buildx build --platform=linux/amd64 -t aquery .` instead of `make docker`) From 7e6ed0bcd4e53f7c8165cbf370dbe2e210230038 Mon Sep 17 00:00:00 2001 From: wxh Date: Mon, 24 Oct 2022 01:30:48 +0000 Subject: [PATCH 2/3] ci: add ci.yml --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cc1ea8b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: ci + +on: + workflow_dispatch: + push: + branches: + - 'master' + tags: + - 'v*' + pull_request: + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - + name: Build and push + if: ${{ github.event_name != 'pull_request' }} + run: | + docker buildx build --platform=linux/amd64 -t ${{ secrets.DOCKERHUB_USERNAME }}/aquery:${{github.sha}} . + docker push ${{ secrets.DOCKERHUB_USERNAME }}/aquery:${{github.sha}} + docker tag ${{ secrets.DOCKERHUB_USERNAME }}/aquery:${{github.sha}} ${{ secrets.DOCKERHUB_USERNAME }}/aquery:latest + docker push ${{ secrets.DOCKERHUB_USERNAME }}/aquery:latest diff --git a/Dockerfile b/Dockerfile index aac0a4f..953d89f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:latest -RUN cp /bin/bash /bin/sh +# RUN cp /bin/bash /bin/sh RUN apt update && apt install -y wget From 4ff1b2d3a8bda3e6dcff34777e25aa56d26f17f5 Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 11 Nov 2022 02:20:29 +0800 Subject: [PATCH 3/3] bug fixes on select into file --- reconstruct/ast.py | 23 +++++++++++++---------- reconstruct/storage.py | 4 ++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/reconstruct/ast.py b/reconstruct/ast.py index f81083e..1deaaa8 100644 --- a/reconstruct/ast.py +++ b/reconstruct/ast.py @@ -244,7 +244,7 @@ class projection(ast_node): if 'outfile' in node: self.outfile = outfile(self, node['outfile'], sql = self.sql) if not self.has_postproc: - self.sql += self.outfile.sql + self.sql = self.outfile.sql else: self.outfile = None @@ -343,10 +343,10 @@ class projection(ast_node): if 'into' not in node: self.context.emitc(f'print(*{self.out_table.contextname_cpp});') - if self.outfile: - self.outfile.finalize() + if self.outfile and self.has_postproc: + self.outfile.finalize() - if 'into' in node: + if 'into' in node: self.context.emitc(select_into(self, node['into']).ccode) if not self.distinct: self.finalize() @@ -356,7 +356,10 @@ class projection(ast_node): if self.parent is None: self.context.sql_end() - self.context.postproc_end(self.postproc_fname) + if self.outfile and not self.has_postproc: + self.context.abandon_postproc() + else: + self.context.postproc_end(self.postproc_fname) class select_distinct(projection): first_order = 'select_distinct' @@ -1024,8 +1027,8 @@ class outfile(ast_node): name="_outfile" def __init__(self, parent, node, context = None, *, sql = None): self.node = node - super().__init__(parent, node, context) self.sql = sql if sql else '' + super().__init__(parent, node, context) def init(self, _): assert(isinstance(self.parent, projection)) @@ -1045,10 +1048,10 @@ class outfile(ast_node): def produce_monetdb(self, node): filename = node['loc']['literal'] if 'loc' in node else node['literal'] import os - p = os.path.abspath('.').replace('\\', '/') + '/' + filename - self.sql = f'COPY {self.sql} INTO "{p}"' - d = '\t' - e = '\n' + p = os.path.abspath('.').replace('\\', '/') + '/' + filename + self.sql = f'COPY {self.parent.sql} INTO \'{p}\'' + d = ',' + e = '\\n' if 'term' in node: d = node['term']['literal'] self.sql += f' delimiters \'{d}\', \'{e}\'' diff --git a/reconstruct/storage.py b/reconstruct/storage.py index d54db52..0ba567a 100644 --- a/reconstruct/storage.py +++ b/reconstruct/storage.py @@ -223,6 +223,10 @@ class Context: self.queries.append('P' + proc_name) self.finalize_query() + def abandon_postproc(self): + self.ccode = '' + self.finalize_query() + def finalize_udf(self): if self.udf is not None: return (Context.udf_head