Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package org.apache.hive.service.cli.operation;

import java.util.Collections;

Check warning on line 21 in service/src/java/org/apache/hive/service/cli/operation/GetCatalogsOperation.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'java.util.Collections'.

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ2nHFC0bzFtj6i2gbQh&open=AZ2nHFC0bzFtj6i2gbQh&pullRequest=6444

Check warning on line 21 in service/src/java/org/apache/hive/service/cli/operation/GetCatalogsOperation.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Unused import - java.util.Collections.

See more on https://sonarcloud.io/project/issues?id=apache_hive&issues=AZ2nHFC0bzFtj6i2gbQi&open=AZ2nHFC0bzFtj6i2gbQi&pullRequest=6444

import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType;
import org.apache.hive.service.cli.FetchOrientation;
Expand Down Expand Up @@ -79,11 +79,6 @@
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,7 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,7 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ public TableSchema getResultSetSchema() throws HiveSQLException {
*/
@Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
return extractSubsetRowSet(orientation, maxRows, rowSet);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.hive.service.cli.operation;

import java.util.Collections;
import java.util.List;

import org.apache.hadoop.hive.conf.HiveConf;
Expand All @@ -28,9 +29,11 @@
import org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.hive.service.cli.ColumnDescriptor;
import org.apache.hive.service.cli.FetchOrientation;
import org.apache.hive.service.cli.HiveSQLException;
import org.apache.hive.service.cli.OperationState;
import org.apache.hive.service.cli.OperationType;
import org.apache.hive.service.cli.RowSet;
import org.apache.hive.service.cli.TableSchema;
import org.apache.hive.service.cli.session.HiveSession;

Expand Down Expand Up @@ -168,4 +171,14 @@ protected String getDebugMessage(final String type, final TableSchema resultSetS
}
return debugMessage.toString();
}

protected RowSet extractSubsetRowSet(
FetchOrientation orientation, long maxRows, RowSet rowSet) throws HiveSQLException {
assertState(Collections.singleton(OperationState.FINISHED));
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int) maxRows);
}
}