Skip to content

Instantly share code, notes, and snippets.

View rdblue's full-sized avatar

Ryan Blue rdblue

View GitHub Profile
@rdblue
rdblue / Variants.java
Last active October 28, 2024 15:41
Spec-based Java implementation of Variant
/*
*
* * 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
* * to you 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
* *
POST /v1/namespaces/ns/tables/t/scans
{ "filter": { "type": "in", "term": "x", "values": [1, 2, 3] }, "select": ["x", "a.b"]}
{ "scan-id": 1, "shards": { "id": 1, "manifests": ["C"] }, { "id": 2, "manifests": ["D"] } }
POST /v1/namespaces/ns/tables/t/scans?scan-id=1
{ "shard": { "id": 1, "manifests": ["C"] }, "filter": {"type": "in", "term": "x", "values": [1, 2, 3] } }
{ "file-scan-tasks": [...] }
@rdblue
rdblue / flink_iceberg_diff_1.14_to_1.15.diff
Created May 3, 2022 15:50 — forked from kbendick/flink_iceberg_diff_1.14_to_1.15.txt
Propsed Iceberg Support for Flink 1.15 Diff from Iceberg Flink 1.14
/*
* 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
* to you 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
package org.apache.iceberg.types;
import java.util.List;
import org.apache.iceberg.Schema;
import org.apache.iceberg.relocated.com.google.common.collect.Lists;
public abstract class SchemaWithPartnerVisitor<P, R> {
public interface PartnerAccessors<P> {
P fieldPartner(P partnerStruct, int fieldId, String name);
P mapKeyPartner(P partnerMap);
/**
* The base physical plan for writing data into data source v2.
*/
abstract class V2TableWriteExec(
options: Map[String, String],
query: SparkPlan) extends SparkPlan {
import org.apache.spark.sql.sources.v2.DataSourceV2Implicits._
def partitioning: Seq[PartitionTransform]
override def children: Seq[SparkPlan] = Seq(query)
@rdblue
rdblue / DataFrameWriterV2.scala
Created May 22, 2019 22:21
Prototype DataFrameWriter for v2 tables
/**
* Interface used to write a [[Dataset]] to external storage using the v2 API.
*
* @since 3.0.0
*/
@Experimental
final class DataFrameWriterV2[T] private[sql](table: String, ds: Dataset[T])
extends CreateTableWriter[T] with LookupCatalog {
import org.apache.spark.sql.catalog.v2.CatalogV2Implicits._
@rdblue
rdblue / DSv2Analysis.scala
Last active September 19, 2018 22:23
DataSourceV2 SQL Analysis Rules
/*
* 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 to You 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
*
/*
* 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 to You 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
*
@rdblue
rdblue / Comparators.java
Created November 9, 2017 16:49
Java Comparators for CharSequence and ByteBuffer
import java.nio.ByteBuffer;
import java.util.Comparator;
public class Comparators {
public static Comparator<ByteBuffer> unsignedBytes() {
return UnsignedByteBufComparator.INSTANCE;
}
public static Comparator<ByteBuffer> signedBytes() {
return Comparator.naturalOrder();