Skip to content

Commit

Permalink
nerf
Browse files Browse the repository at this point in the history
  • Loading branch information
ericm-db committed Feb 1, 2024
1 parent b816a4e commit 0f2bd41
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 4 deletions.
11 changes: 11 additions & 0 deletions common/utils/src/main/resources/error/error-classes.json
Expand Up @@ -3241,6 +3241,12 @@
],
"sqlState" : "0A000"
},
"STATE_STORE_CANNOT_REMOVE_DEFAULT_COLUMN_FAMILY" : {
"message" : [
"Failed to remove default column family with reserved name=<colFamilyName>."
],
"sqlState" : "42802"
},
"STATE_STORE_MULTIPLE_VALUES_PER_KEY" : {
"message" : [
"Store does not support multiple values per key"
Expand Down Expand Up @@ -3950,6 +3956,11 @@
"Creating multiple column families with <stateStoreProvider> is not supported."
]
},
"STATE_STORE_REMOVING_COLUMN_FAMILIES" : {
"message" : [
"Removing column families with <stateStoreProvider> is not supported."
]
},
"TABLE_OPERATION" : {
"message" : [
"Table <tableName> does not support <operation>. Please check the current catalog and namespace to make sure the qualified table name is expected, and also check the catalog implementation which is configured by \"spark.sql.catalog\"."
Expand Down
4 changes: 4 additions & 0 deletions docs/sql-error-conditions-unsupported-feature-error-class.md
Expand Up @@ -194,6 +194,10 @@ set PROPERTIES and DBPROPERTIES at the same time.

Creating multiple column families with `<stateStoreProvider>` is not supported.

## STATE_STORE_REMOVING_COLUMN_FAMILIES

Removing column families with `<stateStoreProvider>` is not supported.

## TABLE_OPERATION

Table `<tableName>` does not support `<operation>`. Please check the current catalog and namespace to make sure the qualified table name is expected, and also check the catalog implementation which is configured by "spark.sql.catalog".
Expand Down
6 changes: 6 additions & 0 deletions docs/sql-error-conditions.md
Expand Up @@ -2025,6 +2025,12 @@ The SQL config `<sqlConf>` cannot be found. Please verify that the config exists

Star (*) is not allowed in a select list when GROUP BY an ordinal position is used.

### STATE_STORE_CANNOT_REMOVE_DEFAULT_COLUMN_FAMILY

[SQLSTATE: 42802](sql-error-conditions-sqlstates.html#class-42-syntax-error-or-access-rule-violation)

Failed to remove default column family with reserved name=`<colFamilyName>`.

### STATE_STORE_MULTIPLE_VALUES_PER_KEY

[SQLSTATE: 42802](sql-error-conditions-sqlstates.html#class-42-syntax-error-or-access-rule-violation)
Expand Down
Expand Up @@ -203,8 +203,9 @@ private[sql] class HDFSBackedStateStoreProvider extends StateStoreProvider with
}

override def removeColFamilyIfExists(colFamilyName: String): Unit = {
throw new UnsupportedOperationException("Removing columnFamily with " +
"HDFSBackedStateStoreProvider is not supported")
throw StateStoreErrors.removingColumnFamiliesNotSupported(
"HDFSBackedStateStoreProvider")

}
}

Expand Down
Expand Up @@ -269,7 +269,7 @@ class RocksDB(
*/
def removeColFamilyIfExists(colFamilyName: String): Unit = {
if (colFamilyName == StateStore.DEFAULT_COL_FAMILY_NAME) {
throw new UnsupportedOperationException("Removing default column family is not allowed")
throw StateStoreErrors.cannotRemoveDefaultColumnFamily(colFamilyName)
}

if (checkColFamilyExists(colFamilyName)) {
Expand Down
Expand Up @@ -37,6 +37,16 @@ object StateStoreErrors {
new StateStoreMultipleColumnFamiliesNotSupportedException(stateStoreProvider)
}

def removingColumnFamiliesNotSupported(stateStoreProvider: String):
StateStoreRemovingColumnFamiliesNotSupportedException = {
new StateStoreRemovingColumnFamiliesNotSupportedException(stateStoreProvider)
}

def cannotRemoveDefaultColumnFamily(colFamilyName: String):
StateStoreCannotRemoveDefaultColumnFamily = {
new StateStoreCannotRemoveDefaultColumnFamily(colFamilyName)
}

def unsupportedOperationException(operationName: String, entity: String):
StateStoreUnsupportedOperationException = {
new StateStoreUnsupportedOperationException(operationName, entity)
Expand All @@ -48,6 +58,18 @@ class StateStoreMultipleColumnFamiliesNotSupportedException(stateStoreProvider:
errorClass = "UNSUPPORTED_FEATURE.STATE_STORE_MULTIPLE_COLUMN_FAMILIES",
messageParameters = Map("stateStoreProvider" -> stateStoreProvider)
)
class StateStoreRemovingColumnFamiliesNotSupportedException(stateStoreProvider: String)
extends SparkUnsupportedOperationException(
errorClass = "UNSUPPORTED_FEATURE.STATE_STORE_REMOVING_COLUMN_FAMILIES",
messageParameters = Map("stateStoreProvider" -> stateStoreProvider)
)

class StateStoreCannotRemoveDefaultColumnFamily(colFamilyName: String)
extends SparkUnsupportedOperationException(
errorClass = "STATE_STORE_CANNOT_REMOVE_DEFAULT_COLUMN_FAMILY",
messageParameters = Map("colFamilyName" -> colFamilyName)
)


class StateStoreUnsupportedOperationException(operationType: String, entity: String)
extends SparkUnsupportedOperationException(
Expand Down
Expand Up @@ -34,7 +34,7 @@ class MemoryStateStore extends StateStore() {
}

override def removeColFamilyIfExists(colFamilyName: String): Unit = {
throw new UnsupportedOperationException("Doesn't support removing column families!")
throw StateStoreErrors.removingColumnFamiliesNotSupported("MemoryStateStoreProvider")
}

override def get(key: UnsafeRow, colFamilyName: String): UnsafeRow = map.get(key)
Expand Down

0 comments on commit 0f2bd41

Please sign in to comment.