You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/06/03 17:43:27 UTC
[GitHub] [hive] pvary commented on a change in pull request #2348: HIVE-25194: Add support for STORED AS ORC/PARQUET/AVRO for Iceberg
pvary commented on a change in pull request #2348:
URL: https://github.com/apache/hive/pull/2348#discussion_r645003383
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/StorageFormat.java
##########
@@ -81,11 +84,34 @@ public boolean fillStorageFormat(ASTNode child) throws SemanticException {
}
break;
case HiveParser.TOK_STORAGEHANDLER:
- storageHandler = processStorageHandler(child.getChild(0).getText());
- if (child.getChildCount() == 2) {
- BaseSemanticAnalyzer.readProps(
- (ASTNode) (child.getChild(1).getChild(0)),
- serdeProps);
+ for (int i = 0; i < child.getChildCount(); i++) {
+ ASTNode grandChild = (ASTNode) child.getChild(i);
+ switch (grandChild.getToken().getType()) {
+ case HiveParser.TOK_FILEFORMAT_GENERIC:
+ String fileFormatPropertyKey = null;
+ try {
+ HiveStorageHandler handler = HiveUtils.getStorageHandler(conf, this.storageHandler);
+ fileFormatPropertyKey = handler.getFileFormatPropertyKey();
+ } catch (HiveException e) {
+ throw new SemanticException("Failed to load storage handler: " + e.getMessage());
+ }
+
+ if (fileFormatPropertyKey != null) {
+ String fileFormat = grandChild.getChild(0).getText();
+ if (serdeProps.containsKey(fileFormatPropertyKey)) {
+ throw new SemanticException("Provide only one of the following: STORED BY " + fileFormat +
+ " or WITH SERDEPROPERTIES('" + fileFormatPropertyKey + "'='" + fileFormat + "')");
+ }
+
+ serdeProps.put(fileFormatPropertyKey, fileFormat);
Review comment:
What happens if the fileformat is Text or some other valid fileformat which is not supported by Iceberg?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/StorageFormat.java
##########
@@ -81,11 +84,34 @@ public boolean fillStorageFormat(ASTNode child) throws SemanticException {
}
break;
case HiveParser.TOK_STORAGEHANDLER:
- storageHandler = processStorageHandler(child.getChild(0).getText());
- if (child.getChildCount() == 2) {
- BaseSemanticAnalyzer.readProps(
- (ASTNode) (child.getChild(1).getChild(0)),
- serdeProps);
+ for (int i = 0; i < child.getChildCount(); i++) {
Review comment:
What happens when StorageHandler is HBase and Stored By is also set?
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org