hiveService/src/main/java/com/ge/research/semtk/edc/services/hive/HiveServiceRestController.java
@CrossOrigin
	@RequestMapping(value="/minmaxRow", method= RequestMethod.POST)
	public JSONObject minmaxRow(@RequestBody HiveServiceMinMaxRowRequestBody requestBody){
		String sortOrder = null;
		String op = requestBody.operation;
		if (op == null)
			op = "";
		op = op.toLowerCase ();
		switch (op) {
			case "min":	sortOrder = "asc";
					break;
			case "max":	sortOrder = "desc";
					break;
			default:	TableResultSet tableResultSet = new TableResultSet();
					tableResultSet.setSuccess(false);
					tableResultSet.addRationaleMessage("Unknown operation: " + requestBody.operation + ".\n  Valid options are: min or max.");
					return tableResultSet.toJson();
		}

		String query = "select * from (SELECT *, rank() over (order by cast(" + requestBody.column + " as DOUBLE) " + sortOrder + ") as rank FROM " + requestBody.table + ") S where S.rank = 1";

		return runQuery (requestBody, query);
	}
/**
	 * Get full row of data where a specific column has min or max value in Hive
	 */
Get full row of data where a specific column has min or max value in Hive
Get full row of data where a specific column has min or max value in Hive
@CrossOrigin
	@RequestMapping(value="/minmaxRow", method= RequestMethod.POST)
	public JSONObject minmaxRow(@RequestBody HiveServiceMinMaxRowRequestBody requestBody){
		String sortOrder = null;
		String op = requestBody.operation;
		if (op == null)
			op = "";
		op = op.toLowerCase ();
		switch (op) {
			case "min":	sortOrder = "asc";
					break;
			case "max":	sortOrder = "desc";
					break;
			default:	TableResultSet tableResultSet = new TableResultSet();
					tableResultSet.setSuccess(false);
					tableResultSet.addRationaleMessage("Unknown operation: " + requestBody.operation + ".\n  Valid options are: min or max.");
					return tableResultSet.toJson();
		}
		String query = "select * from (SELECT *, rank() over (order by cast(" + requestBody.column + " as DOUBLE) " + sortOrder + ") as rank FROM " + requestBody.table + ") S where S.rank = 1";
		return runQuery (requestBody, query);
	}
@ CrossOrigin @ RequestMapping ( value = "/minmaxRow" , method = RequestMethod . POST ) public JSONObject minmaxRow ( @ RequestBody HiveServiceMinMaxRowRequestBody requestBody ) { String sortOrder = null ; String op = requestBody . operation ; if ( op == null ) op = "" ; op = op . toLowerCase ( ) ; switch ( op ) { case "min" : sortOrder = "asc" ; break ; case "max" : sortOrder = "desc" ; break ; default : TableResultSet tableResultSet = new TableResultSet ( ) ; tableResultSet . setSuccess ( false ) ; tableResultSet . addRationaleMessage ( "Unknown operation: " + requestBody . operation + ".\n  Valid options are: min or max." ) ; return tableResultSet . toJson ( ) ; } String query = "select * from (SELECT *, rank() over (order by cast(" + requestBody . column + " as DOUBLE) " + sortOrder + ") as rank FROM " + requestBody . table + ") S where S.rank = 1" ; return runQuery ( requestBody , query ) ; }
Get full row of data where a specific column has min or max value in Hive
Get full row of data where a specific column has min or max value in Hive