-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@no-snow refactor a few variables into ClientBufferParameters (#581)
- Loading branch information
1 parent
257aeee
commit 3a3cbc8
Showing
5 changed files
with
109 additions
and
42 deletions.
There are no files selected for viewing
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
77 changes: 77 additions & 0 deletions
77
src/main/java/net/snowflake/ingest/streaming/internal/ClientBufferParameters.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (c) 2023 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
package net.snowflake.ingest.streaming.internal; | ||
|
||
import net.snowflake.ingest.utils.ParameterProvider; | ||
|
||
/** Channel's buffer relevant parameters that are set at the owning client level. */ | ||
public class ClientBufferParameters { | ||
|
||
private boolean enableParquetInternalBuffering; | ||
|
||
private long maxChunkSizeInBytes; | ||
|
||
private long maxAllowedRowSizeInBytes; | ||
|
||
/** | ||
* Private constructor used for test methods | ||
* | ||
* @param enableParquetInternalBuffering flag whether buffering in internal Parquet buffers is | ||
* enabled | ||
* @param maxChunkSizeInBytes maximum chunk size in bytes | ||
* @param maxAllowedRowSizeInBytes maximum row size in bytes | ||
*/ | ||
private ClientBufferParameters( | ||
boolean enableParquetInternalBuffering, | ||
long maxChunkSizeInBytes, | ||
long maxAllowedRowSizeInBytes) { | ||
this.enableParquetInternalBuffering = enableParquetInternalBuffering; | ||
this.maxChunkSizeInBytes = maxChunkSizeInBytes; | ||
this.maxAllowedRowSizeInBytes = maxAllowedRowSizeInBytes; | ||
} | ||
|
||
/** @param clientInternal reference to the client object where the relevant parameters are set */ | ||
public ClientBufferParameters(SnowflakeStreamingIngestClientInternal clientInternal) { | ||
this.enableParquetInternalBuffering = | ||
clientInternal != null | ||
? clientInternal.getParameterProvider().getEnableParquetInternalBuffering() | ||
: ParameterProvider.ENABLE_PARQUET_INTERNAL_BUFFERING_DEFAULT; | ||
this.maxChunkSizeInBytes = | ||
clientInternal != null | ||
? clientInternal.getParameterProvider().getMaxChunkSizeInBytes() | ||
: ParameterProvider.MAX_CHUNK_SIZE_IN_BYTES_DEFAULT; | ||
this.maxAllowedRowSizeInBytes = | ||
clientInternal != null | ||
? clientInternal.getParameterProvider().getMaxAllowedRowSizeInBytes() | ||
: ParameterProvider.MAX_ALLOWED_ROW_SIZE_IN_BYTES_DEFAULT; | ||
} | ||
|
||
/** | ||
* @param enableParquetInternalBuffering flag whether buffering in internal Parquet buffers is | ||
* enabled | ||
* @param maxChunkSizeInBytes maximum chunk size in bytes | ||
* @param maxAllowedRowSizeInBytes maximum row size in bytes | ||
* @return ClientBufferParameters object | ||
*/ | ||
public static ClientBufferParameters test_createClientBufferParameters( | ||
boolean enableParquetInternalBuffering, | ||
long maxChunkSizeInBytes, | ||
long maxAllowedRowSizeInBytes) { | ||
return new ClientBufferParameters( | ||
enableParquetInternalBuffering, maxChunkSizeInBytes, maxAllowedRowSizeInBytes); | ||
} | ||
|
||
public boolean getEnableParquetInternalBuffering() { | ||
return enableParquetInternalBuffering; | ||
} | ||
|
||
public long getMaxChunkSizeInBytes() { | ||
return maxChunkSizeInBytes; | ||
} | ||
|
||
public long getMaxAllowedRowSizeInBytes() { | ||
return maxAllowedRowSizeInBytes; | ||
} | ||
} |
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
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
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