JingsongLi commented on a change in pull request #10157: [FLINK-14710][hive]
Decide column nullability according to Hive const…
URL: https://github.com/apache/flink/pull/10157#discussion_r345171325
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/client/HiveShimV310.java
##########
@@ -111,4 +112,28 @@ public void makeSpecFromName(Map<String, String>
partSpec, Path currPath) {
}
}
+ @Override
+ public Set<String> getNotNullColumns(IMetaStoreClient client,
Configuration conf, String dbName, String tableName) {
+ try {
+ Method method =
getMetaStoreUtilsClass().getDeclaredMethod("getDefaultCatalog",
Configuration.class);
+ String hiveDefaultCatalog = (String)
method.invoke(null, conf);
+ Class requestClz =
Class.forName("org.apache.hadoop.hive.metastore.api.NotNullConstraintsRequest");
+ Object request =
requestClz.getDeclaredConstructor(String.class, String.class, String.class)
+ .newInstance(hiveDefaultCatalog,
dbName, tableName);
+ method =
client.getClass().getDeclaredMethod("getNotNullConstraints", requestClz);
Review comment:
Can we have some reflection utils like: `Object invoke(Object obj, String
method, Object... args)`.
In this method, we can get base `class` from `obj`, and get parameter
classes from `args`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services