public class PrestoCatalogUtils extends Object
Constructor and Description |
---|
PrestoCatalogUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
findGroup(String userName)
Find the group name of a user.
|
static String |
findUser(String programName)
Find the user name of a running process.
|
static String |
findUserForId(String id)
Find the user name for given id.
|
static Pair<String,String> |
getAlluxioUser()
Get Alluxio process user and group.
|
static List<Path> |
getCatalogAlluxioXmlConfigPath(Path catalogFile)
Gets the set of files pointed at by hive.config.resources in the file, and returns an array of
those files.
|
static Pair<String,String> |
getPrestoUser()
Get Presto process user and group.
|
static String |
getPrimaryGroup(String userName)
Find the primary group name of a user.
|
static Pair<String,String> |
getProcessInfo(UploadProcessType type)
Get user info based on process type.
|
static String |
propertiesToXml(Properties props)
Convert a set of
Properties to a string of XML suitable for consumption by a process in
the hadoop ecosystem. |
static void |
restartPrestoDataproc()
Restarts presto in google dataproc environment.
|
static void |
restartPrestoEmr()
Restarts presto in AWS EMR environment.
|
static void |
validateAssetName(String assetName,
String assetType,
Collection<CharSequence> invalidSet)
Validate a particular string representing an asset (catalog, file, etc) does not contain any
of a set of invalid character sequences.
|
static void |
validateCatalogName(String catalogName)
Validates that a catalog name does not contain any invalid characters.
|
public static Pair<String,String> getPrestoUser()
public static Pair<String,String> getProcessInfo(UploadProcessType type)
type
- Upload process typepublic static Pair<String,String> getAlluxioUser()
public static String findUserForId(String id)
id
- user idpublic static String findUser(String programName)
programName
- process namepublic static String findGroup(String userName)
userName
- user namepublic static String getPrimaryGroup(String userName)
userName
- user namepublic static String propertiesToXml(Properties props)
Properties
to a string of XML suitable for consumption by a process in
the hadoop ecosystem.props
- to convert, the original object remains unmodifiedpublic static void restartPrestoEmr() throws IOException
IOException
- if the restart process failspublic static void restartPrestoDataproc() throws IOException
IOException
- if the restart command does not exit successfullypublic static List<Path> getCatalogAlluxioXmlConfigPath(Path catalogFile) throws IOException
catalogFile
- the path to the catalog fileIOException
public static void validateCatalogName(String catalogName) throws AlluxioException
catalogName
- string representing the name of the catalog to validateAlluxioException
- if the name is invalidpublic static void validateAssetName(String assetName, String assetType, Collection<CharSequence> invalidSet) throws AlluxioException
assetName
- the asset string being validatedassetType
- the type of asset that is being validated. This is used in the error
message when validation is not successfulinvalidSet
- the set of invalid character sequences which are disallowed in the assetNameAlluxioException
- when validation failsCopyright © 2023. All Rights Reserved.