This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JdbcDialect dialect = new JdbcDialect() { | |
| @Override | |
| public boolean canHandle(String url) { | |
| return url.startsWith("jdbc:oracle") || url.contains("oracle"); | |
| } | |
| @Override | |
| public Option<JdbcType> getJDBCType(DataType dt) { | |
| if(DataTypes.StringType.sameType(dt)) { | |
| return Option.apply(new JdbcType("VARCHAR2(255)", java.sql.Types.VARCHAR)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * :: DeveloperApi :: | |
| * Default Oracle dialect, mapping a nonspecific numeric type to a general decimal type. | |
| */ | |
| @DeveloperApi | |
| case object OracleDialect extends JdbcDialect { | |
| override def canHandle(url: String): Boolean = url.startsWith("jdbc:oracle") | |
| override def getCatalystType( | |
| sqlType: Int, typeName: String, size: Int, md: MetadataBuilder): Option[DataType] = { | |
| // Handle NUMBER fields that have no precision/scale in special way |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TEMPORARY TABLE words using org.apache.spark.sql.cassandra OPTIONS ( table "words", keyspace "test", cluster "Test Cluster", pushdown "true") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void writeBatch(final Statement statement, final String recordString){ | |
| try { | |
| getSession().execute(statement); | |
| } catch (WriteTimeoutException timeoutException){ | |
| WriteType writeType = timeoutException.getWriteType(); | |
| switch (writeType){ | |
| case BATCH: | |
| LOG.warn("Batch did not complete fully on the initial coordinator. This batch will be retried on " + | |
| "two other nodes and will likely complete, however there may be a time window where it is out of sync." | |
| + recordString, timeoutException); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import static org.hamcrest.MatcherAssert.assertThat; | |
| import static org.hamcrest.core.Is.is; | |
| /** | |
| * Created by rsvihla on 12/2/2015. | |
| */ | |
| public abstract class BaseIntegrationTest { | |
| protected abstract DataRepository getDataRepository(); | |
| private MyService service; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Record{ | |
| private String value; | |
| private Integer id; | |
| //setters and getters follow | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE work_counts ( status varchar(50), count int, PRIMARY KEY(status)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- against server for Western US users | |
| SELECT * FROM users WHERE last_name = 'Jones' | |
| -- against server for Eastern US users | |
| SELECT * FROM users WHERE last_name = 'Jones' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSERT INTO work_queue (work_id, work, status) values ( 100898, 'data to process', 'PENDING') | |
| --against a bunch of separate servers because of sharding and probably done in a batch job | |
| -- not at write time as that may take minutes | |
| SELECT count(*) FROM work_queue where status='PENDING' | |
| --against yet another server again because of sharding | |
| INSERT INTO work_counts ( status, count) values ( 'PENDING', 1298008) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * | |
| * Copyright 2015 Foundational Development | |
| * | |
| * 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 |