tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hj...@apache.org
Subject [29/29] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into hbase_storage
Date Fri, 05 Dec 2014 08:21:33 GMT
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into hbase_storage

Conflicts:
	tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/1526b7d1
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/1526b7d1
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/1526b7d1

Branch: refs/heads/hbase_storage
Commit: 1526b7d1073c24c653ce17b93df3290c65ffe4e2
Parents: 0073ef2 ab2efce
Author: HyoungJun Kim <babokim@babokim-MacBook-Pro.local>
Authored: Fri Dec 5 17:20:19 2014 +0900
Committer: HyoungJun Kim <babokim@babokim-MacBook-Pro.local>
Committed: Fri Dec 5 17:20:19 2014 +0900

----------------------------------------------------------------------
 CHANGES                                         |   7 +-
 .../org/apache/tajo/client/TestTajoClient.java  |  37 +++-
 .../tajo/engine/eval/TestIntervalType.java      | 172 ++++++++---------
 .../engine/function/TestDateTimeFunctions.java  | 184 +++++++++----------
 .../org/apache/tajo/plan/LogicalPlanner.java    |  20 +-
 .../org/apache/tajo/plan/util/PlannerUtil.java  |  17 ++
 6 files changed, 248 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/1526b7d1/CHANGES
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/1526b7d1/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
----------------------------------------------------------------------
diff --cc tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
index b5d2db3,c55c203..4e61de4
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
@@@ -21,11 -21,15 +21,13 @@@ package org.apache.tajo.plan.util
  import com.google.common.base.Preconditions;
  import com.google.common.collect.Lists;
  import com.google.common.collect.Sets;
+ import org.apache.tajo.OverridableConf;
+ import org.apache.tajo.SessionVars;
  import org.apache.tajo.algebra.*;
  import org.apache.tajo.annotation.Nullable;
 -import org.apache.tajo.catalog.Column;
 -import org.apache.tajo.catalog.Schema;
 -import org.apache.tajo.catalog.SchemaUtil;
 -import org.apache.tajo.catalog.SortSpec;
 +import org.apache.tajo.catalog.*;
  import org.apache.tajo.catalog.proto.CatalogProtos;
 +import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
  import org.apache.tajo.common.TajoDataTypes.DataType;
  import org.apache.tajo.plan.*;
  import org.apache.tajo.plan.expr.*;
@@@ -33,11 -37,15 +35,16 @@@ import org.apache.tajo.plan.logical.*
  import org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor;
  import org.apache.tajo.plan.visitor.ExplainLogicalPlanVisitor;
  import org.apache.tajo.plan.visitor.SimpleAlgebraVisitor;
+ import org.apache.tajo.storage.StorageConstants;
+ import org.apache.tajo.util.KeyValueSet;
  import org.apache.tajo.util.TUtil;
  
 +import java.io.IOException;
  import java.util.*;
  
+ import static org.apache.tajo.catalog.proto.CatalogProtos.StoreType.CSV;
+ import static org.apache.tajo.catalog.proto.CatalogProtos.StoreType.TEXTFILE;
+ 
  public class PlannerUtil {
  
    public static boolean checkIfDDLPlan(LogicalNode node) {
@@@ -776,108 -784,13 +783,118 @@@
      return explains.toString();
    }
  
+   public static void applySessionToTableProperties(OverridableConf sessionVars,
+                                                    CatalogProtos.StoreType storeType,
+                                                    KeyValueSet tableProperties) {
+     if (storeType == CSV || storeType == TEXTFILE) {
+       if (sessionVars.containsKey(SessionVars.NULL_CHAR)) {
+         tableProperties.set(StorageConstants.TEXT_NULL, sessionVars.get(SessionVars.NULL_CHAR));
+       }
+     }
+   }
++
 +  public static boolean isFileStorageType(String storageType) {
 +    if (storageType.equalsIgnoreCase("hbase")) {
 +      return false;
 +    } else {
 +      return true;
 +    }
 +  }
 +
 +  public static boolean isFileStorageType(StoreType storageType) {
 +    if (storageType== StoreType.HBASE) {
 +      return false;
 +    } else {
 +      return true;
 +    }
 +  }
 +
 +  public static StoreType getStoreType(LogicalPlan plan) {
 +    LogicalRootNode rootNode = plan.getRootBlock().getRoot();
 +    NodeType nodeType = rootNode.getChild().getType();
 +    if (nodeType == NodeType.CREATE_TABLE) {
 +      return ((CreateTableNode)rootNode.getChild()).getStorageType();
 +    } else if (nodeType == NodeType.INSERT) {
 +      return ((InsertNode)rootNode.getChild()).getStorageType();
 +    } else {
 +      return null;
 +    }
 +  }
 +
 +  public static String getStoreTableName(LogicalPlan plan) {
 +    LogicalRootNode rootNode = plan.getRootBlock().getRoot();
 +    NodeType nodeType = rootNode.getChild().getType();
 +    if (nodeType == NodeType.CREATE_TABLE) {
 +      return ((CreateTableNode)rootNode.getChild()).getTableName();
 +    } else if (nodeType == NodeType.INSERT) {
 +      return ((InsertNode)rootNode.getChild()).getTableName();
 +    } else {
 +      return null;
 +    }
 +  }
 +
 +  public static TableDesc getTableDesc(CatalogService catalog, LogicalNode node) throws
IOException {
 +    if (node.getType() == NodeType.CREATE_TABLE) {
 +      return createTableDesc((CreateTableNode)node);
 +    }
 +    String tableName = null;
 +    InsertNode insertNode = null;
 +    if (node.getType() == NodeType.INSERT) {
 +      insertNode = (InsertNode)node;
 +      tableName = insertNode.getTableName();
 +    } else {
 +      return null;
 +    }
 +
 +    if (tableName != null) {
 +      String[] tableTokens = tableName.split("\\.");
 +      if (tableTokens.length >= 2) {
 +        if (catalog.existsTable(tableTokens[0], tableTokens[1])) {
 +          return catalog.getTableDesc(tableTokens[0], tableTokens[1]);
 +        }
 +      }
 +    } else {
 +      if (insertNode.getPath() != null) {
 +        //insert ... location
 +        return createTableDesc(insertNode);
 +      }
 +    }
 +    return null;
 +  }
 +
 +  private static TableDesc createTableDesc(CreateTableNode createTableNode) {
 +    TableMeta meta = new TableMeta(createTableNode.getStorageType(), createTableNode.getOptions());
 +
 +    TableDesc tableDescTobeCreated =
 +        new TableDesc(
 +            createTableNode.getTableName(),
 +            createTableNode.getTableSchema(),
 +            meta,
 +            createTableNode.getPath() != null ? createTableNode.getPath().toUri() : null);
 +
 +    tableDescTobeCreated.setExternal(createTableNode.isExternal());
 +
 +    if (createTableNode.hasPartition()) {
 +      tableDescTobeCreated.setPartitionMethod(createTableNode.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.getPath() != null ? insertNode.getPath().toUri() : null);
 +
 +    if (insertNode.hasPartition()) {
 +      tableDescTobeCreated.setPartitionMethod(insertNode.getPartitionMethod());
 +    }
 +
 +    return tableDescTobeCreated;
 +  }
  }


Mime
View raw message