Class ThriftMetastoreUtil
java.lang.Object
io.trino.plugin.hive.metastore.thrift.ThriftMetastoreUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic io.trino.hive.thrift.metastore.ColumnStatisticsObjcreateMetastoreColumnStatistics(String columnName, HiveType columnType, HiveColumnStatistics statistics, OptionalLong rowCount) static List<io.trino.hive.thrift.metastore.FieldSchema>csvSchemaFields(List<io.trino.hive.thrift.metastore.FieldSchema> schemas) static HiveColumnStatisticsfromMetastoreApiColumnStatistics(io.trino.hive.thrift.metastore.ColumnStatisticsObj columnStatistics, OptionalLong rowCount) static DatabasefromMetastoreApiDatabase(io.trino.hive.thrift.metastore.Database database) static PartitionfromMetastoreApiPartition(io.trino.hive.thrift.metastore.Partition partition) static PartitionfromMetastoreApiPartition(io.trino.hive.thrift.metastore.Partition partition, List<io.trino.hive.thrift.metastore.FieldSchema> schema) static PrincipalTypefromMetastoreApiPrincipalType(io.trino.hive.thrift.metastore.PrincipalType principalType) static TablefromMetastoreApiTable(io.trino.hive.thrift.metastore.Table table) static TablefromMetastoreApiTable(io.trino.hive.thrift.metastore.Table table, List<io.trino.hive.thrift.metastore.FieldSchema> schema) static OptionalLongfromMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount, OptionalLong rowCount) Hive calculates NDV considering null as a distinct valuestatic OptionalLongfromMetastoreNullsCount(long nullsCount) Impala `COMPUTE STATS` will write -1 as the null count.fromRolePrincipalGrants(Collection<io.trino.hive.thrift.metastore.RolePrincipalGrant> grants) static io.trino.hive.thrift.metastore.PrincipalTypefromTrinoPrincipalType(PrincipalType principalType) static OptionalDoublegetAverageColumnLength(OptionalLong totalSizeInBytes, OptionalLong rowCount, OptionalLong nullsCount) static HiveBasicStatisticsgetBasicStatisticsWithSparkFallback(Map<String, String> parameters) static HiveBasicStatisticsgetHiveBasicStatistics(Map<String, String> parameters) static Set<HiveColumnStatisticType>static OptionalLonggetTotalSizeInBytes(OptionalDouble averageColumnLength, OptionalLong rowCount, OptionalLong nullsCount) static booleanisAvroTableWithSchemaSet(io.trino.hive.thrift.metastore.Table table) static booleanisCsvTable(io.trino.hive.thrift.metastore.Table table) static booleanisRoleApplicable(HivePrincipal principal, String role, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) static booleanisRoleEnabled(ConnectorIdentity identity, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants, String role) listApplicableRoles(HivePrincipal principal, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) static Stream<HivePrincipal>listEnabledPrincipals(ConnectorIdentity identity, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) listEnabledRoles(ConnectorIdentity identity, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) static Set<HivePrivilegeInfo>parsePrivilege(io.trino.hive.thrift.metastore.PrivilegeGrantInfo userGrant, Optional<HivePrincipal> grantee) static io.trino.hive.thrift.metastore.DatabasetoMetastoreApiDatabase(Database database) static io.trino.hive.thrift.metastore.FieldSchematoMetastoreApiFieldSchema(Column column) static io.trino.hive.thrift.metastore.PartitiontoMetastoreApiPartition(Partition partition) static io.trino.hive.thrift.metastore.PartitiontoMetastoreApiPartition(Partition partition, Optional<Long> writeId) static io.trino.hive.thrift.metastore.PartitiontoMetastoreApiPartition(PartitionWithStatistics partitionWithStatistics) static io.trino.hive.thrift.metastore.PrivilegeGrantInfotoMetastoreApiPrivilegeGrantInfo(HivePrivilegeInfo privilegeInfo) static io.trino.hive.thrift.metastore.TabletoMetastoreApiTable(Table table) static io.trino.hive.thrift.metastore.TabletoMetastoreApiTable(Table table, PrincipalPrivileges privileges) static io.trino.hive.thrift.metastore.DecimaltoMetastoreDecimal(BigDecimal decimal) static OptionalLongtoMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount) updateStatisticsParameters(Map<String, String> parameters, HiveBasicStatistics statistics)
-
Field Details
-
NUM_ROWS
- See Also:
-
STATS_PROPERTIES
-
-
Method Details
-
toMetastoreApiDatabase
-
toMetastoreApiTable
public static io.trino.hive.thrift.metastore.Table toMetastoreApiTable(Table table, PrincipalPrivileges privileges) -
toMetastoreApiTable
-
toMetastoreApiPrivilegeGrantInfo
public static io.trino.hive.thrift.metastore.PrivilegeGrantInfo toMetastoreApiPrivilegeGrantInfo(HivePrivilegeInfo privilegeInfo) -
listApplicableRoles
public static Stream<RoleGrant> listApplicableRoles(HivePrincipal principal, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) -
isRoleApplicable
public static boolean isRoleApplicable(HivePrincipal principal, String role, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) -
listEnabledPrincipals
public static Stream<HivePrincipal> listEnabledPrincipals(ConnectorIdentity identity, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) -
isRoleEnabled
public static boolean isRoleEnabled(ConnectorIdentity identity, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants, String role) -
listEnabledRoles
public static Stream<String> listEnabledRoles(ConnectorIdentity identity, Function<HivePrincipal, Set<RoleGrant>> listRoleGrants) -
toMetastoreApiPartition
public static io.trino.hive.thrift.metastore.Partition toMetastoreApiPartition(PartitionWithStatistics partitionWithStatistics) -
toMetastoreApiPartition
-
toMetastoreApiPartition
-
fromMetastoreApiDatabase
-
fromMetastoreApiTable
-
fromMetastoreApiTable
-
isAvroTableWithSchemaSet
public static boolean isAvroTableWithSchemaSet(io.trino.hive.thrift.metastore.Table table) -
isCsvTable
public static boolean isCsvTable(io.trino.hive.thrift.metastore.Table table) -
csvSchemaFields
-
fromMetastoreApiPartition
public static Partition fromMetastoreApiPartition(io.trino.hive.thrift.metastore.Partition partition) -
fromMetastoreApiPartition
-
fromMetastoreApiColumnStatistics
public static HiveColumnStatistics fromMetastoreApiColumnStatistics(io.trino.hive.thrift.metastore.ColumnStatisticsObj columnStatistics, OptionalLong rowCount) -
fromMetastoreNullsCount
Impala `COMPUTE STATS` will write -1 as the null count.- See Also:
-
getTotalSizeInBytes
public static OptionalLong getTotalSizeInBytes(OptionalDouble averageColumnLength, OptionalLong rowCount, OptionalLong nullsCount) -
fromMetastoreDistinctValuesCount
public static OptionalLong fromMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount, OptionalLong rowCount) Hive calculates NDV considering null as a distinct value -
fromRolePrincipalGrants
public static Set<RoleGrant> fromRolePrincipalGrants(Collection<io.trino.hive.thrift.metastore.RolePrincipalGrant> grants) -
fromTrinoPrincipalType
public static io.trino.hive.thrift.metastore.PrincipalType fromTrinoPrincipalType(PrincipalType principalType) -
fromMetastoreApiPrincipalType
public static PrincipalType fromMetastoreApiPrincipalType(io.trino.hive.thrift.metastore.PrincipalType principalType) -
toMetastoreApiFieldSchema
-
parsePrivilege
public static Set<HivePrivilegeInfo> parsePrivilege(io.trino.hive.thrift.metastore.PrivilegeGrantInfo userGrant, Optional<HivePrincipal> grantee) -
getHiveBasicStatistics
-
getBasicStatisticsWithSparkFallback
public static HiveBasicStatistics getBasicStatisticsWithSparkFallback(Map<String, String> parameters) -
updateStatisticsParameters
-
createMetastoreColumnStatistics
public static io.trino.hive.thrift.metastore.ColumnStatisticsObj createMetastoreColumnStatistics(String columnName, HiveType columnType, HiveColumnStatistics statistics, OptionalLong rowCount) -
toMetastoreDecimal
-
toMetastoreDistinctValuesCount
public static OptionalLong toMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount) -
getAverageColumnLength
public static OptionalDouble getAverageColumnLength(OptionalLong totalSizeInBytes, OptionalLong rowCount, OptionalLong nullsCount) -
getSupportedColumnStatistics
-