!237 Column readers size issues
Merge pull request !237 from RajeevRastogi/pushdown.random.ut.fix
This commit is contained in:
commit
a09849d588
|
|
@ -21,6 +21,11 @@ import static io.prestosql.plugin.hive.HiveQueryRunner.createQueryRunner;
|
|||
public class TestHiveDistributedAggregations
|
||||
extends AbstractTestAggregations
|
||||
{
|
||||
protected boolean supportsPushdown()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public TestHiveDistributedAggregations()
|
||||
{
|
||||
super(() -> createQueryRunner(getTables()));
|
||||
|
|
|
|||
|
|
@ -4965,6 +4965,7 @@ public class TestHiveIntegrationSmokeTest
|
|||
assertUpdate(session1, "CREATE TABLE alldtype (id1 int, id4 double, id5 float, id6 decimal(5,2), id7 varchar(10), id8 char(10)) with (format='orc')");
|
||||
assertUpdate(session1, "INSERT Into alldtype values(1,4.5,5.6,6.7,'rajeev','male')", 1);
|
||||
assertQuery(session1, "select * from alldtype where id1=1", "SELECT 1,4.5,5.6,6.7,'rajeev','male'");
|
||||
assertQuery(session1, "select count(1) from alldtype where id4=4.5", "SELECT 1");
|
||||
assertUpdate(session1, "CREATE TABLE part2key (id1 int, id2 int, id3 int) with (format='orc', partitioned_by=ARRAY['id2','id3'])");
|
||||
assertUpdate(session1, "INSERT Into part2key values(1,2,3)", 1);
|
||||
assertQuery(session1, "select * from part2key where id2=2 and id3=3", "SELECT 1,2,3");
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ public class OrcSelectiveRecordReader
|
|||
throws OrcCorruptionException
|
||||
{
|
||||
int fieldCount = orcTypes.get(OrcColumnId.ROOT_COLUMN).getFieldCount();
|
||||
SelectiveColumnReader[] columnReaders = new SelectiveColumnReader[includedColumns.size()];
|
||||
SelectiveColumnReader[] columnReaders = new SelectiveColumnReader[fieldCount];
|
||||
|
||||
colReaderWithFilter = new IntArraySet();
|
||||
colReaderWithORFilter = new IntArraySet();
|
||||
|
|
@ -455,7 +455,7 @@ public class OrcSelectiveRecordReader
|
|||
}
|
||||
}
|
||||
|
||||
// specially for alter add/drop column case:
|
||||
// specially for alter add column case:
|
||||
for (int missingColumn : missingColumns) {
|
||||
if (filters.get(missingColumn) != null) {
|
||||
colReaderWithFilter.add(missingColumn);
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ public class SliceDirectSelectiveColumnReader
|
|||
if (data == null || data.length < totalLength) {
|
||||
data = new byte[totalLength];
|
||||
}
|
||||
if (offsets == null || offsets.length < totalLength) {
|
||||
if (offsets == null || offsets.length < totalLength + 1) {
|
||||
offsets = new int[totalPositions + 1];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
*/
|
||||
package io.prestosql.tests;
|
||||
|
||||
import io.prestosql.Session;
|
||||
import io.prestosql.testing.MaterializedResult;
|
||||
import io.prestosql.testing.MaterializedRow;
|
||||
import org.testng.annotations.Test;
|
||||
|
|
@ -27,6 +28,11 @@ import static org.testng.Assert.assertTrue;
|
|||
public abstract class AbstractTestAggregations
|
||||
extends AbstractTestQueryFramework
|
||||
{
|
||||
protected boolean supportsPushdown()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public AbstractTestAggregations(QueryRunnerSupplier supplier)
|
||||
{
|
||||
super(supplier);
|
||||
|
|
@ -317,6 +323,13 @@ public abstract class AbstractTestAggregations
|
|||
|
||||
assertQuery("SELECT count(1) FILTER (WHERE orderstatus = 'O') FROM orders", "SELECT count(*) FROM orders WHERE orderstatus = 'O'");
|
||||
|
||||
if (supportsPushdown()) {
|
||||
Session session1 = Session.builder(getSession())
|
||||
.setCatalogSessionProperty(getSession().getCatalog().get(), "orc_predicate_pushdown_enabled", "true")
|
||||
.build();
|
||||
assertQuery(session1, "SELECT count(1) FILTER (WHERE orderstatus = 'O') FROM orders", "SELECT count(*) FROM orders WHERE orderstatus = 'O'");
|
||||
}
|
||||
|
||||
// filter out all rows
|
||||
assertQuery("SELECT sum(x) FILTER (WHERE y > 5) FROM (VALUES (1, 3), (2, 4), (2, 4), (4, 5)) t (x, y)", "SELECT null");
|
||||
assertQuery("SELECT count(*) FILTER (WHERE x > 4), sum(x) FILTER (WHERE y > 5) FROM (VALUES (1, 3), (2, 4), (2, 4), (4, 5)) t (x, y)", "SELECT 0, null");
|
||||
|
|
|
|||
Loading…
Reference in New Issue