From 4675bd2d3f831f35cc9a4b57bb8e5129fcfc9823 Mon Sep 17 00:00:00 2001 From: Addie Morrison Date: Sun, 8 Dec 2019 20:47:11 -0600 Subject: [PATCH] Allow builds on older versions of sqlite --- CentOS-7.dockerfile | 8 ++++++++ Ubuntu-16.04.dockerfile | 7 +++++++ Dockerfile => Ubuntu-18.04.dockerfile | 6 +++--- meson.build | 4 ++-- src/parquet.cc | 12 ++++++++++++ 5 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 CentOS-7.dockerfile create mode 100644 Ubuntu-16.04.dockerfile rename Dockerfile => Ubuntu-18.04.dockerfile (83%) diff --git a/CentOS-7.dockerfile b/CentOS-7.dockerfile new file mode 100644 index 0000000..f0f0bc5 --- /dev/null +++ b/CentOS-7.dockerfile @@ -0,0 +1,8 @@ +FROM centos:7 +RUN yum install -y epel-release +RUN yum install -y sqlite-devel libicu-devel gcc gcc-c++ meson +COPY ci/arrow-centos.repo /etc/yum.repos.d/Apache-Arrow.repo +RUN yum install -y parquet-devel +WORKDIR /src +COPY . /src +RUN mkdir builddir && meson builddir && cd builddir && ninja-build diff --git a/Ubuntu-16.04.dockerfile b/Ubuntu-16.04.dockerfile new file mode 100644 index 0000000..95f3056 --- /dev/null +++ b/Ubuntu-16.04.dockerfile @@ -0,0 +1,7 @@ +FROM ubuntu:16.04 +RUN apt-get update && apt-get install -y apt-transport-https curl gnupg lsb-release pkg-config libsqlite3-dev libicu-dev gcc g++ meson +COPY ci/arrow-ubuntu16.04.list /etc/apt/sources.list.d/apache-arrow.list +RUN curl https://dist.apache.org/repos/dist/dev/arrow/KEYS | apt-key add - && apt-get update && apt-get install -y libparquet-dev +WORKDIR /src +COPY . /src +RUN mkdir builddir && meson builddir && cd builddir && ninja diff --git a/Dockerfile b/Ubuntu-18.04.dockerfile similarity index 83% rename from Dockerfile rename to Ubuntu-18.04.dockerfile index 7ac5a8d..b5fbc2a 100644 --- a/Dockerfile +++ b/Ubuntu-18.04.dockerfile @@ -2,6 +2,6 @@ FROM ubuntu:18.04 RUN apt-get update && apt-get install -y apt-transport-https curl gnupg lsb-release pkg-config libsqlite3-dev libicu-dev gcc g++ meson COPY ci/arrow-ubuntu18.04.list /etc/apt/sources.list.d/apache-arrow.list RUN curl -L -o /usr/share/keyrings/apache-arrow-keyring.gpg https://dl.bintray.com/apache/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-keyring.gpg && apt-get update && apt-get install -y libparquet-dev -WORKDIR /src/ -VOLUME /src -CMD mkdir builddir && meson builddir && cd builddir && ninja +WORKDIR /src +COPY . /src +RUN mkdir builddir && meson builddir && cd builddir && ninja diff --git a/meson.build b/meson.build index 0707c6e..d8e5129 100644 --- a/meson.build +++ b/meson.build @@ -1,8 +1,8 @@ project('sqlite-parquet-vtable', 'c', 'cpp', default_options:['c_std=c11', 'cpp_std=c++11']) arrow = dependency('arrow', version:'0.15.1') parquet = dependency('parquet', version: '1.5.1') -sqlite = dependency('sqlite3', version: '>=3.21.0') -icu = dependency('icu-i18n') +sqlite = dependency('sqlite3', version: '>=3.7.17') +icu = dependency('icu-i18n', version: '>=50.2') dependencies = [arrow, parquet, sqlite, icu] sources = ['src/parquet.cc', 'src/parquet_cursor.cc', 'src/parquet_filter.cc', 'src/parquet_table.cc'] diff --git a/src/parquet.cc b/src/parquet.cc index 642bb31..69e37cf 100644 --- a/src/parquet.cc +++ b/src/parquet.cc @@ -362,12 +362,17 @@ const char *opName(int op) { return ">="; case SQLITE_INDEX_CONSTRAINT_MATCH: return "match"; +#ifdef SQLITE_INDEX_CONSTRAINT_LIKE +//SQLite version >= 3.10.0 case SQLITE_INDEX_CONSTRAINT_LIKE: return "LIKE"; case SQLITE_INDEX_CONSTRAINT_GLOB: return "GLOB"; case SQLITE_INDEX_CONSTRAINT_REGEXP: return "REGEXP"; +#endif +#ifdef SQLITE_INDEX_CONSTRAINT_NE +//SQLite version >= 3.21.0 case SQLITE_INDEX_CONSTRAINT_NE: return "!="; case SQLITE_INDEX_CONSTRAINT_ISNOT: @@ -378,6 +383,7 @@ const char *opName(int op) { return "IS NULL"; case SQLITE_INDEX_CONSTRAINT_IS: return "IS"; +#endif default: return "unknown"; } @@ -447,10 +453,15 @@ ConstraintOperator constraintOperatorFromSqlite(int op) { return LessThan; case SQLITE_INDEX_CONSTRAINT_GE: return GreaterThanOrEqual; +#ifdef SQLITE_INDEX_CONSTRAINT_LIKE +//SQLite version >= 3.10.0 case SQLITE_INDEX_CONSTRAINT_LIKE: return Like; case SQLITE_INDEX_CONSTRAINT_GLOB: return Glob; +#endif +#ifdef SQLITE_INDEX_CONSTRAINT_NE +//SQLite version >= 3.21.0 case SQLITE_INDEX_CONSTRAINT_NE: return NotEqual; case SQLITE_INDEX_CONSTRAINT_ISNOT: @@ -461,6 +472,7 @@ ConstraintOperator constraintOperatorFromSqlite(int op) { return IsNull; case SQLITE_INDEX_CONSTRAINT_IS: return Is; +#endif } std::ostringstream ss;