Skip to content

Instantly share code, notes, and snippets.

View vinodnerella's full-sized avatar

Vinod Kumar Nerella vinodnerella

View GitHub Profile
@vinodnerella
vinodnerella / apache-phoenix-labs
Last active June 19, 2018 08:42
how to use apache phonenix on Itversity Labs
Using Apache Phoenix on labs:
export PHOENIX_HOME=/usr/hdp/2.5.0.0-1245/phoenix/
export PATH=$PATH:$PHOENIX_HOME/bin
# Save the files us_population.sql, us_populatipn.csv and us_population_queries.sql with the below information
us_population.sql
Sqoop takes a long time to retrieve the minimum and maximum values of the column specified in the --split-by parameter that are needed for breaking the data into multiple independent tasks.
mysql -u retail_dba -h nn01.itversity.com -pitversity
use retail_export;
mysql> create table int_splitby (col1 integer, col2 char(10));
Query OK, 0 rows affected (0.34 sec)
@vinodnerella
vinodnerella / sample-scala-program-json-df-printschema
Created October 13, 2017 06:42
sample scala program to get json file and printschema
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.sql.SQLContext
object discuss {
def main(args: Array[String]) = {
val conf = new SparkConf().setAppName("file format").setMaster("local")
val sc= new SparkContext(conf)
val sqlc = new SQLContext(sc)
[testkerberos@cdh000 ~]$ hadoop jar /opt/cloudera/parcels/CDH-5.12.1-1.cdh5.12.1.p0.3/jars/hadoop-examples.jar pi 10 1000
Number of Maps = 10
Samples per Map = 1000
Wrote input for Map #0
Wrote input for Map #1
Wrote input for Map #2
Wrote input for Map #3
Wrote input for Map #4
Wrote input for Map #5
Wrote input for Map #6
[vagrant@cdhnode0 ~]$ sudo fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x4700a9c8.
Command (m for help): p
@vinodnerella
vinodnerella / importsqlintoelastic.py
Created May 19, 2017 12:15
Importing SQL data into Elasticsearch
#Importing MySQL database to elasticsearch
# Importing required modules and connecting to elasticsearch
from pyelasticsearch import ElasticSearch
es = ElasticSearch('http://localhost:9200/')
import json
import requests
import MySQLdb
//Expression
println("********")
println("Expression")
val c = {
val i = 1
val j = math.pow(2, 10)
i - j
}
println(c)