ellieMayVelasquez commented on a change in pull request #2070: URL: https://github.com/apache/hive/pull/2070#discussion_r601003329
########## 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: noticed. ########## 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: noticed :) -- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org