org.apache.spark.sql.catalyst.parser.ParseException Java Examples

The following examples show how to use org.apache.spark.sql.catalyst.parser.ParseException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SparkTableUtil.java    From iceberg with Apache License 2.0 5 votes vote down vote up
/**
 * Returns all partitions in the table.
 *
 * @param spark a Spark session
 * @param table a table name and (optional) database
 * @return all table's partitions
 */
public static List<SparkPartition> getPartitions(SparkSession spark, String table) {
  try {
    TableIdentifier tableIdent = spark.sessionState().sqlParser().parseTableIdentifier(table);
    return getPartitions(spark, tableIdent);
  } catch (ParseException e) {
    throw SparkExceptionUtil.toUncheckedException(e, "Unable to parse table identifier: %s", table);
  }
}