Skip to content

Instantly share code, notes, and snippets.

Avatar

Hendry Suwanda hendrysuwanda

View GitHub Profile
@hendrysuwanda
hendrysuwanda / simple_hive_query_consume_huge_yarn_resources.md
Last active May 3, 2018
Why this simple hive query consume huge yarn resource
View simple_hive_query_consume_huge_yarn_resources.md

This is not partition table

Query

select * from lyr1_raw.CI_CUSTMAST_HS;

Total Record

11.957.465

Format File

Avro

View java_read_stdin.java
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din = new DataInputStream(System.in);
@hendrysuwanda
hendrysuwanda / oracle_generate_date_between_2_date_ranges.sql
Last active Sep 15, 2017
how to generating dates between two date ranges (ex: from 20-Mar-2015 until 20-Apr-2015)
View oracle_generate_date_between_2_date_ranges.sql
select to_date('20032015','ddMMyyyy') + rownum -1 price_date
from all_objects
where rownum <= to_date('20042015','ddMMyyyy')-to_date('20032015','ddMMyyyy')+1
@hendrysuwanda
hendrysuwanda / print_an_array_using_lambda_exp.java
Created Sep 15, 2017
How to using java's lambda expression to print an array
View print_an_array_using_lambda_exp.java
Arrays.stream(values).forEach(i -> System.out.println(Integer.toUnsignedString(i, 16)));
Arrays.stream(values)
.mapToObj(i -> Integer.toUnsignedString(i, 16))
.forEach(System.out::println);
String[] nums = {"three","two","one"};
Arrays.stream(nums).forEach(num -> System.out.println(num));
IntStream.of(values)
View check_pythons_installation_path.py
>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\\Python25'
@hendrysuwanda
hendrysuwanda / SparkCopyPostgres.scala
Created Dec 10, 2016 — forked from longcao/SparkCopyPostgres.scala
COPY Spark DataFrame rows to PostgreSQL (via JDBC)
View SparkCopyPostgres.scala
import java.io.InputStream
import org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils
import org.apache.spark.sql.{ DataFrame, Row }
import org.postgresql.copy.CopyManager
import org.postgresql.core.BaseConnection
val jdbcUrl = s"jdbc:postgresql://..." // db credentials elided
val connectionProperties = {
@hendrysuwanda
hendrysuwanda / LaporanTagihan.txt
Created Oct 5, 2011 — forked from endymuhardin/LaporanTagihan.txt
Contoh Direct Print dengan Java
View LaporanTagihan.txt
LAPORAN DAFTAR PELUNASAN KOLETKOR
AGEN PT. ARTIVISI INTERMEDIA
=====================================================================================================================
KODE KOLEKTOR : 0001
NAMA KOLEKTOR : JOJO
+------+--------------+---------------------------+---------+-------------+-------------+-------------+-------------+
@hendrysuwanda
hendrysuwanda / LaporanTagihan.txt
Created Oct 5, 2011 — forked from endymuhardin/LaporanTagihan.txt
Contoh Direct Print dengan Java
View LaporanTagihan.txt
LAPORAN DAFTAR PELUNASAN KOLETKOR
AGEN PT. ARTIVISI INTERMEDIA
=====================================================================================================================
KODE KOLEKTOR : 0001
NAMA KOLEKTOR : JOJO
+------+--------------+---------------------------+---------+-------------+-------------+-------------+-------------+
You can’t perform that action at this time.