You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/03/21 18:29:12 UTC

[GitHub] [hive] ellieMayVelasquez commented on a change in pull request #2070: HIVE-24861: Hive JDBC driver doesn't consider the value of 'hasMoreRows'

ellieMayVelasquez commented on a change in pull request #2070:
URL: https://github.com/apache/hive/pull/2070#discussion_r598319032



##########
File path: itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestHiveQueryResultSet.java
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+package org.apache.hive.jdbc;
+
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Properties;
+
+import org.junit.Test;
+
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.Schema;
+import org.apache.hive.service.cli.RowSet;
+import org.apache.hive.service.cli.RowSetFactory;
+import org.apache.hive.service.cli.TableSchema;
+import org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService;
+import org.apache.hive.service.rpc.thrift.TFetchResultsReq;
+import org.apache.hive.service.rpc.thrift.TFetchResultsResp;
+import org.apache.hive.service.rpc.thrift.TRowSet;
+import org.apache.hive.service.rpc.thrift.TStatus;
+import org.apache.hive.service.rpc.thrift.TStatusCode;
+import org.apache.thrift.TException;
+
+import static org.apache.hive.jdbc.EmbeddedCLIServicePortal.EMBEDDED_CLISERVICE;
+import static org.apache.hive.jdbc.Utils.URL_PREFIX;
+import static org.apache.hive.service.rpc.thrift.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10;
+import static org.junit.Assert.assertEquals;
+
+public class TestHiveQueryResultSet {
+  private static final String EMIT_EMPTY_ROWS = "hive.test.emit.empty.rows";
+  private static final String EMIT_NUM_ROWS = "hive.test.emit.num.rows";
+
+  // Create subclass of EmbeddedThriftBinaryCLIService
+  public static class MyThriftBinaryCLIService extends EmbeddedThriftBinaryCLIService {
+    private TStatus success = new TStatus(TStatusCode.SUCCESS_STATUS);
+    private boolean emitEmptyRows;
+    private int numRows;
+    private int position;
+    private int emptyRowPos;
+
+    @Override
+    public synchronized void init(HiveConf hiveConf) {
+      hiveConf.setBoolean("hive.support.concurrency", false);
+      this.emitEmptyRows = hiveConf.getBoolean(EMIT_EMPTY_ROWS, false);
+      this.numRows = hiveConf.getInt(EMIT_NUM_ROWS, 10);
+      this.emptyRowPos = (numRows / 2);
+      this.position = 0;
+      super.init(hiveConf);
+    }
+
+    @Override
+    public TFetchResultsResp FetchResults(TFetchResultsReq req) throws TException {

Review comment:
       I detect that this code is problematic. According to the [Bad practice (BAD_PRACTICE)](https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#bad-practice-bad-practice), [Nm: Method names should start with a lower case letter (NM_METHOD_NAMING_CONVENTION)](https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#nm-method-names-should-start-with-a-lower-case-letter-nm-method-naming-convention).
   Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org