@Test public void testTypesTextFile() throws Exception { assertGetRecords("presto_test_types_textfile", TEXTFILE); }
@Test public void testTypesSequenceFile() throws Exception { assertGetRecords("presto_test_types_sequencefile", SEQUENCEFILE); }
@Test public void testTypesRcBinary() throws Exception { assertGetRecords("presto_test_types_rcbinary", RCBINARY); }
@Test public void testTypesRcText() throws Exception { assertGetRecords("presto_test_types_rctext", RCTEXT); }
protected void assertGetRecordsOptional(String tableName, HiveStorageFormat hiveStorageFormat) throws Exception { try (Transaction transaction = newTransaction()) { ConnectorMetadata metadata = transaction.getMetadata(); if (metadata.getTableHandle(newSession(), new SchemaTableName(database, tableName)) != null) { assertGetRecords(tableName, hiveStorageFormat); } } }
protected void assertGetRecords(String tableName, HiveStorageFormat hiveStorageFormat) throws Exception { try (Transaction transaction = newTransaction()) { ConnectorSession session = newSession(); ConnectorMetadata metadata = transaction.getMetadata(); ConnectorTableHandle tableHandle = getTableHandle(metadata, new SchemaTableName(database, tableName)); ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle); HiveSplit hiveSplit = getHiveSplit(tableHandle); List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(session, tableHandle).values()); ConnectorPageSource pageSource = pageSourceProvider.createPageSource(transaction.getTransactionHandle(), session, hiveSplit, columnHandles); assertGetRecords(hiveStorageFormat, tableMetadata, hiveSplit, pageSource, columnHandles); } }
@Test public void testTypesTextFile() throws Exception { assertGetRecords("presto_test_types_textfile", TEXTFILE); }
@Test public void testTypesRcBinary() throws Exception { assertGetRecords("presto_test_types_rcbinary", RCBINARY); }
@Test public void testTypesRcText() throws Exception { assertGetRecords("presto_test_types_rctext", RCTEXT); }
@Test public void testTypesSequenceFile() throws Exception { assertGetRecords("presto_test_types_sequencefile", SEQUENCEFILE); }
@Test public void testTypesRcText() throws Exception { assertGetRecords("presto_test_types_rctext", RCTEXT); }
@Test public void testTypesRcBinary() throws Exception { assertGetRecords("presto_test_types_rcbinary", RCBINARY); }
@Test public void testTypesSequenceFile() throws Exception { assertGetRecords("presto_test_types_sequencefile", SEQUENCEFILE); }
@Test public void testTypesTextFile() throws Exception { assertGetRecords("presto_test_types_textfile", TEXTFILE); }
protected void assertGetRecordsOptional(String tableName, HiveStorageFormat hiveStorageFormat) throws Exception { if (newMetadata().getTableHandle(newSession(), new SchemaTableName(database, tableName)) != null) { assertGetRecords(tableName, hiveStorageFormat); } }
protected void assertGetRecordsOptional(String tableName, HiveStorageFormat hiveStorageFormat) throws Exception { try (Transaction transaction = newTransaction()) { ConnectorMetadata metadata = transaction.getMetadata(); if (metadata.getTableHandle(newSession(), new SchemaTableName(database, tableName)) != null) { assertGetRecords(tableName, hiveStorageFormat); } } }
protected void assertGetRecords(String tableName, HiveStorageFormat hiveStorageFormat) throws Exception { ConnectorSession session = newSession(); ConnectorTransactionHandle transaction = newTransaction(); ConnectorMetadata metadata = newMetadata(); ConnectorTableHandle tableHandle = getTableHandle(metadata, new SchemaTableName(database, tableName)); ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle); HiveSplit hiveSplit = getHiveSplit(tableHandle); List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(session, tableHandle).values()); ConnectorPageSource pageSource = pageSourceProvider.createPageSource(transaction, session, hiveSplit, columnHandles); assertGetRecords(hiveStorageFormat, tableMetadata, hiveSplit, pageSource, columnHandles); }
protected void assertGetRecords(String tableName, HiveStorageFormat hiveStorageFormat) throws Exception { try (Transaction transaction = newTransaction()) { ConnectorSession session = newSession(); ConnectorMetadata metadata = transaction.getMetadata(); ConnectorTableHandle tableHandle = getTableHandle(metadata, new SchemaTableName(database, tableName)); ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle); HiveSplit hiveSplit = getHiveSplit(tableHandle); List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(session, tableHandle).values()); ConnectorPageSource pageSource = pageSourceProvider.createPageSource(transaction.getTransactionHandle(), session, hiveSplit, columnHandles); assertGetRecords(hiveStorageFormat, tableMetadata, hiveSplit, pageSource, columnHandles); } }
@Test public void testTypesRcBinaryRecordCursor() throws Exception { ConnectorSession session = newSession(); ConnectorMetadata metadata = newMetadata(); if (metadata.getTableHandle(session, new SchemaTableName(database, "presto_test_types_rcbinary")) == null) { return; } ConnectorTableHandle tableHandle = getTableHandle(metadata, new SchemaTableName(database, "presto_test_types_rcbinary")); ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle); HiveSplit hiveSplit = getHiveSplit(tableHandle); List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(session, tableHandle).values()); ConnectorPageSourceProvider pageSourceProvider = new HivePageSourceProvider( new HiveClientConfig().setTimeZone(timeZone.getID()), hdfsEnvironment, ImmutableSet.<HiveRecordCursorProvider>of(new ColumnarBinaryHiveRecordCursorProvider()), ImmutableSet.<HivePageSourceFactory>of(), TYPE_MANAGER); ConnectorPageSource pageSource = pageSourceProvider.createPageSource(newTransaction(), session, hiveSplit, columnHandles); assertGetRecords(RCBINARY, tableMetadata, hiveSplit, pageSource, columnHandles); }
@Test public void testTypesRcTextRecordCursor() throws Exception { ConnectorSession session = newSession(); ConnectorMetadata metadata = newMetadata(); if (metadata.getTableHandle(session, new SchemaTableName(database, "presto_test_types_rctext")) == null) { return; } ConnectorTableHandle tableHandle = getTableHandle(metadata, new SchemaTableName(database, "presto_test_types_rctext")); ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle); HiveSplit hiveSplit = getHiveSplit(tableHandle); List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(session, tableHandle).values()); ConnectorPageSourceProvider pageSourceProvider = new HivePageSourceProvider( new HiveClientConfig().setTimeZone(timeZone.getID()), hdfsEnvironment, ImmutableSet.<HiveRecordCursorProvider>of(new ColumnarTextHiveRecordCursorProvider()), ImmutableSet.<HivePageSourceFactory>of(), TYPE_MANAGER); ConnectorPageSource pageSource = pageSourceProvider.createPageSource(newTransaction(), session, hiveSplit, columnHandles); assertGetRecords(RCTEXT, tableMetadata, hiveSplit, pageSource, columnHandles); }