[ https://issues.apache.org/jira/browse/HIVE-21614?focusedWorklogId=623325&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-623325 ]
ASF GitHub Bot logged work on HIVE-21614: ----------------------------------------- Author: ASF GitHub Bot Created on: 15/Jul/21 23:00 Start Date: 15/Jul/21 23:00 Worklog Time Spent: 10m Work Description: hankfanchiu opened a new pull request #2484: URL: https://github.com/apache/hive/pull/2484 ### What changes were proposed in this pull request? On the Hive MetaStore server's side of the `HiveMetaStoreClient#listTableNamesByFilter()` API, conditionally manipulate the string filter by replacing any `=` comparison on a table parameter with a `LIKE` operator. This replacement is only performed if: 1. The database product backing the Hive MetaStore is Derby, 2. The `=` comparison is on a table parameter, i.e. the `"TABLE_PARAMS"."PARAM_VALUE"` column. ### Why are the changes needed? HIVE-12274 changed the type of the `"TABLE_PARAMS"."PARAM_VALUE"` column to `CLOB` for Derby and Oracle, e.g.: https://github.com/apache/hive/blob/7d4134e7fe9bfb8b8aa3344a9ae72f4f36c98b2c/metastore/scripts/upgrade/derby/039-HIVE-12274.derby.sql#L8-L12 With the type change, invoking `ObjectStore#listTableNamesByFilter()` given a `=` comparison -- on a table parameter stored in Derby -- fails with the following exception: ``` ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB (UCS_BASIC)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1') ``` Without reverting the column type change, we add support for `=` comparison on table parameters in Derby. ### Does this PR introduce _any_ user-facing change? Yes, invoking `HiveMetaStoreClient#listTableNamesByFilter()` with a `$param_key = '$param_value'` filter now succeeds for Derby databases. ### How was this patch tested? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 623325) Remaining Estimate: 0h Time Spent: 10m > Derby does not support CLOB comparisons > --------------------------------------- > > Key: HIVE-21614 > URL: https://issues.apache.org/jira/browse/HIVE-21614 > Project: Hive > Issue Type: Bug > Components: Metastore > Affects Versions: 2.3.4, 3.0.0 > Reporter: Vlad Rozov > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > HiveMetaStoreClient.listTableNamesByFilter() with non empty filter causes > exception with Derby DB: > {noformat} > Caused by: ERROR 42818: Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB > (UCS_BASIC)' are not supported. Types must be comparable. String types must > also have matching collation. If collation does not match, a possible > solution is to cast operands to force them to the default collation (e.g. > SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = > 'T1') > at org.apache.derby.iapi.error.StandardException.newException(Unknown > Source) > at org.apache.derby.iapi.error.StandardException.newException(Unknown > Source) > at > org.apache.derby.impl.sql.compile.BinaryComparisonOperatorNode.bindComparisonOperator(Unknown > Source) > at > org.apache.derby.impl.sql.compile.BinaryComparisonOperatorNode.bindExpression(Unknown > Source) > at > org.apache.derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Unknown > Source) > at > org.apache.derby.impl.sql.compile.BinaryLogicalOperatorNode.bindExpression(Unknown > Source) > at org.apache.derby.impl.sql.compile.AndNode.bindExpression(Unknown > Source) > at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(Unknown > Source) > at > org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(Unknown > Source) > at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown > Source) > at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown > Source) > at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source) > at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source) > at > org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown > Source) > ... 42 more > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)