akshat0395 commented on code in PR #4475:
URL: https://github.com/apache/hive/pull/4475#discussion_r1283961020
##########
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/dao/HiveDatabaseAccessor.java:
##########
@@ -56,4 +57,19 @@ protected String addLimitToQuery(String sql, int limit) {
}
return sql + " LIMIT " + limit;
}
+
+ @Override
+ protected List<String> getColNamesFromRS(ResultSet rs) throws Exception {
+ List<String> columnNames = super.getColNamesFromRS(rs);
+ return columnNames.stream()
+ .map(c -> {
+ int lastIndex = c.lastIndexOf(".");
+ return lastIndex == -1 ? c : c.substring(lastIndex + 1); })
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ protected String getMetaDataQuery(String sql) {
+ return addLimitToQuery(sql, 0);
Review Comment:
@dengzhhu653 @nrg4878 Thanks for bringing the attention back on this,
apologies for delay got caught up with other things.
Yes, the suggestion is to change
GenericJdbcDatabaseAccessor.addLimitToQuery() and have a direct call for
addLimitToQuery(sql, 0) in the base method itself. As you mentioned it only
metadata and doesn't require limit 1.
I can understand why the current approach might have been take, in class
`JethroDatabaseAccessor` we have done the same implementation of overriding the
method and calling addLimitToQuery(sql, 0).
@dengzhhu653 are there any specific cases/sources where we would need limit
1 rather than limit 0 to get the metadata query?
If not, we should do this change at base itself.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]