[GitHub] [flink] bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] Extend Hive version support to all 1.2 and 2.3 ve…

2019-08-23 Thread GitBox
bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] 
Extend Hive version support to all 1.2 and 2.3 ve…
URL: https://github.com/apache/flink/pull/9524#discussion_r317328127
 
 

 ##
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/client/HiveShimV230.java
 ##
 @@ -86,7 +88,7 @@ public Function getFunction(IMetaStoreClient client, String 
dbName, String funct
public boolean moveToTrash(FileSystem fs, Path path, Configuration 
conf, boolean purge) throws IOException {
try {
Method method = 
FileUtils.class.getDeclaredMethod("moveToTrash", FileSystem.class, Path.class,
-   Configuration.class, boolean.class);
 
 Review comment:
   revert?


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] Extend Hive version support to all 1.2 and 2.3 ve…

2019-08-23 Thread GitBox
bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] 
Extend Hive version support to all 1.2 and 2.3 ve…
URL: https://github.com/apache/flink/pull/9524#discussion_r317328086
 
 

 ##
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/client/HiveShimV230.java
 ##
 @@ -99,14 +101,35 @@ public void alterTable(IMetaStoreClient client, String 
databaseName, String tabl
client.alter_table(databaseName, tableName, table);
}
 
+   @Override
+   public void alterPartition(IMetaStoreClient client, String 
databaseName, String tableName, Partition partition)
+   throws InvalidOperationException, MetaException, TException {
+   String errorMsg = "Failed to alter partition for table %s in 
database %s";
+   try {
+   Method method = 
client.getClass().getMethod("alter_partition", String.class, String.class,
+   Partition.class, EnvironmentContext.class);
+   method.invoke(client, databaseName, tableName, 
partition, null);
+   } catch (InvocationTargetException ite) {
+   Throwable targetEx = ite.getTargetException();
+   if (targetEx instanceof TException) {
+   throw (TException) targetEx;
+   } else {
+   throw new 
CatalogException(String.format(errorMsg, tableName, databaseName), targetEx);
+   }
+   } catch (NoSuchMethodException | IllegalAccessException e) {
+   throw new CatalogException(String.format(errorMsg, 
tableName, databaseName), e);
+   }
+   }
+
@Override
public SimpleGenericUDAFParameterInfo 
createUDAFParameterInfo(ObjectInspector[] params, boolean isWindowing, boolean 
distinct, boolean allColumns) {
try {
Constructor constructor = 
SimpleGenericUDAFParameterInfo.class.getConstructor(ObjectInspector[].class,
-   boolean.class, boolean.class, 
boolean.class);
 
 Review comment:
   revert?


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] Extend Hive version support to all 1.2 and 2.3 ve…

2019-08-23 Thread GitBox
bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] 
Extend Hive version support to all 1.2 and 2.3 ve…
URL: https://github.com/apache/flink/pull/9524#discussion_r317328097
 
 

 ##
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/client/HiveShimV230.java
 ##
 @@ -99,14 +101,35 @@ public void alterTable(IMetaStoreClient client, String 
databaseName, String tabl
client.alter_table(databaseName, tableName, table);
}
 
+   @Override
+   public void alterPartition(IMetaStoreClient client, String 
databaseName, String tableName, Partition partition)
+   throws InvalidOperationException, MetaException, TException {
+   String errorMsg = "Failed to alter partition for table %s in 
database %s";
+   try {
+   Method method = 
client.getClass().getMethod("alter_partition", String.class, String.class,
+   Partition.class, EnvironmentContext.class);
+   method.invoke(client, databaseName, tableName, 
partition, null);
+   } catch (InvocationTargetException ite) {
+   Throwable targetEx = ite.getTargetException();
+   if (targetEx instanceof TException) {
+   throw (TException) targetEx;
+   } else {
+   throw new 
CatalogException(String.format(errorMsg, tableName, databaseName), targetEx);
+   }
+   } catch (NoSuchMethodException | IllegalAccessException e) {
+   throw new CatalogException(String.format(errorMsg, 
tableName, databaseName), e);
+   }
+   }
+
@Override
public SimpleGenericUDAFParameterInfo 
createUDAFParameterInfo(ObjectInspector[] params, boolean isWindowing, boolean 
distinct, boolean allColumns) {
try {
Constructor constructor = 
SimpleGenericUDAFParameterInfo.class.getConstructor(ObjectInspector[].class,
-   boolean.class, boolean.class, 
boolean.class);
+   boolean.class, boolean.class, boolean.class);
return (SimpleGenericUDAFParameterInfo) 
constructor.newInstance(params, isWindowing, distinct, allColumns);
} catch (NoSuchMethodException | IllegalAccessException | 
InstantiationException | InvocationTargetException e) {
throw new CatalogException("Failed to create 
SimpleGenericUDAFParameterInfo", e);
}
}
+
 
 Review comment:
   revert?


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] Extend Hive version support to all 1.2 and 2.3 ve…

2019-08-23 Thread GitBox
bowenli86 commented on a change in pull request #9524: [FLINK-13841][hive] 
Extend Hive version support to all 1.2 and 2.3 ve…
URL: https://github.com/apache/flink/pull/9524#discussion_r317328213
 
 

 ##
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/client/HiveShimV230.java
 ##
 @@ -99,14 +101,35 @@ public void alterTable(IMetaStoreClient client, String 
databaseName, String tabl
client.alter_table(databaseName, tableName, table);
}
 
+   @Override
+   public void alterPartition(IMetaStoreClient client, String 
databaseName, String tableName, Partition partition)
+   throws InvalidOperationException, MetaException, TException {
 
 Review comment:
   nit: needs an extra tab


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services