[GitHub] [flink] xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats
xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats URL: https://github.com/apache/flink/pull/9264#discussion_r310218554 ## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/connectors/hive/HiveTableOutputFormat.java ## @@ -259,13 +259,13 @@ public void configure(Configuration parameters) { public void open(int taskNumber, int numTasks) throws IOException { try { StorageDescriptor sd = hiveTablePartition.getStorageDescriptor(); - serializer = (Serializer) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); - Preconditions.checkArgument(serializer instanceof Deserializer, - "Expect to get a SerDe, but actually got " + serializer.getClass().getName()); - ReflectionUtils.setConf(serializer, jobConf); + recordSerDe = (Serializer) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); Review comment: Can we assert the type to be "Serializer" before casting it, similar to below for "Deserializer"? 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] xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats
xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats URL: https://github.com/apache/flink/pull/9264#discussion_r310218168 ## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/connectors/hive/HiveTableOutputFormat.java ## @@ -124,7 +124,7 @@ private transient int numNonPartitionColumns; // SerDe in Hive-1.2.1 and Hive-2.3.4 can be of different classes, make sure to use a common base class - private transient Serializer serializer; + private transient Serializer recordSerDe; Review comment: Maybe the type here should be just "Object". 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] xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats
xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats URL: https://github.com/apache/flink/pull/9264#discussion_r310217103 ## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/batch/connectors/hive/HiveTableOutputFormat.java ## @@ -256,10 +258,12 @@ public void configure(Configuration parameters) { public void open(int taskNumber, int numTasks) throws IOException { try { StorageDescriptor sd = hiveTablePartition.getStorageDescriptor(); - serializer = (AbstractSerDe) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); + serializer = (Serializer) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); + Preconditions.checkArgument(serializer instanceof Deserializer, Review comment: yeah! :) 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] xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats
xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats URL: https://github.com/apache/flink/pull/9264#discussion_r308872595 ## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java ## @@ -494,8 +495,22 @@ private static CatalogBaseTable instantiateCatalogTable(Table hiveTable) { String comment = properties.remove(HiveCatalogConfig.COMMENT); // Table schema + List fields; + if (org.apache.hadoop.hive.ql.metadata.Table.hasMetastoreBasedSchema(hiveConf, + hiveTable.getSd().getSerdeInfo().getSerializationLib())) { Review comment: It seems that Table.getCols() is already doing what it's done here. Could you please check? 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] xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats
xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats URL: https://github.com/apache/flink/pull/9264#discussion_r308867419 ## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/batch/connectors/hive/HiveTableOutputFormat.java ## @@ -256,10 +258,12 @@ public void configure(Configuration parameters) { public void open(int taskNumber, int numTasks) throws IOException { try { StorageDescriptor sd = hiveTablePartition.getStorageDescriptor(); - serializer = (AbstractSerDe) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); + serializer = (Serializer) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); + Preconditions.checkArgument(serializer instanceof Deserializer, Review comment: Casting is fine, but can we name the variable differently? 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] xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats
xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats URL: https://github.com/apache/flink/pull/9264#discussion_r308358142 ## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/batch/connectors/hive/HiveTableOutputFormat.java ## @@ -256,10 +258,12 @@ public void configure(Configuration parameters) { public void open(int taskNumber, int numTasks) throws IOException { try { StorageDescriptor sd = hiveTablePartition.getStorageDescriptor(); - serializer = (AbstractSerDe) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); + serializer = (Serializer) Class.forName(sd.getSerdeInfo().getSerializationLib()).newInstance(); + Preconditions.checkArgument(serializer instanceof Deserializer, Review comment: Not sure if I understand this. Interfaces Serializer and Deserializer are independent. While a serde class may implement both, it seem weird to name a variable "serializer" and later cast it to Deserializer type. 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] xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats
xuefuz commented on a change in pull request #9264: [FLINK-13192][hive] Add tests for different Hive table formats URL: https://github.com/apache/flink/pull/9264#discussion_r308358835 ## File path: flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/batch/connectors/hive/TableEnvHiveConnectorTest.java ## @@ -85,4 +87,40 @@ public void testDefaultPartitionName() throws Exception { hiveShell.execute("drop database db1 cascade"); } + + @Test + public void testDifferentFormats() throws Exception { + String[] formats = new String[]{"orc", "parquet", "sequencefile"}; Review comment: It would be great to cover text/csv as it's also comment, especially for testing/poc. 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