Aitozi commented on code in PR #21522:
URL: https://github.com/apache/flink/pull/21522#discussion_r1139716355
##########
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/util/HiveTableUtil.java:
##########
@@ -96,11 +106,104 @@ public class HiveTableUtil {
private HiveTableUtil() {}
- public static TableSchema createTableSchema(
+ /** Create a Flink's Schema by hive client. */
+ public static org.apache.flink.table.api.Schema createSchema(
+ HiveConf hiveConf,
+ Table hiveTable,
+ HiveMetastoreClientWrapper client,
+ HiveShim hiveShim) {
+
+ Tuple4<List<FieldSchema>, List<FieldSchema>, Set<String>,
Optional<UniqueConstraint>>
+ hiveTableInfo = extractHiveTableInfo(hiveConf, hiveTable,
client, hiveShim);
+
+ return createSchema(
+ hiveTableInfo.f0,
+ hiveTableInfo.f1,
+ hiveTableInfo.f2,
+ hiveTableInfo.f3.orElse(null));
+ }
+
+ /** Create a Flink's Schema from Hive table's columns and partition keys.
*/
+ public static org.apache.flink.table.api.Schema createSchema(
+ List<FieldSchema> nonPartCols,
+ List<FieldSchema> partitionKeys,
+ Set<String> notNullColumns,
+ @Nullable UniqueConstraint primaryKey) {
+ return Schema.newBuilder()
+ .fromResolvedSchema(
+ createResolvedSchema(
Review Comment:
Make sense, will apply your commits :)
--
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]