Github user sureshsubbiah commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1417#discussion_r164279712
--- Diff: core/sql/executor/HdfsClient_JNI.cpp ---
@@ -0,0 +1,452 @@
+//**********************************************************************
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+// **********************************************************************
+
+#include "QRLogger.h"
+#include "Globals.h"
+#include "jni.h"
+#include "HdfsClient_JNI.h"
+
+//
===========================================================================
+// ===== Class HdfsScan
+//
===========================================================================
+
+JavaMethodInit* HdfsScan::JavaMethods_ = NULL;
+jclass HdfsScan::javaClass_ = 0;
+bool HdfsScan::javaMethodsInitialized_ = false;
+pthread_mutex_t HdfsScan::javaMethodsInitMutex_ =
PTHREAD_MUTEX_INITIALIZER;
+
+static const char* const hdfsScanErrorEnumStr[] =
+{
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//////////////////////////////////////////////////////////////////////////////
+HDFS_Scan_RetCode HdfsScan::init()
+{
+ static char className[]="org/trafodion/sql/HdfsScan";
+ HDFS_Scan_RetCode rc;
+
+ if (javaMethodsInitialized_)
+ return (HDFS_Scan_RetCode)JavaObjectInterface::init(className,
javaClass_, JavaMethods_, (Int32)JM_LAST, javaMethodsInitialized_);
+ else
+ {
+ pthread_mutex_lock(&javaMethodsInitMutex_);
+ if (javaMethodsInitialized_)
+ {
+ pthread_mutex_unlock(&javaMethodsInitMutex_);
+ return (HDFS_Scan_RetCode)JavaObjectInterface::init(className,
javaClass_, JavaMethods_, (Int32)JM_LAST, javaMethodsInitialized_);
+ }
+ JavaMethods_ = new JavaMethodInit[JM_LAST];
+
+ JavaMethods_[JM_CTOR ].jm_name = "<init>";
+ JavaMethods_[JM_CTOR ].jm_signature = "()V";
+ JavaMethods_[JM_INIT_SCAN_RANGES].jm_name = "<init>";
+ JavaMethods_[JM_INIT_SCAN_RANGES].jm_signature =
"(Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/String;[J[J)V";
+ JavaMethods_[JM_TRAF_HDFS_READ].jm_name = "trafHdfsRead";
+ JavaMethods_[JM_TRAF_HDFS_READ].jm_signature = "()[I";
+
+ rc = (HDFS_Scan_RetCode)JavaObjectInterface::init(className,
javaClass_, JavaMethods_, (Int32)JM_LAST, javaMethodsInitialized_);
+ javaMethodsInitialized_ = TRUE;
+ pthread_mutex_unlock(&javaMethodsInitMutex_);
+ }
+ return rc;
+}
+
+char* HdfsScan::getErrorText(HDFS_Scan_RetCode errEnum)
+{
+ if (errEnum < (HDFS_Scan_RetCode)JOI_LAST)
+ return JavaObjectInterface::getErrorText((JOI_RetCode)errEnum);
+ else
+ return (char*)hdfsScanErrorEnumStr[errEnum-HDFS_SCAN_FIRST-1];
--- End diff --
I wonder why there is a "-1" here, but no equivalent "-1" in
HdfsClient::getErrorText()
---