diff --git a/presto-docs/src/main/sphinx/presto-cpp.rst b/presto-docs/src/main/sphinx/presto-cpp.rst index 894fab1767f34..e91bfc1c84f1f 100644 --- a/presto-docs/src/main/sphinx/presto-cpp.rst +++ b/presto-docs/src/main/sphinx/presto-cpp.rst @@ -54,4 +54,6 @@ Only specific connectors are supported in the Presto C++ evaluation engine. * Iceberg connector supports both V1 and V2 tables, including tables with delete files. +* Supports reading and writing of DWRF and PARQUET file formats, ORC only supports reading. + * TPCH connector, with ``tpch.naming=standard`` catalog property. \ No newline at end of file diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index 0a422c66e16bd..b00422315e3ac 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -57,6 +57,7 @@ #include "velox/connectors/tpch/TpchConnector.h" #include "velox/dwio/dwrf/RegisterDwrfReader.h" #include "velox/dwio/dwrf/RegisterDwrfWriter.h" +#include "velox/dwio/orc/reader/OrcReader.h" #include "velox/dwio/parquet/RegisterParquetReader.h" #include "velox/dwio/parquet/RegisterParquetWriter.h" #include "velox/exec/OutputBufferManager.h" @@ -1391,6 +1392,7 @@ void PrestoServer::registerMemoryArbitrators() { void PrestoServer::registerFileReadersAndWriters() { velox::dwrf::registerDwrfReaderFactory(); velox::dwrf::registerDwrfWriterFactory(); + velox::orc::registerOrcReaderFactory(); velox::parquet::registerParquetReaderFactory(); velox::parquet::registerParquetWriterFactory(); } diff --git a/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp b/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp index 9cc3568787e2b..38c8e785663ad 100644 --- a/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp +++ b/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp @@ -72,6 +72,9 @@ dwio::common::FileFormat toVeloxFileFormat( const presto::protocol::hive::StorageFormat& format) { if (format.inputFormat == "com.facebook.hive.orc.OrcInputFormat") { return dwio::common::FileFormat::DWRF; + } else if ( + format.inputFormat == "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat") { + return dwio::common::FileFormat::ORC; } else if ( format.inputFormat == "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat") { diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeTpcdsQueries.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeTpcdsQueries.java index 815938cd31b07..bab4db678d362 100644 --- a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeTpcdsQueries.java +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/AbstractTestNativeTpcdsQueries.java @@ -21,10 +21,13 @@ import org.testng.annotations.Test; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import static com.facebook.presto.SystemSessionProperties.QUERY_MAX_EXECUTION_TIME; import static com.facebook.presto.SystemSessionProperties.QUERY_MAX_RUN_TIME; import static java.nio.charset.StandardCharsets.UTF_8; +import static org.testng.Assert.assertEquals; public abstract class AbstractTestNativeTpcdsQueries extends AbstractTestQueryFramework @@ -33,6 +36,7 @@ public abstract class AbstractTestNativeTpcdsQueries Session session; String[] tpcdsFactTableNames = {"catalog_returns", "catalog_sales", "web_sales", "web_returns", "inventory", "store_sales", "store_returns"}; + Map deletedRowsMap = new HashMap<>(); @Override protected void createTables() @@ -82,6 +86,7 @@ private static void createTpcdsCallCenter(QueryRunner queryRunner, Session sessi if (!queryRunner.tableExists(session, "call_center")) { switch (storageFormat) { case "PARQUET": + case "ORC": queryRunner.execute(session, "CREATE TABLE call_center AS " + "SELECT cc_call_center_sk, cast(cc_call_center_id as varchar) as cc_call_center_id, cc_rec_start_date, cc_rec_end_date, " + " cc_closed_date_sk, cc_open_date_sk, cc_name, cc_class, cc_employees, cc_sq_ft, cast(cc_hours as varchar) as cc_hours, " + @@ -173,6 +178,7 @@ private static void createTpcdsDateDim(QueryRunner queryRunner, Session session, if (!queryRunner.tableExists(session, "date_dim")) { switch (storageFormat) { case "PARQUET": + case "ORC": queryRunner.execute(session, "CREATE TABLE date_dim AS " + "SELECT d_date_sk, cast(d_date_id as varchar) as d_date_id, d_date, " + " d_month_seq, d_week_seq, d_quarter_seq, d_year, d_dow, d_moy, d_dom, d_qoy, d_fy_year, " + @@ -230,6 +236,7 @@ private static void createTpcdsItem(QueryRunner queryRunner, Session session, St if (!queryRunner.tableExists(session, "item")) { switch (storageFormat) { case "PARQUET": + case "ORC": queryRunner.execute(session, "CREATE TABLE item AS " + "SELECT i_item_sk, cast(i_item_id as varchar) as i_item_id, i_rec_start_date, i_rec_end_date, " + " i_item_desc, i_current_price, i_wholesale_cost, i_brand_id, cast(i_brand as varchar) as i_brand, " + @@ -293,6 +300,7 @@ private static void createTpcdsStore(QueryRunner queryRunner, Session session, S if (!queryRunner.tableExists(session, "store")) { switch (storageFormat) { case "PARQUET": + case "ORC": queryRunner.execute(session, "CREATE TABLE store AS " + "SELECT s_store_sk, cast(s_store_id as varchar) as s_store_id, s_rec_start_date, s_rec_end_date, " + " s_closed_date_sk, s_store_name, s_number_employees, s_floor_space, cast(s_hours as varchar) as s_hours, " + @@ -362,6 +370,7 @@ private static void createTpcdsWebPage(QueryRunner queryRunner, Session session, if (!queryRunner.tableExists(session, "web_page")) { switch (storageFormat) { case "PARQUET": + case "ORC": queryRunner.execute(session, "CREATE TABLE web_page AS " + "SELECT wp_web_page_sk, cast(wp_web_page_id as varchar) as wp_web_page_id, wp_rec_start_date, wp_rec_end_date, " + " wp_creation_date_sk, wp_access_date_sk, cast(wp_autogen_flag as varchar) as wp_autogen_flag, wp_customer_sk, " + @@ -401,6 +410,7 @@ private static void createTpcdsWebSite(QueryRunner queryRunner, Session session, if (!queryRunner.tableExists(session, "web_site")) { switch (storageFormat) { case "PARQUET": + case "ORC": queryRunner.execute(session, "CREATE TABLE web_site AS " + "SELECT web_site_sk, cast(web_site_id as varchar) as web_site_id, web_rec_start_date, web_rec_end_date, web_name, " + " web_open_date_sk, web_close_date_sk, web_class, web_manager, web_mkt_id, web_mkt_class, web_mkt_desc, web_market_manager, " + @@ -589,7 +599,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 @@ -697,7 +711,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 @@ -725,7 +743,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 @@ -753,7 +775,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 @@ -774,7 +800,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 @@ -816,7 +846,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 @@ -865,7 +899,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 @@ -893,14 +931,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 @@ -1035,7 +1081,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 @@ -1049,7 +1099,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 @@ -1112,7 +1166,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 @@ -1170,4 +1228,247 @@ public void testTpcdsQ99() { assertQuery(session, getTpcdsQuery("99")); } + + protected void doDeletes() + { + DF_CS(); + DF_SS(); + DF_WS(); + DF_I(); + } + + private void DF_CS() + { + assertUpdateExpected(session, "DELETE FROM catalog_returns " + + "WHERE cr_order_number IN (SELECT cs_order_number " + + " FROM catalog_sales, " + + " date_dim " + + " WHERE cs_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'2000-05-20' AND " + + " date'2000-05-21') ", + 7L); + + assertUpdateExpected(session, "DELETE FROM catalog_sales " + + "WHERE cs_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2000-05-20' AND date'2000-05-21') " + + " AND cs_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2000-05-20' AND " + + " date'2000-05-21') ", + 54L); + + assertUpdateExpected(session, "DELETE FROM catalog_returns " + + "WHERE cr_order_number IN (SELECT cs_order_number " + + " FROM catalog_sales, " + + " date_dim " + + " WHERE cs_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'1999-09-18' AND " + + " date'1999-09-19') ", + 12L); + + assertUpdateExpected(session, "DELETE FROM catalog_sales " + + "WHERE cs_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-18' AND date'1999-09-19') " + + " AND cs_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-18' AND " + + " date'1999-09-19') ", + 123L); + + assertUpdateExpected(session, "DELETE FROM catalog_returns " + + "WHERE cr_order_number IN (SELECT cs_order_number " + + " FROM catalog_sales, " + + " date_dim " + + " WHERE cs_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'2002-11-12' AND " + + " date'2002-11-13') ", + 15L); + + assertUpdateExpected(session, "DELETE FROM catalog_sales " + + "WHERE cs_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-12' AND date'2002-11-13') " + + " AND cs_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-12' AND" + + " date'2002-11-13') ", + 197L); + deletedRowsMap.put("catalog_sales", 374L); + deletedRowsMap.put("catalog_returns", 34L); + } + + private void DF_SS() + { + assertUpdateExpected(session, "DELETE FROM store_returns " + + "WHERE sr_ticket_number IN (SELECT ss_ticket_number " + + " FROM store_sales, " + + " date_dim " + + " WHERE ss_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'2000-05-20' AND " + + " date'2000-05-21') ", + 4L); + + assertUpdateExpected(session, "DELETE FROM store_sales " + + "WHERE ss_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2000-05-20' AND date'2000-05-21') " + + " AND ss_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2000-05-20' AND " + + " date'2000-05-21') ", + 64L); + + assertUpdateExpected(session, "DELETE FROM store_returns " + + "WHERE sr_ticket_number IN (SELECT ss_ticket_number " + + " FROM store_sales, " + + " date_dim " + + " WHERE ss_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'1999-09-18' AND " + + " date'1999-09-19') ", + 13L); + + assertUpdateExpected(session, "DELETE FROM store_sales " + + "WHERE ss_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-18' AND date'1999-09-19') " + + " AND ss_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-18' AND " + + " date'1999-09-19') ", + 111L); + + assertUpdateExpected(session, "DELETE FROM store_returns " + + "WHERE sr_ticket_number IN (SELECT ss_ticket_number " + + " FROM store_sales, " + + " date_dim " + + " WHERE ss_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'2002-11-12' AND " + + " date'2002-11-13') ", + 20L); + + assertUpdateExpected(session, "DELETE FROM store_sales " + + "WHERE ss_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-12' AND date'2002-11-13') " + + " AND ss_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-12' AND " + + " date'2002-11-13') ", + 185L); + deletedRowsMap.put("store_sales", 360L); + deletedRowsMap.put("store_returns", 37L); + } + + private void DF_WS() + { + assertUpdateExpected(session, "DELETE FROM web_returns " + + "WHERE wr_order_number IN (SELECT ws_order_number " + + " FROM web_sales, " + + " date_dim " + + " WHERE ws_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'2000-05-20' AND " + + " date'2000-05-21') ", + 0L); + + assertUpdateExpected(session, "DELETE FROM web_sales " + + "WHERE ws_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2000-05-20' AND date'2000-05-21') " + + " AND ws_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2000-05-20' AND " + + " date'2000-05-21') ", + 0L); + + assertUpdateExpected(session, "DELETE FROM web_returns " + + "WHERE wr_order_number IN (SELECT ws_order_number " + + " FROM web_sales, " + + " date_dim " + + " WHERE ws_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'1999-09-18' AND " + + " date'1999-09-19') ", + 0L); + + assertUpdateExpected(session, "DELETE FROM web_sales " + + "WHERE ws_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-18' AND date'1999-09-19') " + + " AND ws_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-18' AND " + + " date'1999-09-19') ", + 22L); + + assertUpdateExpected(session, "DELETE FROM web_returns " + + "WHERE wr_order_number IN (SELECT ws_order_number " + + " FROM web_sales, " + + " date_dim " + + " WHERE ws_sold_date_sk = d_date_sk " + + " AND d_date BETWEEN date'2002-11-12' AND " + + " date'2002-11-13') ", + 4L); + + assertUpdateExpected(session, "DELETE FROM web_sales " + + "WHERE ws_sold_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-12' AND date'2002-11-13') " + + " AND ws_sold_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-12' AND " + + " date'2002-11-13') ", + 42L); + deletedRowsMap.put("web_sales", 64L); + deletedRowsMap.put("web_returns", 4L); + } + + private void DF_I() + { + assertUpdateExpected(session, "DELETE FROM inventory " + + "WHERE inv_date_sk >= (SELECT Min(d_date_sk) " + + "FROM date_dim " + + "WHERE d_date BETWEEN date'2000-05-18' AND date'2000-05-25') " + + "AND inv_date_sk <= (SELECT Max(d_date_sk) " + + "FROM date_dim " + + "WHERE d_date BETWEEN date'2000-05-18' AND date'2000-05-25') ", 2002L); + + assertUpdateExpected(session, "DELETE FROM inventory " + + "WHERE inv_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-16' AND date'1999-09-23') " + + " AND inv_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'1999-09-16' AND date'1999-09-23') ", 2002L); + + assertUpdateExpected(session, "DELETE FROM inventory " + + "WHERE inv_date_sk >= (SELECT Min(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-14' AND date'2002-11-21') " + + " AND inv_date_sk <= (SELECT Max(d_date_sk) " + + " FROM date_dim " + + " WHERE d_date BETWEEN date'2002-11-14' AND date'2002-11-21') ", 2002L); + deletedRowsMap.put("inventory", 6006L); + } + + private String getCountQuery(String tableName) + { + return "SELECT COUNT(*) FROM " + tableName; + } + + protected void verifyDeletes() + { + Session tpcdsConnSession = Session.builder(session) + .setCatalog("tpcds") + .setSchema("tiny") + .build(); + for (Map.Entry entry : deletedRowsMap.entrySet()) { + String tableName = entry.getKey(); + Long numDeletedRows = entry.getValue(); + String countQuery = getCountQuery(tableName); + Long originalRowcount = (long) computeScalarExpected(tpcdsConnSession, countQuery); + Long postDeleteRowcount = (long) computeScalar(session, countQuery); + assertEquals(originalRowcount - postDeleteRowcount, numDeletedRows); + } + } } diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/NativeQueryRunnerUtils.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/NativeQueryRunnerUtils.java index 40c999cf9de78..f515af775834d 100644 --- a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/NativeQueryRunnerUtils.java +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/NativeQueryRunnerUtils.java @@ -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"); } @@ -214,7 +217,7 @@ public static void createNationWithFormat(Session session, QueryRunner queryRunn } if (storageFormat.equals("ORC") && !queryRunner.tableExists(session, "nation")) { - queryRunner.execute(session, "CREATE TABLE nation 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")) { diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesOrcUsingThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesOrcUsingThrift.java new file mode 100644 index 0000000000000..c18eb82b444d4 --- /dev/null +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesOrcUsingThrift.java @@ -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); + } +} diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesUsingThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesParquetUsingThrift.java similarity index 94% rename from presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesUsingThrift.java rename to presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesParquetUsingThrift.java index fee37db4bba1c..c6515fb4a18f9 100644 --- a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesUsingThrift.java +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergPositionDeleteQueriesParquetUsingThrift.java @@ -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"; diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpcdsQueriesOrcUsingThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpcdsQueriesOrcUsingThrift.java new file mode 100644 index 0000000000000..c4ec4ddc44b0a --- /dev/null +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpcdsQueriesOrcUsingThrift.java @@ -0,0 +1,153 @@ +/* + * 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 org.testng.annotations.Test; + +@Test(groups = {"orc"}) +public class TestPrestoNativeIcebergTpcdsQueriesOrcUsingThrift + extends AbstractTestNativeTpcdsQueries +{ + @Override + protected QueryRunner createQueryRunner() + throws Exception + { + this.storageFormat = "ORC"; + return PrestoNativeQueryRunnerUtils.createNativeIcebergQueryRunner(true, "ORC"); + } + + @Override + protected ExpectedQueryRunner createExpectedQueryRunner() + throws Exception + { + this.storageFormat = "ORC"; + return PrestoNativeQueryRunnerUtils.createJavaIcebergQueryRunner("ORC"); + } + + protected void runAllQueries() throws Exception + { + testTpcdsQ1(); + testTpcdsQ2(); + testTpcdsQ3(); + testTpcdsQ4(); + testTpcdsQ5(); + testTpcdsQ6(); + testTpcdsQ7(); + testTpcdsQ8(); + testTpcdsQ9(); + testTpcdsQ10(); + testTpcdsQ11(); + testTpcdsQ12(); + testTpcdsQ13(); + testTpcdsQ14_1(); + testTpcdsQ14_2(); + testTpcdsQ15(); + testTpcdsQ16(); + testTpcdsQ17(); + testTpcdsQ18(); + testTpcdsQ19(); + testTpcdsQ20(); + // testTpcdsQ21(); + testTpcdsQ22(); + testTpcdsQ23_1(); + testTpcdsQ23_2(); + testTpcdsQ24_1(); + testTpcdsQ24_2(); + testTpcdsQ25(); + testTpcdsQ26(); + testTpcdsQ27(); + testTpcdsQ28(); + testTpcdsQ29(); + testTpcdsQ30(); + testTpcdsQ31(); + testTpcdsQ32(); + // testTpcdsQ33(); + testTpcdsQ34(); + testTpcdsQ35(); + testTpcdsQ36(); + // testTpcdsQ37(); + testTpcdsQ38(); + testTpcdsQ39_1(); + testTpcdsQ39_2(); + // testTpcdsQ40(); + testTpcdsQ41(); + testTpcdsQ42(); + // testTpcdsQ43(); + testTpcdsQ44(); + testTpcdsQ45(); + testTpcdsQ46(); + testTpcdsQ47(); + testTpcdsQ48(); + // testTpcdsQ49(); + testTpcdsQ50(); + testTpcdsQ51(); + testTpcdsQ52(); + testTpcdsQ53(); + testTpcdsQ54(); + testTpcdsQ55(); + // testTpcdsQ56(); + testTpcdsQ57(); + testTpcdsQ58(); + testTpcdsQ59(); + // testTpcdsQ60(); + // testTpcdsQ61(); + testTpcdsQ62(); + testTpcdsQ63(); + testTpcdsQ65(); + testTpcdsQ66(); + testTpcdsQ67(); + testTpcdsQ68(); + testTpcdsQ69(); + testTpcdsQ70(); + testTpcdsQ71(); + testTpcdsQ72(); + testTpcdsQ73(); + testTpcdsQ74(); + testTpcdsQ75(); + testTpcdsQ76(); + testTpcdsQ77(); + testTpcdsQ78(); + testTpcdsQ79(); + // testTpcdsQ80(); + testTpcdsQ81(); + // testTpcdsQ82(); + testTpcdsQ83(); + testTpcdsQ84(); + testTpcdsQ85(); + testTpcdsQ86(); + testTpcdsQ87(); + testTpcdsQ88(); + testTpcdsQ89(); + testTpcdsQ90(); + // testTpcdsQ91(); + testTpcdsQ92(); + testTpcdsQ93(); + testTpcdsQ94(); + testTpcdsQ95(); + testTpcdsQ96(); + testTpcdsQ97(); + testTpcdsQ98(); + testTpcdsQ99(); + } + + @Test + public void doDeletesAndQuery() throws Exception + { + doDeletes(); + verifyDeletes(); + runAllQueries(); + } +} diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpcdsQueriesParquetUsingThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpcdsQueriesParquetUsingThrift.java index 64aca9644a61a..7567c5c248067 100644 --- a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpcdsQueriesParquetUsingThrift.java +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpcdsQueriesParquetUsingThrift.java @@ -13,25 +13,19 @@ */ package com.facebook.presto.nativeworker; -import com.facebook.presto.Session; import com.facebook.presto.testing.ExpectedQueryRunner; import com.facebook.presto.testing.QueryRunner; import org.testng.annotations.Test; -import java.util.HashMap; -import java.util.Map; - -import static org.testng.Assert.assertEquals; - @Test(groups = {"parquet"}) public class TestPrestoNativeIcebergTpcdsQueriesParquetUsingThrift extends AbstractTestNativeTpcdsQueries { - Map deletedRowsMap = new HashMap<>(); @Override protected QueryRunner createQueryRunner() throws Exception { + this.storageFormat = "PARQUET"; return PrestoNativeQueryRunnerUtils.createNativeIcebergQueryRunner(true, "PARQUET"); } @@ -149,249 +143,6 @@ protected void runAllQueries() throws Exception testTpcdsQ99(); } - private void doDeletes() - { - DF_CS(); - DF_SS(); - DF_WS(); - DF_I(); - } - - private void DF_CS() - { - assertUpdateExpected(session, "DELETE FROM catalog_returns " + - "WHERE cr_order_number IN (SELECT cs_order_number " + - " FROM catalog_sales, " + - " date_dim " + - " WHERE cs_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'2000-05-20' AND " + - " date'2000-05-21') ", - 7L); - - assertUpdateExpected(session, "DELETE FROM catalog_sales " + - "WHERE cs_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2000-05-20' AND date'2000-05-21') " + - " AND cs_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2000-05-20' AND " + - " date'2000-05-21') ", - 54L); - - assertUpdateExpected(session, "DELETE FROM catalog_returns " + - "WHERE cr_order_number IN (SELECT cs_order_number " + - " FROM catalog_sales, " + - " date_dim " + - " WHERE cs_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'1999-09-18' AND " + - " date'1999-09-19') ", - 12L); - - assertUpdateExpected(session, "DELETE FROM catalog_sales " + - "WHERE cs_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-18' AND date'1999-09-19') " + - " AND cs_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-18' AND " + - " date'1999-09-19') ", - 123L); - - assertUpdateExpected(session, "DELETE FROM catalog_returns " + - "WHERE cr_order_number IN (SELECT cs_order_number " + - " FROM catalog_sales, " + - " date_dim " + - " WHERE cs_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'2002-11-12' AND " + - " date'2002-11-13') ", - 15L); - - assertUpdateExpected(session, "DELETE FROM catalog_sales " + - "WHERE cs_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-12' AND date'2002-11-13') " + - " AND cs_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-12' AND" + - " date'2002-11-13') ", - 197L); - deletedRowsMap.put("catalog_sales", 374L); - deletedRowsMap.put("catalog_returns", 34L); - } - - private void DF_SS() - { - assertUpdateExpected(session, "DELETE FROM store_returns " + - "WHERE sr_ticket_number IN (SELECT ss_ticket_number " + - " FROM store_sales, " + - " date_dim " + - " WHERE ss_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'2000-05-20' AND " + - " date'2000-05-21') ", - 4L); - - assertUpdateExpected(session, "DELETE FROM store_sales " + - "WHERE ss_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2000-05-20' AND date'2000-05-21') " + - " AND ss_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2000-05-20' AND " + - " date'2000-05-21') ", - 64L); - - assertUpdateExpected(session, "DELETE FROM store_returns " + - "WHERE sr_ticket_number IN (SELECT ss_ticket_number " + - " FROM store_sales, " + - " date_dim " + - " WHERE ss_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'1999-09-18' AND " + - " date'1999-09-19') ", - 13L); - - assertUpdateExpected(session, "DELETE FROM store_sales " + - "WHERE ss_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-18' AND date'1999-09-19') " + - " AND ss_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-18' AND " + - " date'1999-09-19') ", - 111L); - - assertUpdateExpected(session, "DELETE FROM store_returns " + - "WHERE sr_ticket_number IN (SELECT ss_ticket_number " + - " FROM store_sales, " + - " date_dim " + - " WHERE ss_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'2002-11-12' AND " + - " date'2002-11-13') ", - 20L); - - assertUpdateExpected(session, "DELETE FROM store_sales " + - "WHERE ss_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-12' AND date'2002-11-13') " + - " AND ss_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-12' AND " + - " date'2002-11-13') ", - 185L); - deletedRowsMap.put("store_sales", 360L); - deletedRowsMap.put("store_returns", 37L); - } - - private void DF_WS() - { - assertUpdateExpected(session, "DELETE FROM web_returns " + - "WHERE wr_order_number IN (SELECT ws_order_number " + - " FROM web_sales, " + - " date_dim " + - " WHERE ws_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'2000-05-20' AND " + - " date'2000-05-21') ", - 0L); - - assertUpdateExpected(session, "DELETE FROM web_sales " + - "WHERE ws_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2000-05-20' AND date'2000-05-21') " + - " AND ws_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2000-05-20' AND " + - " date'2000-05-21') ", - 0L); - - assertUpdateExpected(session, "DELETE FROM web_returns " + - "WHERE wr_order_number IN (SELECT ws_order_number " + - " FROM web_sales, " + - " date_dim " + - " WHERE ws_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'1999-09-18' AND " + - " date'1999-09-19') ", - 0L); - - assertUpdateExpected(session, "DELETE FROM web_sales " + - "WHERE ws_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-18' AND date'1999-09-19') " + - " AND ws_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-18' AND " + - " date'1999-09-19') ", - 22L); - - assertUpdateExpected(session, "DELETE FROM web_returns " + - "WHERE wr_order_number IN (SELECT ws_order_number " + - " FROM web_sales, " + - " date_dim " + - " WHERE ws_sold_date_sk = d_date_sk " + - " AND d_date BETWEEN date'2002-11-12' AND " + - " date'2002-11-13') ", - 4L); - - assertUpdateExpected(session, "DELETE FROM web_sales " + - "WHERE ws_sold_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-12' AND date'2002-11-13') " + - " AND ws_sold_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-12' AND " + - " date'2002-11-13') ", - 42L); - deletedRowsMap.put("web_sales", 64L); - deletedRowsMap.put("web_returns", 4L); - } - - private void DF_I() - { - assertUpdateExpected(session, "DELETE FROM inventory " + - "WHERE inv_date_sk >= (SELECT Min(d_date_sk) " + - "FROM date_dim " + - "WHERE d_date BETWEEN date'2000-05-18' AND date'2000-05-25') " + - "AND inv_date_sk <= (SELECT Max(d_date_sk) " + - "FROM date_dim " + - "WHERE d_date BETWEEN date'2000-05-18' AND date'2000-05-25') ", 2002L); - - assertUpdateExpected(session, "DELETE FROM inventory " + - "WHERE inv_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-16' AND date'1999-09-23') " + - " AND inv_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'1999-09-16' AND date'1999-09-23') ", 2002L); - - assertUpdateExpected(session, "DELETE FROM inventory " + - "WHERE inv_date_sk >= (SELECT Min(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-14' AND date'2002-11-21') " + - " AND inv_date_sk <= (SELECT Max(d_date_sk) " + - " FROM date_dim " + - " WHERE d_date BETWEEN date'2002-11-14' AND date'2002-11-21') ", 2002L); - deletedRowsMap.put("inventory", 6006L); - } - - private String getCountQuery(String tableName) - { - return "SELECT COUNT(*) FROM " + tableName; - } - - private void verifyDeletes() - { - Session tpcdsConnSession = Session.builder(session) - .setCatalog("tpcds") - .setSchema("tiny") - .build(); - for (Map.Entry entry : deletedRowsMap.entrySet()) { - String tableName = entry.getKey(); - Long numDeletedRows = entry.getValue(); - String countQuery = getCountQuery(tableName); - Long originalRowcount = (long) computeScalarExpected(tpcdsConnSession, countQuery); - Long postDeleteRowcount = (long) computeScalar(session, countQuery); - assertEquals(originalRowcount - postDeleteRowcount, numDeletedRows); - } - } - @Test public void doDeletesAndQuery() throws Exception { diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesOrcUsingThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesOrcUsingThrift.java new file mode 100644 index 0000000000000..23499fd39d414 --- /dev/null +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesOrcUsingThrift.java @@ -0,0 +1,35 @@ +/* + * 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; + +public class TestPrestoNativeIcebergTpchQueriesOrcUsingThrift + extends AbstractTestNativeIcebergTpchQueries +{ + private final String storageFormat = "ORC"; + + @Override + protected QueryRunner createQueryRunner() throws Exception + { + return PrestoNativeQueryRunnerUtils.createNativeIcebergQueryRunner(true, storageFormat); + } + + @Override + protected ExpectedQueryRunner createExpectedQueryRunner() throws Exception + { + return PrestoNativeQueryRunnerUtils.createJavaIcebergQueryRunner(storageFormat); + } +} diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesUsingThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesParquetUsingThrift.java similarity index 94% rename from presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesUsingThrift.java rename to presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesParquetUsingThrift.java index d30712ceca375..ce94fe3bc3213 100644 --- a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesUsingThrift.java +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeIcebergTpchQueriesParquetUsingThrift.java @@ -16,7 +16,7 @@ import com.facebook.presto.testing.ExpectedQueryRunner; import com.facebook.presto.testing.QueryRunner; -public class TestPrestoNativeIcebergTpchQueriesUsingThrift +public class TestPrestoNativeIcebergTpchQueriesParquetUsingThrift extends AbstractTestNativeIcebergTpchQueries { @Override diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpcdsQueriesUsingOrcThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpcdsQueriesUsingOrcThrift.java new file mode 100644 index 0000000000000..2ba83c35e975a --- /dev/null +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpcdsQueriesUsingOrcThrift.java @@ -0,0 +1,38 @@ +/* + * 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 org.testng.annotations.Test; + +@Test(groups = {"orc"}) +public class TestPrestoNativeTpcdsQueriesUsingOrcThrift + extends AbstractTestNativeTpcdsQueries +{ + @Override + protected QueryRunner createQueryRunner() + throws Exception + { + return PrestoNativeQueryRunnerUtils.createNativeQueryRunner(true, "ORC"); + } + + @Override + protected ExpectedQueryRunner createExpectedQueryRunner() + throws Exception + { + this.storageFormat = "ORC"; + return PrestoNativeQueryRunnerUtils.createJavaQueryRunner("ORC"); + } +} diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpchQueriesOrcUsingJSON.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpchQueriesOrcUsingJSON.java new file mode 100644 index 0000000000000..141c94d610065 --- /dev/null +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpchQueriesOrcUsingJSON.java @@ -0,0 +1,35 @@ +/* + * 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 org.testng.annotations.Test; + +@Test(groups = {"orc"}) +public class TestPrestoNativeTpchQueriesOrcUsingJSON + extends AbstractTestNativeTpchQueries +{ + @Override + protected QueryRunner createQueryRunner() throws Exception + { + return PrestoNativeQueryRunnerUtils.createNativeQueryRunner(false, "ORC"); + } + + @Override + protected ExpectedQueryRunner createExpectedQueryRunner() throws Exception + { + return PrestoNativeQueryRunnerUtils.createJavaQueryRunner("ORC"); + } +} diff --git a/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpchQueriesOrcUsingThrift.java b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpchQueriesOrcUsingThrift.java new file mode 100644 index 0000000000000..43a77a0cc55aa --- /dev/null +++ b/presto-native-execution/src/test/java/com/facebook/presto/nativeworker/TestPrestoNativeTpchQueriesOrcUsingThrift.java @@ -0,0 +1,33 @@ +/* + * 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; + +public class TestPrestoNativeTpchQueriesOrcUsingThrift + extends AbstractTestNativeTpchQueries +{ + @Override + protected QueryRunner createQueryRunner() throws Exception + { + return PrestoNativeQueryRunnerUtils.createNativeQueryRunner(true, "ORC"); + } + + @Override + protected ExpectedQueryRunner createExpectedQueryRunner() throws Exception + { + return PrestoNativeQueryRunnerUtils.createJavaQueryRunner("ORC"); + } +}