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
from pyspark.sql import SparkSession | |
# Initialize a Spark session | |
spark = SparkSession.builder.appName("sql_dataframe").getOrCreate() | |
# Read the CSV file into a DataFrame, with header and schema inference options enabled | |
productSales = spark.read.option("header", "true")\ | |
.option("inferSchema", "true").csv("file:///Users/mmafrar/DataRetrieval/Salesstore.csv") | |
# Print the inferred schema of the DataFrame |
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 collections | |
from pyspark import SparkConf, SparkContext | |
# Set up the Spark configuration and context | |
cfg = SparkConf().setMaster("local").setAppName("ratings_histogram") | |
ctx = SparkContext(conf=cfg) | |
# Load the data from the specified file | |
lines = ctx.textFile("file:///Users/mmafrar/Partition/ml-100k/u.data") | |
print(type(lines)) # Print the type of 'lines' to verify it's an RDD |
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
val input_file = sc. textFile("/Users/mmafrar/WordCount/input_file.txt") | |
input_file.collect | |
val word = input_file.flatMap(line => line.split(" ")) | |
word.collect | |
val mapdata = word. map (word => (word, 1)) |
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
package com.example.kafka; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.kafka.annotation.KafkaListener; | |
import org.springframework.kafka.support.KafkaHeaders; | |
import org.springframework.messaging.handler.annotation.Header; | |
import org.springframework.stereotype.Service; | |
@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
package com.example.kafka; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.kafka.core.KafkaTemplate; | |
import org.springframework.kafka.support.SendResult; | |
import org.springframework.stereotype.Service; | |
import org.springframework.util.concurrent.ListenableFuture; | |
import org.springframework.util.concurrent.ListenableFutureCallback; |
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
package com.example.kafka; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.CommandLineRunner; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.WebApplicationType; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.kafka.config.KafkaListenerEndpointRegistry; | |
import org.springframework.kafka.listener.MessageListenerContainer; |
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
spring: | |
kafka: | |
bootstrap-servers: <BOOTSTRAP_SERVER_URL> | |
properties: | |
security: | |
protocol: SASL_SSL | |
sasl: | |
jaas: | |
config: org.apache.kafka.common.security.plain.PlainLoginModule required username='<CLUSTER_API_KEY>' password='<CLUSTER_API_SECRET>'; | |
mechanism: PLAIN |
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
package com.example.demo.service; | |
import com.example.demo.model.Contact; | |
import org.junit.jupiter.api.AfterAll; | |
import org.junit.jupiter.api.Assertions; | |
import org.junit.jupiter.api.BeforeAll; | |
import org.junit.jupiter.api.Test; | |
import org.junit.jupiter.api.TestInstance; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.context.SpringBootTest; |
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
package com.example.demo; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.boot.builder.SpringApplicationBuilder; | |
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | |
@SpringBootApplication | |
public class DemoApplication extends SpringBootServletInitializer { |
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
# Java Gradle CircleCI 2.0 configuration file | |
# | |
# Check https://circleci.com/docs/2.0/language-java/ for more details | |
# | |
version: 2 | |
jobs: | |
build: | |
docker: | |
# specify the version you desire here | |
- image: circleci/openjdk:8-jdk |
NewerOlder