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

The following examples show how to use org.apache.spark.sql.catalyst.parser.ParseException. These examples are extracted from open source projects. 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 Project: iceberg   Source File: SparkTableUtil.java    License: 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);
  }
}