This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.Documents; | |
namespace DocumentDBPerfScaleTest | |
{ | |
public class Student |
This file contains 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
// Check if database exists, if not create it | |
Database database = client.CreateDatabaseQuery().Where(db => db.Id == id).ToArray().FirstOrDefault(); | |
if (database == null) | |
{ | |
database = await client.CreateDatabaseAsync(new Database { Id = id }); | |
} | |
// Get collection | |
StudentsCollection = client.CreateDocumentCollectionQuery(database.SelfLink).Where(c => c.Id == collectionId).ToArray().FirstOrDefault(); |
This file contains 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 async Task InsertDocumentAsync(Student student, bool showDebugInfo) | |
{ | |
ResourceResponse<Document> response = await client.CreateDocumentAsync(colSelfLink, student); | |
Console.WriteLine("{0}\tInsert Operation, # of RUs: {1}", DateTime.UtcNow, response.RequestCharge); | |
} |
This file contains 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
var queryIterator = documentClient.queryDocuments(collection._self, query); | |
executeNextWithRetry(yourCallback); | |
function executeNextWithRetry(callback) { | |
queryIterator.executeNext(function(err, results, responseHeaders) { | |
if(err && err.code === 429 && responseHeaders['x-ms-retry-after-ms']) { | |
console.log("Retrying after " + responseHeaders['x-ms-retry-after-ms']); | |
setTimeout(function() { |
This file contains 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
/* Copied from: https://github.com/Azure/azure-documentdb-net/blob/master/samples/code-samples/ServerSideScripts/JS/BulkImport.js | |
*/ | |
function bulkImport(docs) { | |
var collection = getContext().getCollection(); | |
var collectionLink = collection.getSelfLink(); | |
// The count of imported docs, also used as current doc index. | |
var count = 0; |
This file contains 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
/// <summary> | |
/// Execute the function with retries on throttle | |
/// </summary> | |
/// <typeparam name="V"></typeparam> | |
/// <param name="client"></param> | |
/// <param name="function"></param> | |
/// <returns></returns> | |
private static async Task<V> ExecuteWithRetries<V>(DocumentClient client, Func<Task<V>> function) | |
{ | |
TimeSpan sleepTime = TimeSpan.Zero; |
This file contains 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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.microsoft.css</groupId> | |
<artifactId>HiveJdbcTest</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>HiveJdbcTest</name> | |
<url>http://maven.apache.org</url> | |
<dependencies> |
This file contains 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.microsoft.css; | |
/** | |
* Created by muddin on 6/4/2015. | |
*/ | |
import java.sql.*; | |
public class MyHiveJdbcTest { | |
public static void main(String[] args) throws SQLException { |
This file contains 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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.microsoft.css</groupId> | |
<artifactId>HBaseJavaApiTest</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>HBaseJavaApiTest</name> | |
<url>http://maven.apache.org</url> | |
<dependencies> |
This file contains 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
<?xml version="1.0"?> | |
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | |
<!-- | |
/** | |
* Copyright 2010 The Apache Software Foundation | |
* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file |
NewerOlder