@Override public Page getOutput() { if (split == null) { return null; } if (!finishing && pageSource == null && cursor == null) { ConnectorPageSource source = pageSourceProvider.createPageSource(operatorContext.getSession(), split, columns); if (source instanceof RecordPageSource) { cursor = ((RecordPageSource) source).getCursor(); } else { pageSource = source; } } if (pageSource != null) { return processPageSource(); } else { return processColumnSource(); } }
private static void assertFileContents( ConnectorSession session, File dataFile, Iterator<?>[] expectedValues, List<String> columnNames, List<Type> columnTypes) throws IOException { try (ConnectorPageSource pageSource = getFileFormat().createFileFormatReader( session, HDFS_ENVIRONMENT, dataFile, columnNames, columnTypes)) { if (pageSource instanceof RecordPageSource) { assertRecordCursor(columnTypes, expectedValues, ((RecordPageSource) pageSource).getCursor()); } else { assertPageSource(columnTypes, expectedValues, pageSource); } assertFalse(stream(expectedValues).allMatch(Iterator::hasNext)); } }
false); RecordCursor cursor = ((RecordPageSource) pageSource.get()).getCursor();
protected static void assertPageSourceType(ConnectorPageSource pageSource, HiveStorageFormat hiveStorageFormat) { if (pageSource instanceof RecordPageSource) { RecordCursor hiveRecordCursor = ((RecordPageSource) pageSource).getCursor(); hiveRecordCursor = ((HiveRecordCursor) hiveRecordCursor).getRegularColumnRecordCursor(); if (hiveRecordCursor instanceof HiveCoercionRecordCursor) { hiveRecordCursor = ((HiveCoercionRecordCursor) hiveRecordCursor).getRegularColumnRecordCursor(); } assertInstanceOf(hiveRecordCursor, recordCursorType(hiveStorageFormat), hiveStorageFormat.name()); } else { assertInstanceOf(((HivePageSource) pageSource).getPageSource(), pageSourceType(hiveStorageFormat), hiveStorageFormat.name()); } }
private void createSourceIfNecessary() { if ((split != null) && (pageSource == null) && (cursor == null)) { ConnectorPageSource source = pageSourceProvider.createPageSource(operatorContext.getSession(), split, columns); if (source instanceof RecordPageSource) { cursor = ((RecordPageSource) source).getCursor(); } else { pageSource = source; } } }
private static void assertFileContents( ConnectorSession session, File dataFile, Iterator<?>[] expectedValues, List<String> columnNames, List<Type> columnTypes) throws IOException { try (ConnectorPageSource pageSource = getFileFormat().createFileFormatReader( session, HDFS_ENVIRONMENT, dataFile, columnNames, columnTypes)) { if (pageSource instanceof RecordPageSource) { assertRecordCursor(columnTypes, expectedValues, ((RecordPageSource) pageSource).getCursor()); } else { assertPageSource(columnTypes, expectedValues, pageSource); } assertFalse(stream(expectedValues).allMatch(Iterator::hasNext)); } }
false); RecordCursor cursor = ((RecordPageSource) pageSource.get()).getCursor();
protected static void assertPageSourceType(ConnectorPageSource pageSource, HiveStorageFormat hiveStorageFormat) { if (pageSource instanceof RecordPageSource) { assertInstanceOf(((RecordPageSource) pageSource).getCursor(), recordCursorType(hiveStorageFormat), hiveStorageFormat.name()); } else { assertInstanceOf(pageSource, pageSourceType(hiveStorageFormat), hiveStorageFormat.name()); } }
protected static void assertPageSourceType(ConnectorPageSource pageSource, HiveStorageFormat hiveStorageFormat) { if (pageSource instanceof RecordPageSource) { RecordCursor hiveRecordCursor = ((RecordPageSource) pageSource).getCursor(); hiveRecordCursor = ((HiveRecordCursor) hiveRecordCursor).getRegularColumnRecordCursor(); if (hiveRecordCursor instanceof HiveCoercionRecordCursor) { hiveRecordCursor = ((HiveCoercionRecordCursor) hiveRecordCursor).getRegularColumnRecordCursor(); } assertInstanceOf(hiveRecordCursor, recordCursorType(hiveStorageFormat), hiveStorageFormat.name()); } else { assertInstanceOf(((HivePageSource) pageSource).getPageSource(), pageSourceType(hiveStorageFormat), hiveStorageFormat.name()); } }