From a7fddca3834c73c2bfcd13f82e71304e60804bcb Mon Sep 17 00:00:00 2001 From: gaoyangxiaozhu Date: Fri, 5 Jul 2024 17:49:03 +0800 Subject: [PATCH] remove useless ctx variable --- cpp/core/jni/JniWrapper.cc | 37 -------------------------------- cpp/velox/jni/VeloxJniWrapper.cc | 4 ---- 2 files changed, 41 deletions(-) diff --git a/cpp/core/jni/JniWrapper.cc b/cpp/core/jni/JniWrapper.cc index ea5c9d271c92..ab90e28495b7 100644 --- a/cpp/core/jni/JniWrapper.cc +++ b/cpp/core/jni/JniWrapper.cc @@ -401,8 +401,6 @@ JNIEXPORT jboolean JNICALL Java_org_apache_gluten_vectorized_ColumnarBatchOutIte jobject wrapper, jlong iterHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto iter = ObjectStore::retrieve(iterHandle); if (iter == nullptr) { std::string errorMessage = @@ -438,8 +436,6 @@ JNIEXPORT jobject JNICALL Java_org_apache_gluten_vectorized_ColumnarBatchOutIter jobject wrapper, jlong iterHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto iter = ObjectStore::retrieve(iterHandle); auto metrics = iter->getMetrics(); unsigned int numMetrics = 0; @@ -499,8 +495,6 @@ JNIEXPORT jlong JNICALL Java_org_apache_gluten_vectorized_ColumnarBatchOutIterat jlong iterHandle, jlong size) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto it = ObjectStore::retrieve(iterHandle); if (it == nullptr) { std::string errorMessage = "Invalid result iter handle " + std::to_string(iterHandle); @@ -515,8 +509,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_vectorized_ColumnarBatchOutIterato jobject wrapper, jlong iterHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - ObjectStore::release(iterHandle); JNI_METHOD_END() } @@ -540,7 +532,6 @@ Java_org_apache_gluten_vectorized_NativeColumnarToRowJniWrapper_nativeColumnarTo jlong c2rHandle, jlong batchHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto columnarToRowConverter = ObjectStore::retrieve(c2rHandle); auto cb = ObjectStore::retrieve(batchHandle); columnarToRowConverter->convert(cb); @@ -569,8 +560,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_vectorized_NativeColumnarToRowJniW jobject wrapper, jlong c2rHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - ObjectStore::release(c2rHandle); JNI_METHOD_END() } @@ -614,8 +603,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_vectorized_NativeRowToColumnarJniW jobject wrapper, jlong r2cHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - ObjectStore::release(r2cHandle); JNI_METHOD_END() } @@ -625,7 +612,6 @@ JNIEXPORT jstring JNICALL Java_org_apache_gluten_columnarbatch_ColumnarBatchJniW jobject wrapper, jlong batchHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto batch = ObjectStore::retrieve(batchHandle); return env->NewStringUTF(batch->getType().c_str()); JNI_METHOD_END(nullptr) @@ -636,7 +622,6 @@ JNIEXPORT jlong JNICALL Java_org_apache_gluten_columnarbatch_ColumnarBatchJniWra jobject wrapper, jlong batchHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto batch = ObjectStore::retrieve(batchHandle); return batch->numBytes(); JNI_METHOD_END(kInvalidObjectHandle) @@ -647,7 +632,6 @@ JNIEXPORT jlong JNICALL Java_org_apache_gluten_columnarbatch_ColumnarBatchJniWra jobject wrapper, jlong batchHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto batch = ObjectStore::retrieve(batchHandle); return batch->numColumns(); JNI_METHOD_END(kInvalidObjectHandle) @@ -658,7 +642,6 @@ JNIEXPORT jlong JNICALL Java_org_apache_gluten_columnarbatch_ColumnarBatchJniWra jobject wrapper, jlong batchHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto batch = ObjectStore::retrieve(batchHandle); return batch->numRows(); JNI_METHOD_END(kInvalidObjectHandle) @@ -692,7 +675,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_columnarbatch_ColumnarBatchJniWrap jlong cSchema, jlong cArray) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto batch = ObjectStore::retrieve(batchHandle); std::shared_ptr exportedSchema = batch->exportArrowSchema(); std::shared_ptr exportedArray = batch->exportArrowArray(); @@ -755,7 +737,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_columnarbatch_ColumnarBatchJniWrap jobject wrapper, jlong batchHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); ObjectStore::release(batchHandle); JNI_METHOD_END() } @@ -900,8 +881,6 @@ JNIEXPORT jlong JNICALL Java_org_apache_gluten_vectorized_ShuffleWriterJniWrappe jlong size, jboolean callBySelf) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto shuffleWriter = ObjectStore::retrieve(shuffleWriterHandle); if (!shuffleWriter) { std::string errorMessage = "Invalid shuffle writer handle " + std::to_string(shuffleWriterHandle); @@ -922,8 +901,6 @@ JNIEXPORT jlong JNICALL Java_org_apache_gluten_vectorized_ShuffleWriterJniWrappe jlong batchHandle, jlong memLimit) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto shuffleWriter = ObjectStore::retrieve(shuffleWriterHandle); if (!shuffleWriter) { std::string errorMessage = "Invalid shuffle writer handle " + std::to_string(shuffleWriterHandle); @@ -943,8 +920,6 @@ JNIEXPORT jobject JNICALL Java_org_apache_gluten_vectorized_ShuffleWriterJniWrap jobject wrapper, jlong shuffleWriterHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto shuffleWriter = ObjectStore::retrieve(shuffleWriterHandle); if (!shuffleWriter) { std::string errorMessage = "Invalid shuffle writer handle " + std::to_string(shuffleWriterHandle); @@ -985,8 +960,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_vectorized_ShuffleWriterJniWrapper jobject wrapper, jlong shuffleWriterHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - ObjectStore::release(shuffleWriterHandle); JNI_METHOD_END() } @@ -1053,8 +1026,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_vectorized_ShuffleReaderJniWrapper jlong shuffleReaderHandle, jobject metrics) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto reader = ObjectStore::retrieve(shuffleReaderHandle); env->CallVoidMethod(metrics, shuffleReaderMetricsSetDecompressTime, reader->getDecompressTime()); env->CallVoidMethod(metrics, shuffleReaderMetricsSetDeserializeTime, reader->getDeserializeTime()); @@ -1068,8 +1039,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_vectorized_ShuffleReaderJniWrapper jobject wrapper, jlong shuffleReaderHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto reader = ObjectStore::retrieve(shuffleReaderHandle); GLUTEN_THROW_NOT_OK(reader->close()); ObjectStore::release(shuffleReaderHandle); @@ -1111,8 +1080,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_datasource_DatasourceJniWrapper_in jlong dsHandle, jlong cSchema) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto datasource = ObjectStore::retrieve(dsHandle); datasource->inspectSchema(reinterpret_cast(cSchema)); JNI_METHOD_END() @@ -1123,8 +1090,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_datasource_DatasourceJniWrapper_cl jobject wrapper, jlong dsHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - auto datasource = ObjectStore::retrieve(dsHandle); datasource->close(); ObjectStore::release(dsHandle); @@ -1252,8 +1217,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_vectorized_ColumnarBatchSerializer jobject wrapper, jlong serializerHandle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); - ObjectStore::release(serializerHandle); JNI_METHOD_END() } diff --git a/cpp/velox/jni/VeloxJniWrapper.cc b/cpp/velox/jni/VeloxJniWrapper.cc index f11edf1a435d..f9387188bc69 100644 --- a/cpp/velox/jni/VeloxJniWrapper.cc +++ b/cpp/velox/jni/VeloxJniWrapper.cc @@ -184,7 +184,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_utils_VeloxBloomFilterJniWrapper_i jlong handle, jlong item) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto filter = gluten::ObjectStore::retrieve>>(handle); GLUTEN_CHECK(filter->isSet(), "Bloom-filter is not initialized"); filter->insert(folly::hasher()(item)); @@ -197,7 +196,6 @@ JNIEXPORT jboolean JNICALL Java_org_apache_gluten_utils_VeloxBloomFilterJniWrapp jlong handle, jlong item) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto filter = gluten::ObjectStore::retrieve>>(handle); GLUTEN_CHECK(filter->isSet(), "Bloom-filter is not initialized"); bool out = filter->mayContain(folly::hasher()(item)); @@ -222,7 +220,6 @@ JNIEXPORT void JNICALL Java_org_apache_gluten_utils_VeloxBloomFilterJniWrapper_m jlong handle, jlong other) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto to = gluten::ObjectStore::retrieve>>(handle); auto from = gluten::ObjectStore::retrieve>>(other); GLUTEN_CHECK(to->isSet(), "Bloom-filter is not initialized"); @@ -237,7 +234,6 @@ JNIEXPORT jbyteArray JNICALL Java_org_apache_gluten_utils_VeloxBloomFilterJniWra jobject wrapper, jlong handle) { JNI_METHOD_START - auto ctx = gluten::getRuntime(env, wrapper); auto filter = gluten::ObjectStore::retrieve>>(handle); GLUTEN_CHECK(filter->isSet(), "Bloom-filter is not initialized"); std::vector buffer = serialize(filter.get());