> On June 4, 2014, 5:22 a.m., hyoungjun kim wrote:
> > tajo-core/src/main/java/org/apache/tajo/engine/planner/PreLogicalPlanVerifier.java,
> > line 251
> > <https://reviews.apache.org/r/21906/diff/2/?file=594928#file594928line251>
> >
> > If a target table name is a FQName like "mydb.table1, qualifiedName
> > variable has a wrong name. This is the cause of NPE error.
> >
> >
> > I tested with the following test code.
> >
> > ResultSet res = executeString("create database testinsertquery1;");
> > res.close();
> > res = executeString("create database testinsertquery2;");
> > res.close();
> >
> > res = executeString("create table testinsertquery1.table1 " +
> > "(col1 int4, col2 int4, col3 float8)");
> > res.close();
> >
> > res = executeString("create table testinsertquery2.table1 " +
> > "(col1 int4, col2 int4, col3 float8)");
> > res.close();
> >
> > CatalogService catalog = testingCluster.getMaster().getCatalog();
> > assertTrue(catalog.existsTable("testinsertquery1", "table1"));
> > assertTrue(catalog.existsTable("testinsertquery2", "table1"));
> >
> > res = executeString("insert overwrite into testinsertquery1.table1
> > " +
> > "select l_orderkey, l_partkey, l_quantity from
> > default.lineitem;");
> > res.close();
> >
> > TableDesc desc = catalog.getTableDesc("testinsertquery1", "table1");
> > if (!testingCluster.isHCatalogStoreRunning()) {
> > assertEquals(5, desc.getStats().getNumRows().intValue());
> > }
> >
> > res = executeString("insert overwrite into testinsertquery2.table1
> > " +
> > "select col1, col2, col3 from testinsertquery1.table1;");
> > res.close();
> >
> > desc = catalog.getTableDesc("testinsertquery2", "table1");
> > if (!testingCluster.isHCatalogStoreRunning()) {
> > assertEquals(5, desc.getStats().getNumRows().intValue());
> > }
> >
I think the following code is fine.
String qualifiedName = expr.getTableName();
if
(TajoConstants.EMPTY_STRING.equals(CatalogUtil.extractQualifier(expr.getTableName())))
{
qualifiedName =
CatalogUtil.buildFQName(context.session.getCurrentDatabase(),
expr.getTableName());
}
- hyoungjun
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/21906/#review44691
-----------------------------------------------------------
On May 27, 2014, 2:03 p.m., Jung JaeHwa wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/21906/
> -----------------------------------------------------------
>
> (Updated May 27, 2014, 2:03 p.m.)
>
>
> Review request for Tajo.
>
>
> Bugs: TAJO-848
> https://issues.apache.org/jira/browse/TAJO-848
>
>
> Repository: tajo
>
>
> Description
> -------
>
> Currently, user can insert data even if there is small columns compare to
> target columns as follows:
> create table table1 (id int, name text, score float, type text) using csv
> with ('csvfile.delimiter'='|') ;
>
> create table table3 (id int, name text, score float, type text) using csv
> with ('csvfile.delimiter'='|') ;
>
> create table table4 (id int, name text, score float, type text) using csv
> with ('csvfile.delimiter'='|') partition by column(part text);
>
> default> insert overwrite into table3 select id, name from table1;
> Progress: 0%, response time: 0.544 sec
> Progress: 100%, response time: 1.158 sec
> (5 rows, 1.158 sec, 60 B inserted)
>
> default> insert overwrite into table4 select id, name from table1;
> Progress: 100%, response time: 0.468 sec
> (5 rows, 0.468 sec, 65 B inserted)
> As above, tajo can run a query for inserting data. But in partitioned table,
> tajo made null value for partition column as follows:
> hdfs dfs -ls /tajo/warehouse/default/table4
> Found 1 items
> drwxr-xr-x - blrunner supergroup 0 2014-05-26 16:27
> /tajo/warehouse/default/table4/part=
> Thus we need to make a syntax exception for blocking null partition value.
>
>
> Diffs
> -----
>
>
> tajo-core/src/main/java/org/apache/tajo/engine/planner/PreLogicalPlanVerifier.java
> 5eca5fd
>
> tajo-core/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
> 0ec7de0
> tajo-core/src/test/resources/queries/TestTablePartitions/case14.sql
> PRE-CREATION
> tajo-core/src/test/resources/queries/TestTablePartitions/case15.sql
> PRE-CREATION
> tajo-core/src/test/resources/results/TestTablePartitions/case14.result
> PRE-CREATION
> tajo-core/src/test/resources/results/TestTablePartitions/case15.result
> PRE-CREATION
>
> Diff: https://reviews.apache.org/r/21906/diff/
>
>
> Testing
> -------
>
> mvn clean install
>
>
> Thanks,
>
> Jung JaeHwa
>
>