private static TableDesc createTableDesc(InsertNode insertNode) { TableMeta meta = new TableMeta(insertNode.getStorageType(), insertNode.getOptions()); TableDesc tableDescTobeCreated = new TableDesc( insertNode.getTableName(), insertNode.getTableSchema(), meta, insertNode.getUri() != null ? insertNode.getUri() : null); if (insertNode.hasPartition()) { tableDescTobeCreated.setPartitionMethod(insertNode.getPartitionMethod()); } return tableDescTobeCreated; }
private static TableDesc createTableDesc(InsertNode insertNode) { TableMeta meta = new TableMeta(insertNode.getStorageType(), insertNode.getOptions()); TableDesc tableDescTobeCreated = new TableDesc( insertNode.getTableName(), insertNode.getTableSchema(), meta, insertNode.getUri() != null ? insertNode.getUri() : null); if (insertNode.hasPartition()) { tableDescTobeCreated.setPartitionMethod(insertNode.getPartitionMethod()); } return tableDescTobeCreated; }
@Override public void hook(QueryContext queryContext, LogicalPlan plan) throws Exception { queryContext.setInsert(); InsertNode insertNode = plan.getRootBlock().getNode(NodeType.INSERT); // Set QueryContext settings, such as output table name and output path. // It also remove data files if overwrite is true. if (insertNode.hasTargetTable()) { // INSERT INTO [TB_NAME] queryContext.setOutputTable(insertNode.getTableName()); if (insertNode.hasPartition()) { queryContext.setPartitionMethod(insertNode.getPartitionMethod()); } } else { // INSERT INTO LOCATION ... // When INSERT INTO LOCATION, must not set output table. queryContext.setFileOutput(); } // Set the final output table uri queryContext.setOutputPath(insertNode.getUri()); if (insertNode.isOverwrite()) { queryContext.setOutputOverwrite(); } } }
@Override public void hook(QueryContext queryContext, LogicalPlan plan) throws Exception { queryContext.setInsert(); InsertNode insertNode = plan.getRootBlock().getNode(NodeType.INSERT); // Set QueryContext settings, such as output table name and output path. // It also remove data files if overwrite is true. if (insertNode.hasTargetTable()) { // INSERT INTO [TB_NAME] queryContext.setOutputTable(insertNode.getTableName()); if (insertNode.hasPartition()) { queryContext.setPartitionMethod(insertNode.getPartitionMethod()); } } else { // INSERT INTO LOCATION ... // When INSERT INTO LOCATION, must not set output table. queryContext.setFileOutput(); } // Set the final output table uri queryContext.setOutputPath(insertNode.getUri()); if (insertNode.isOverwrite()) { queryContext.setOutputOverwrite(); } } }