Apache DataFusion SQL Query Engine
ARROW-5493: [Go][Integration] add Go support for IPC integration tests
Sebastien Binet3b200dcaf9a1
diff --git a/ci/detect-changes.py b/ci/detect-changes.pyindex 1a30eb5f61..91945023d8 100644--- a/ci/detect-changes.py+++ b/ci/detect-changes.py@@ -141,6 +141,7 @@ AFFECTED_DEPENDENCIES = {'ci': ALL_TOPICS,'cpp': ['python', 'c_glib', 'r', 'ruby', 'integration'],'format': LANGUAGE_TOPICS,+ 'go': ['integration'],'.travis.yml': ALL_TOPICS,'c_glib': ['ruby']}diff --git a/ci/travis_env_common.sh b/ci/travis_env_common.shindex 922b37af31..453cd945dd 100755--- a/ci/travis_env_common.sh+++ b/ci/travis_env_common.sh@@ -38,6 +38,7 @@ export ARROW_INTEGRATION_DIR=$TRAVIS_BUILD_DIR/integrationexport ARROW_DEV_DIR=$TRAVIS_BUILD_DIR/devexport ARROW_CROSSBOW_DIR=$TRAVIS_BUILD_DIR/dev/tasksexport ARROW_RUBY_DIR=$TRAVIS_BUILD_DIR/ruby+export ARROW_GO_DIR=${TRAVIS_BUILD_DIR}/goexport ARROW_RUST_DIR=${TRAVIS_BUILD_DIR}/rustexport ARROW_R_DIR=${TRAVIS_BUILD_DIR}/rdiff --git a/ci/travis_script_integration.sh b/ci/travis_script_integration.shindex c51005d39f..c043189d24 100755--- a/ci/travis_script_integration.sh+++ b/ci/travis_script_integration.sh@@ -40,6 +40,20 @@ npm run build -- -t apache-arrowpopd+pushd $ARROW_GO_DIR/arrow++eval $(gimme 1.12.x)++export GO111MODULE=on+export GOBIN=`pwd`/bin++which go+go version+go env+go get -v ./...++popd+pushd $ARROW_INTEGRATION_DIRconda activate $CPP_TOOLCHAINdiff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.shindex 80daa4228e..f14c99dac6 100755--- a/dev/release/verify-release-candidate.sh+++ b/dev/release/verify-release-candidate.sh@@ -370,6 +370,15 @@ test_rust() {popd}+test_go() {+ pushd go++ go get -v ./...+ go test ./...++ popd+}+# Build and test Java (Requires newer Maven -- I used 3.3.9)test_package_java() {@@ -424,6 +433,7 @@ import_gpg_keys: ${TEST_PYTHON:=${TEST_DEFAULT}}: ${TEST_JS:=${TEST_DEFAULT}}: ${TEST_INTEGRATION:=${TEST_DEFAULT}}+: ${TEST_GO:=${TEST_DEFAULT}}: ${TEST_RUST:=${TEST_DEFAULT}}: ${TEST_BINARY:=${TEST_DEFAULT}}: ${TEST_APT:=${TEST_DEFAULT}}@@ -472,6 +482,9 @@ if [ "$ARTIFACT" == "source" ]; thenif [ ${TEST_INTEGRATION} -gt 0 ]; thentest_integrationfi+ if [ ${TEST_GO} -gt 0 ]; then+ test_go+ fiif [ ${TEST_RUST} -gt 0 ]; thentest_rustfidiff --git a/integration/integration_test.py b/integration/integration_test.pyindex 7b8e5628d5..a4763c98c8 100644--- a/integration/integration_test.py+++ b/integration/integration_test.py@@ -1234,6 +1234,24 @@ class IntegrationRunner(object):' for JS once JS supports them')continue+ if ('Go' in (producer.name, consumer.name) and+ "decimal" in test_case.name):+ print('TODO(ARROW-3676): Enable decimal tests ' ++ ' for Go')+ continue++ if ('Go' in (producer.name, consumer.name) and+ "map" in test_case.name):+ print('TODO(ARROW-3679): Enable map tests ' ++ ' for Go')+ continue++ if ('Go' in (producer.name, consumer.name) and+ "dictionary" in test_case.name):+ print('TODO(ARROW-3039): Enable dictionary tests ' ++ ' for Go')+ continue+# Make the random access fileproducer_file_path = os.path.join(self.temp_dir, file_id + '_' +name + '.json_as_file')@@ -1586,6 +1604,57 @@ class JSTester(Tester):os.system(cmd)+class GoTester(Tester):+ PRODUCER = True+ CONSUMER = True++ # FIXME(sbinet): revisit for Go modules+ GOPATH = os.getenv('GOPATH', '~/go')+ GOBIN = os.environ.get('GOBIN', os.path.join(GOPATH, 'bin'))++ GO_INTEGRATION_EXE = os.path.join(GOBIN, 'arrow-json-integration-test')+ STREAM_TO_FILE = os.path.join(GOBIN, 'arrow-stream-to-file')+ FILE_TO_STREAM = os.path.join(GOBIN, 'arrow-file-to-stream')++ name = 'Go'++ def _run(self, arrow_path=None, json_path=None, command='VALIDATE'):+ cmd = [self.GO_INTEGRATION_EXE]++ if arrow_path is not None:+ cmd.extend(['-arrow', arrow_path])++ if json_path is not None:+ cmd.extend(['-json', json_path])++ cmd.extend(['-mode', command])++ if self.debug:+ print(' '.join(cmd))++ run_cmd(cmd)++ def validate(self, json_path, arrow_path):+ return self._run(arrow_path, json_path, 'VALIDATE')++ def json_to_file(self, json_path, arrow_path):+ return self._run(arrow_path, json_path, 'JSON_TO_ARROW')++ def stream_to_file(self, stream_path, file_path):+ cmd = ['cat', stream_path, '|', self.STREAM_TO_FILE, '>', file_path]+ cmd = ' '.join(cmd)+ if self.debug:+ print(cmd)+ os.system(cmd)++ def file_to_stream(self, file_path, stream_path):+ cmd = [self.FILE_TO_STREAM, file_path, '>', stream_path]+ cmd = ' '.join(cmd)+ if self.debug:+ print(cmd)+ os.system(cmd)++def get_static_json_files():glob_pattern = os.path.join(ARROW_HOME, 'integration', 'data', '*.json')return [JsonFile(name=os.path.basename(p), path=p, skip=set(),@@ -1605,6 +1674,9 @@ def run_all_tests(args):if args.enable_js:testers.append(JSTester(args))+ if args.enable_go:+ testers.append(GoTester(args))+static_json_files = get_static_json_files()generated_json_files = get_generated_json_files(tempdir=args.tempdir,flight=args.run_flight)@@ -1661,6 +1733,9 @@ if __name__ == '__main__':parser.add_argument('--enable-js', dest='enable_js',action='store', type=int, default=1,help='Include JavaScript in integration tests')+ parser.add_argument('--enable-go', dest='enable_go',+ action='store', type=int, default=1,+ help='Include Go in integration tests')parser.add_argument('--write_generated_json', dest='generated_json_path',action='store', default=False,