Skip to content

Commit

Permalink
[native] Add support for ORC reader and add orc native tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wjameswu committed Feb 12, 2025
1 parent c6542f0 commit 794aa57
Show file tree
Hide file tree
Showing 6 changed files with 545 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,11 @@ public void testTpcdsQ20()
public void testTpcdsQ21()
throws Exception
{
assertQuery(session, getTpcdsQuery("21"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("21"));
}
}

@Test
Expand Down Expand Up @@ -703,7 +707,11 @@ public void testTpcdsQ32()
public void testTpcdsQ33()
throws Exception
{
assertQuery(session, getTpcdsQuery("33"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("33"));
}
}

@Test
Expand Down Expand Up @@ -731,7 +739,11 @@ public void testTpcdsQ36()
public void testTpcdsQ37()
throws Exception
{
assertQuery(session, getTpcdsQuery("37"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("37"));
}
}

@Test
Expand Down Expand Up @@ -759,7 +771,11 @@ public void testTpcdsQ39_2()
public void testTpcdsQ40()
throws Exception
{
assertQuery(session, getTpcdsQuery("40"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("40"));
}
}

@Test
Expand All @@ -780,7 +796,11 @@ public void testTpcdsQ42()
public void testTpcdsQ43()
throws Exception
{
assertQuery(session, getTpcdsQuery("43"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("43"));
}
}

@Test
Expand Down Expand Up @@ -822,7 +842,11 @@ public void testTpcdsQ48()
public void testTpcdsQ49()
throws Exception
{
assertQuery(session, getTpcdsQuery("49"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("49"));
}
}

@Test
Expand Down Expand Up @@ -871,7 +895,11 @@ public void testTpcdsQ55()
public void testTpcdsQ56()
throws Exception
{
assertQuery(session, getTpcdsQuery("56"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("56"));
}
}

@Test
Expand Down Expand Up @@ -899,14 +927,22 @@ public void testTpcdsQ59()
public void testTpcdsQ60()
throws Exception
{
assertQuery(session, getTpcdsQuery("60"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("60"));
}
}

@Test
public void testTpcdsQ61()
throws Exception
{
assertQuery(session, getTpcdsQuery("61"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("61"));
}
}

@Test
Expand Down Expand Up @@ -1041,7 +1077,11 @@ public void testTpcdsQ79()
public void testTpcdsQ80()
throws Exception
{
assertQuery(session, getTpcdsQuery("80"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("80"));
}
}

@Test
Expand All @@ -1055,7 +1095,11 @@ public void testTpcdsQ81()
public void testTpcdsQ82()
throws Exception
{
assertQuery(session, getTpcdsQuery("82"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("82"));
}
}

@Test
Expand Down Expand Up @@ -1118,7 +1162,11 @@ public void testTpcdsQ90()
public void testTpcdsQ91()
throws Exception
{
assertQuery(session, getTpcdsQuery("91"));
// TODO After https://github.com/facebookincubator/velox/pull/11067 merged,
// we can enable this test for ORC.
if (!storageFormat.equals("ORC")) {
assertQuery(session, getTpcdsQuery("91"));
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ public static void createNation(QueryRunner queryRunner)
if (!queryRunner.tableExists(queryRunner.getDefaultSession(), "nation")) {
queryRunner.execute("CREATE TABLE nation AS SELECT * FROM tpch.tiny.nation");
}
if (!queryRunner.tableExists(queryRunner.getDefaultSession(), "nation")) {
queryRunner.execute("CREATE TABLE nation WITH (FORMAT = 'ORC') AS SELECT * FROM tpch.tiny.nation");
}
if (!queryRunner.tableExists(queryRunner.getDefaultSession(), "nation_json")) {
queryRunner.execute("CREATE TABLE nation_json WITH (FORMAT = 'JSON') AS SELECT * FROM tpch.tiny.nation");
}
Expand All @@ -214,7 +217,7 @@ public static void createNationWithFormat(Session session, QueryRunner queryRunn
}

if (storageFormat.equals("ORC") && !queryRunner.tableExists(session, "nation")) {
queryRunner.execute("CREATE TABLE nation WITH (FORMAT = 'ORC') AS SELECT * FROM tpch.tiny.nation");
queryRunner.execute(session, "CREATE TABLE nation WITH (FORMAT = 'ORC') AS SELECT * FROM tpch.tiny.nation");
}

if (storageFormat.equals("JSON") && !queryRunner.tableExists(session, "nation_json")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.nativeworker;

import com.facebook.presto.testing.ExpectedQueryRunner;
import com.facebook.presto.testing.QueryRunner;

import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.createJavaIcebergQueryRunner;
import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.createNativeIcebergQueryRunner;

public class TestPrestoNativeIcebergPositionDeleteQueriesOrcUsingThrift
extends AbstractTestNativeIcebergPositionDeleteQueries
{
private final String storageFormat = "ORC";

@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return createNativeIcebergQueryRunner(true, storageFormat);
}

@Override
protected ExpectedQueryRunner createExpectedQueryRunner()
throws Exception
{
return createJavaIcebergQueryRunner(storageFormat);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.createJavaIcebergQueryRunner;
import static com.facebook.presto.nativeworker.PrestoNativeQueryRunnerUtils.createNativeIcebergQueryRunner;

public class TestPrestoNativeIcebergPositionDeleteQueriesUsingThrift
public class TestPrestoNativeIcebergPositionDeleteQueriesParquetUsingThrift
extends AbstractTestNativeIcebergPositionDeleteQueries
{
private final String storageFormat = "PARQUET";
Expand Down
Loading

0 comments on commit 794aa57

Please sign in to comment.