rdblue commented on a change in pull request #1495:
URL: https://github.com/apache/iceberg/pull/1495#discussion_r497789557
##########
File path: mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergSerDe.java
##########
@@ -27,21 +27,41 @@
import org.apache.hadoop.hive.serde2.SerDeStats;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.io.Writable;
-import org.apache.iceberg.Table;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.SchemaParser;
+import org.apache.iceberg.exceptions.NoSuchTableException;
import org.apache.iceberg.mr.Catalogs;
+import org.apache.iceberg.mr.InputFormatConfig;
import org.apache.iceberg.mr.hive.serde.objectinspector.IcebergObjectInspector;
import org.apache.iceberg.mr.mapred.Container;
public class HiveIcebergSerDe extends AbstractSerDe {
-
+ private Schema schema;
private ObjectInspector inspector;
@Override
public void initialize(@Nullable Configuration configuration, Properties
serDeProperties) throws SerDeException {
- Table table = Catalogs.loadTable(configuration, serDeProperties);
-
try {
- this.inspector = IcebergObjectInspector.create(table.schema());
+ // HiveIcebergSerDe.initialize is called multiple places in Hive code:
+ // - When we are trying to create a table - HiveDDL data is stored at
the serDeProperties, but no Iceberg table
+ // is created yet.
+ // - When we are compiling the Hive query on HiveServer2 side - We only
have table information (location/name),
+ // and we have to read the schema using the table data. This is called
multiple times so there is room for
+ // optimizing here.
Review comment:
`SchemaParser` has a cache, so that should help some.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]