protected String getDebugMessage(final String type, final TableSchema resultSetSchema) { StringBuilder debugMessage = new StringBuilder(); debugMessage.append("Returning "); debugMessage.append(type); debugMessage.append(" metadata: "); boolean firstColumn = true; for (ColumnDescriptor column : resultSetSchema.getColumnDescriptors()) { if (!firstColumn) { debugMessage.append(", "); } debugMessage.append(column.getName()); debugMessage.append("={}"); firstColumn = false; } return debugMessage.toString(); } }
public ColumnBasedSet(TableSchema schema) { descriptors = schema.toTypeDescriptors(); columns = new ArrayList<ColumnBuffer>(); for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { columns.add(new ColumnBuffer(colDesc.getType())); } }
pkColNames.add(key.getColumn_name().toLowerCase()); for (ColumnDescriptor column : schema.getColumnDescriptors()) { if (columnPattern != null && !columnPattern.matcher(column.getName()).matches()) { continue;
/** * Instantiates a new hive in memory result set. * * @param hiveHandle the hive handle * @param client the client * @param closeAfterFecth the close after fecth * @throws HiveSQLException the hive sql exception */ public HiveInMemoryResultSet(OperationHandle hiveHandle, CLIServiceClient client, boolean closeAfterFecth) throws HiveSQLException { this.client = client; this.opHandle = hiveHandle; this.closeAfterFecth = closeAfterFecth; this.metadata = client.getResultSetMetadata(opHandle); this.numColumns = metadata.getColumnDescriptors().size(); this.orientation = FetchOrientation.FETCH_FIRST; }
/** * Instantiates a new hive in memory result set. * * @param hiveHandle the hive handle * @param client the client * @param closeAfterFecth the close after fecth * @throws HiveSQLException the hive sql exception */ public HiveInMemoryResultSet(OperationHandle hiveHandle, CLIServiceClient client, boolean closeAfterFecth) throws HiveSQLException { this.client = client; this.opHandle = hiveHandle; this.closeAfterFecth = closeAfterFecth; this.metadata = client.getResultSetMetadata(opHandle); this.numColumns = metadata.getColumnDescriptors().size(); this.orientation = FetchOrientation.FETCH_FIRST; }
public ColumnBasedSet(TableSchema schema) { types = schema.toTypes(); columns = new ArrayList<Column>(); for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { columns.add(new Column(colDesc.getType())); } }
@Override public LensResultSetMetadata getMetadata() throws LensException { // Removed Anonymous inner class and changed it to concrete class // for serialization to JSON HiveResultSetMetadata hrsMeta = new HiveResultSetMetadata(); hrsMeta.setColumns(metadata.getColumnDescriptors()); return hrsMeta; } }
public ColumnBasedSet(TableSchema schema) { types = schema.toTypes(); columns = new ArrayList<Column>(); for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { columns.add(new Column(colDesc.getType())); } }
public ColumnBasedSet(TableSchema schema) { descriptors = schema.toTypeDescriptors(); columns = new ArrayList<ColumnBuffer>(); for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { columns.add(new ColumnBuffer(colDesc.getType())); } }
public ColumnBasedSet(TableSchema schema) { types = schema.toTypes(); columns = new ArrayList<Column>(); for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { columns.add(new Column(colDesc.getType())); } }
@Override public LensResultSetMetadata getMetadata() throws LensException { // Removed Anonymous inner class and changed it to concrete class // for serialization to JSON HiveResultSetMetadata hrsMeta = new HiveResultSetMetadata(); hrsMeta.setColumns(metadata.getColumnDescriptors()); return hrsMeta; }
public ColumnBasedSet(TableSchema schema) { types = schema.toTypes(); columns = new ArrayList<Column>(); for (ColumnDescriptor colDesc : schema.getColumnDescriptors()) { columns.add(new Column(colDesc.getType())); } }
@Override public LensResultSetMetadata getMetadata() throws LensException { // Removed Anonymous inner class and changed it to concrete class // for serialization to JSON HiveResultSetMetadata hrsMeta = new HiveResultSetMetadata(); hrsMeta.setColumns(metadata.getColumnDescriptors()); return hrsMeta; } }
@Override public LensResultSetMetadata getMetadata() throws LensException { // Removed Anonymous inner class and changed it to concrete class // for serialization to JSON HiveResultSetMetadata hrsMeta = new HiveResultSetMetadata(); hrsMeta.setColumns(metadata.getColumnDescriptors()); return hrsMeta; }
private List<ColumnDesc> getResultSchemaInternal(OperationHandle operationHandle) throws SQLException { ImmutableList.Builder<ColumnDesc> listBuilder = ImmutableList.builder(); if (operationHandle.hasResultSet()) { TableSchema tableSchema = cliService.getResultSetMetadata(operationHandle); for (ColumnDescriptor colDesc : tableSchema.getColumnDescriptors()) { listBuilder.add(new ColumnDesc(colDesc.getName(), colDesc.getTypeName(), colDesc.getOrdinalPosition(), colDesc.getComment())); } } return listBuilder.build(); }
private List<ColumnDesc> getResultSchemaInternal(OperationHandle operationHandle) throws SQLException { ImmutableList.Builder<ColumnDesc> listBuilder = ImmutableList.builder(); if (operationHandle.hasResultSet()) { TableSchema tableSchema = cliService.getResultSetMetadata(operationHandle); for (ColumnDescriptor colDesc : tableSchema.getColumnDescriptors()) { listBuilder.add(new ColumnDesc(colDesc.getName(), colDesc.getTypeName(), colDesc.getOrdinalPosition(), colDesc.getComment())); } } return listBuilder.build(); }
@Override public void assertFunctionCall(String functionCallString, Object expectedOutputData, Object expectedOutputType) { String query = "SELECT " + functionCallString; try { // Execute the SQL statement and fetch the result OperationHandle handle = _client.executeStatement(_sessionHandle, query, null); if (handle.hasResultSet()) { RowSet rowSet = _client.fetchResults(handle); if (rowSet.numRows() > 1 || rowSet.numColumns() > 1) { throw new RuntimeException( "Expected 1 row and 1 column in query output. Received " + rowSet.numRows() + " rows and " + rowSet.numColumns() + " columns.\nQuery: \"" + query + "\""); } Object[] row = rowSet.iterator().next(); Object result = row[0]; Assert.assertEquals(result, expectedOutputData, "UDF output does not match"); // Get the output data type and convert them to TypeInfo to compare ColumnDescriptor outputColumnDescriptor = _client.getResultSetMetadata(handle).getColumnDescriptors().get(0); Assert.assertEquals(TypeInfoUtils.getTypeInfoFromTypeString(outputColumnDescriptor.getTypeName().toLowerCase()), TypeInfoUtils.getTypeInfoFromObjectInspector((ObjectInspector) expectedOutputType), "UDF output type does not match"); } else { throw new RuntimeException("Query did not return any rows. Query: \"" + query + "\""); } } catch (HiveSQLException e) { throw new RuntimeException("Error running Hive query: \"" + query + "\"", e); } } }
pkColNames.add(key.getColumn_name().toLowerCase()); for (ColumnDescriptor column : schema.getColumnDescriptors()) { if (columnPattern != null && !columnPattern.matcher(column.getName()).matches()) { continue;
for (Table table : metastoreClient.getTableObjectsByName(dbName, tableNames)) { TableSchema schema = new TableSchema(metastoreClient.getSchema(dbName, table.getTableName())); for (ColumnDescriptor column : schema.getColumnDescriptors()) { if (columnPattern != null && !columnPattern.matcher(column.getName()).matches()) { continue;
for (Table table : metastoreClient.getTableObjectsByName(dbName, tableNames)) { TableSchema schema = new TableSchema(metastoreClient.getSchema(dbName, table.getTableName())); for (ColumnDescriptor column : schema.getColumnDescriptors()) { if (columnPattern != null && !columnPattern.matcher(column.getName()).matches()) { continue;