Package org.rcsb.mmtf.spark.data
Class ResultsSet
- java.lang.Object
-
- org.rcsb.mmtf.spark.data.ResultsSet
-
public class ResultsSet extends java.lang.ObjectA convenience wrapper for a Spark results set.- Author:
- Anthony Bradley
-
-
Constructor Summary
Constructors Constructor Description ResultsSet(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame, java.lang.String viewName)Construct aDatasetfrom aDatasetRownormally as a result of another query.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.spark.sql.Dataset<org.apache.spark.sql.Row>getDataframe()java.lang.StringgetTableName()voidsetDataframe(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataframe)voidsetTableName(java.lang.String tableName)voidshow()Show the first 20 lines of the dataset.voidshow(int numLines)Show the first N lines of the dataset.ResultsSetsql(java.lang.String sql)Perform an SQL query on the dataset.ResultsSetsql(java.lang.String sql, java.lang.String viewName)Perform an SQL query on the dataset.
-
-
-
Constructor Detail
-
ResultsSet
public ResultsSet(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataFrame, java.lang.String viewName)Construct aDatasetfrom aDatasetRownormally as a result of another query.- Parameters:
dataFrame- the input (result from an SQL query)viewName- the name of the new view - to be used in queries
-
-
Method Detail
-
show
public void show()
Show the first 20 lines of the dataset.
-
show
public void show(int numLines)
Show the first N lines of the dataset.- Parameters:
numLines- the number of lines to show
-
sql
public ResultsSet sql(java.lang.String sql)
Perform an SQL query on the dataset. Resulting table will have name of temp.- Parameters:
sql- the SQL query to perform- Returns:
- the
ResultsSetof the queried data
-
sql
public ResultsSet sql(java.lang.String sql, java.lang.String viewName)
Perform an SQL query on the dataset. Resulting table will have name provided.- Parameters:
sql- the SQL query to performviewName- the table name of the resulting table- Returns:
- the
ResultsSetof the queried data
-
getDataframe
public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> getDataframe()
- Returns:
- the dataframe
-
setDataframe
public void setDataframe(org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> dataframe)
- Parameters:
dataframe- the dataframe to set
-
getTableName
public java.lang.String getTableName()
- Returns:
- the tableName
-
setTableName
public void setTableName(java.lang.String tableName)
- Parameters:
tableName- the tableName to set
-
-