Skip to content

Commit

Permalink
code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
dengzhhu653 committed Feb 28, 2024
1 parent 075da06 commit 215022f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package org.apache.hadoop.hive.metastore;

import java.sql.Date;
import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.sql.SQLTransactionRollbackException;
Expand All @@ -38,7 +37,6 @@
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars;
import org.apache.hadoop.hive.metastore.txn.TxnUtils;
import org.apache.hadoop.hive.metastore.utils.MetaStoreUtils;
import org.apache.hadoop.util.ReflectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import static org.apache.hadoop.hive.metastore.ColumnType.TIMESTAMP_TYPE_NAME;
import static org.apache.hadoop.hive.metastore.ColumnType.TINYINT_TYPE_NAME;
import static org.apache.hadoop.hive.metastore.ColumnType.VARCHAR_TYPE_NAME;
import static org.apache.hadoop.hive.metastore.utils.FileUtils.unescapePathName;

import java.sql.Connection;
import java.sql.SQLException;
Expand Down Expand Up @@ -1427,7 +1426,6 @@ public void visit(LeafNode node) throws MetaException {
// type mismatch when string col is filtered by a string that looks like date.
if (colType == FilterType.Date) {
try {
// check the nodeValue is a valid date
nodeValue = MetaStoreUtils.convertDateToString(
MetaStoreUtils.convertStringToDate((String) nodeValue));
valType = FilterType.Date;
Expand All @@ -1439,11 +1437,10 @@ public void visit(LeafNode node) throws MetaException {
}
} else if (colType == FilterType.Timestamp) {
if (dbType.isDERBY() || dbType.isMYSQL()) {
filterBuffer.setError("Filter pushdown on timestamp not supported for " + dbType.dbType.name());
filterBuffer.setError("Filter pushdown on timestamp not supported for " + dbType.dbType);
return;
}
try {
// check the nodeValue is a valid timestamp
MetaStoreUtils.convertStringToTimestamp((String) nodeValue);
valType = FilterType.Timestamp;
if (dbType.isPOSTGRES() || dbType.isORACLE()) {
Expand Down Expand Up @@ -1528,7 +1525,7 @@ public void visit(LeafNode node) throws MetaException {
boolean isOpEquals = Operator.isEqualOperator(node.operator);
if (isOpEquals || Operator.isNotEqualOperator(node.operator)) {
Map<String, String> partKeyToVal = new HashMap<>();
partKeyToVal.put(partCol.getName(), nodeValue.toString());
partKeyToVal.put(partCol.getName(), node.value.toString());
String escapedNameFragment = Warehouse.makePartName(partKeyToVal, false);
if (colType == FilterType.Date) {
// Some engines like Pig will record both date and time values, in which case we need
Expand Down

0 comments on commit 215022f

Please sign in to comment.