[
https://issues.apache.org/jira/browse/TAJO-1359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14532841#comment-14532841
]
ASF GitHub Bot commented on TAJO-1359:
--------------------------------------
Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/422#discussion_r29862163
--- Diff:
tajo-plan/src/main/java/org/apache/tajo/plan/nameresolver/NameResolver.java ---
@@ -51,30 +70,45 @@
resolverMap.put(NameResolvingMode.LEGACY, new ResolverByLegacy());
}
+ public static Column resolve(LogicalPlan plan, LogicalPlan.QueryBlock
block, ColumnReferenceExpr column,
+ NameResolvingMode mode) throws
PlanningException {
+ if (!resolverMap.containsKey(mode)) {
+ throw new PlanningException("Unsupported name resolving level: " +
mode.name());
+ }
+ return resolverMap.get(mode).resolve(plan, block, column);
+ }
+
abstract Column resolve(LogicalPlan plan, LogicalPlan.QueryBlock block,
ColumnReferenceExpr columnRef)
throws PlanningException;
/**
- * Try to find the database name
+ * Guess a relation from a table name regardless of whether the given
name is qualified or not.
*
* @param block the current block
- * @param tableName The table name
- * @return The found database name
+ * @param tableName The table name which can be either qualified or not.
+ * @return A corresponding relation
* @throws PlanningException
*/
- public static String resolveDatabase(LogicalPlan.QueryBlock block,
String tableName) throws PlanningException {
- List<String> found = new ArrayList<String>();
+ public static RelationNode lookupTable(LogicalPlan.QueryBlock block,
String tableName) throws PlanningException {
+ List<RelationNode> found = TUtil.newList();
+
for (RelationNode relation : block.getRelations()) {
- // check alias name or table name
- if
(CatalogUtil.extractSimpleName(relation.getCanonicalName()).equals(tableName) ||
+
+ // if a table name is qualified
+ if (relation.getCanonicalName().equals(tableName) ||
relation.getTableName().equals(tableName)) {
+ found.add(relation);
+
+ // if a table name is not qualified
+ } else if
(CatalogUtil.extractSimpleName(relation.getCanonicalName()).equals(tableName) ||
CatalogUtil.extractSimpleName(relation.getTableName()).equals(tableName)) {
- // obtain the database name
- found.add(CatalogUtil.extractQualifier(relation.getTableName()));
+ // obtain the a qualified table name
--- End diff --
This comment looks unnecessary.
> Add nested field projector and language extension to project nested record
> --------------------------------------------------------------------------
>
> Key: TAJO-1359
> URL: https://issues.apache.org/jira/browse/TAJO-1359
> Project: Tajo
> Issue Type: Sub-task
> Components: parser, physical operator, planner/optimizer
> Reporter: Hyunsik Choi
> Assignee: Hyunsik Choi
> Fix For: 0.11.0
>
> Attachments: TAJO-1359.patch, TAJO-1359_2.patch, TAJO-1359_3.patch,
> TAJO-1359_4.patch, TAJO-1359_5.patch, TAJO-1359_6.patch, TAJO-1359_7.patch
>
>
> We need to improve Projector class to get nested record fields, and we also
> add some language extension to specify certain nested records in table
> schema. Both works should be done together. Otherwise, we need to test an
> entire work process.
> Using dot '.' would be good for the syntax to specify nested fields. Many
> systems (Hive, Google BigQuery, and Drill) already use this syntax. Probably,
> many users are familiar with this form.
> For example, if *employee* is a root nested record field and it includes
> *age* and *name* fields, consisting two fields lastname and firstname, we can
> specify them individually as follows:
> {code}
> SELECT employee.age, employee.name.lastname, employee.name.firstname FROM ...
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)